mirror of https://gitee.com/bigwinds/arangodb
micro optimizations
This commit is contained in:
parent
7739d0ed78
commit
28930370c2
|
@ -292,7 +292,7 @@ Builder& Builder::close() {
|
|||
|
||||
// Maybe we need to move down data:
|
||||
if (offsetSize == 1) {
|
||||
unsigned int targetPos = 3;
|
||||
ValueLength targetPos = 3;
|
||||
if (!needIndexTable && _start[tos] == 0x06) {
|
||||
targetPos = 2;
|
||||
}
|
||||
|
@ -300,9 +300,11 @@ Builder& Builder::close() {
|
|||
ValueLength len = _pos - (tos + 9);
|
||||
memmove(_start + tos + targetPos, _start + tos + 9, checkOverflow(len));
|
||||
}
|
||||
_pos -= (9 - targetPos);
|
||||
for (size_t i = 0; i < index.size(); i++) {
|
||||
index[i] -= (9 - targetPos);
|
||||
ValueLength const diff = 9 - targetPos;
|
||||
_pos -= diff;
|
||||
size_t const n = index.size();
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
index[i] -= diff;
|
||||
}
|
||||
}
|
||||
// One could move down things in the offsetSize == 2 case as well,
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "Basics/hashes.h"
|
||||
#include "Indexes/SimpleAttributeEqualityMatcher.h"
|
||||
#include "Utils/CollectionNameResolver.h"
|
||||
#include "Utils/Transaction.h"
|
||||
#include "VocBase/document-collection.h"
|
||||
#include "VocBase/transaction.h"
|
||||
|
||||
|
@ -71,7 +72,7 @@ static uint64_t HashElementEdgeFrom(void*, TRI_doc_mptr_t const* mptr,
|
|||
} else {
|
||||
// Is identical to HashElementKey
|
||||
VPackSlice tmp(mptr->vpack());
|
||||
tmp = tmp.get(TRI_VOC_ATTRIBUTE_FROM);
|
||||
tmp = tmp.get(Transaction::FromString);
|
||||
TRI_ASSERT(tmp.isString());
|
||||
// we can get away with the fast hash function here, as edge
|
||||
// index values are restricted to strings
|
||||
|
@ -97,7 +98,7 @@ static uint64_t HashElementEdgeTo(void*, TRI_doc_mptr_t const* mptr,
|
|||
// Is identical to HashElementKey
|
||||
VPackSlice tmp(mptr->vpack());
|
||||
TRI_ASSERT(tmp.isObject());
|
||||
tmp = tmp.get(TRI_VOC_ATTRIBUTE_TO);
|
||||
tmp = tmp.get(Transaction::ToString);
|
||||
TRI_ASSERT(tmp.isString());
|
||||
// we can get away with the fast hash function here, as edge
|
||||
// index values are restricted to strings
|
||||
|
@ -118,7 +119,7 @@ static bool IsEqualKeyEdgeFrom(void*, VPackSlice const* left,
|
|||
// left is a key
|
||||
// right is an element, that is a master pointer
|
||||
VPackSlice tmp(right->vpack());
|
||||
tmp = tmp.get(TRI_VOC_ATTRIBUTE_FROM);
|
||||
tmp = tmp.get(Transaction::FromString);
|
||||
TRI_ASSERT(tmp.isString());
|
||||
return *left == tmp;
|
||||
}
|
||||
|
@ -135,7 +136,7 @@ static bool IsEqualKeyEdgeTo(void*, VPackSlice const* left,
|
|||
// left is a key
|
||||
// right is an element, that is a master pointer
|
||||
VPackSlice tmp(right->vpack());
|
||||
tmp = tmp.get(TRI_VOC_ATTRIBUTE_TO);
|
||||
tmp = tmp.get(Transaction::ToString);
|
||||
TRI_ASSERT(tmp.isString());
|
||||
return *left == tmp;
|
||||
}
|
||||
|
@ -160,11 +161,11 @@ static bool IsEqualElementEdgeFromByKey(void*,
|
|||
TRI_ASSERT(right != nullptr);
|
||||
|
||||
VPackSlice lSlice(left->vpack());
|
||||
lSlice = lSlice.get(TRI_VOC_ATTRIBUTE_FROM);
|
||||
lSlice = lSlice.get(Transaction::FromString);
|
||||
TRI_ASSERT(lSlice.isString());
|
||||
|
||||
VPackSlice rSlice(right->vpack());
|
||||
rSlice = rSlice.get(TRI_VOC_ATTRIBUTE_FROM);
|
||||
rSlice = rSlice.get(Transaction::FromString);
|
||||
TRI_ASSERT(rSlice.isString());
|
||||
return lSlice == rSlice;
|
||||
}
|
||||
|
@ -180,11 +181,11 @@ static bool IsEqualElementEdgeToByKey(void*,
|
|||
TRI_ASSERT(right != nullptr);
|
||||
|
||||
VPackSlice lSlice(left->vpack());
|
||||
lSlice = lSlice.get(TRI_VOC_ATTRIBUTE_TO);
|
||||
lSlice = lSlice.get(Transaction::ToString);
|
||||
TRI_ASSERT(lSlice.isString());
|
||||
|
||||
VPackSlice rSlice(right->vpack());
|
||||
rSlice = rSlice.get(TRI_VOC_ATTRIBUTE_TO);
|
||||
rSlice = rSlice.get(Transaction::ToString);
|
||||
TRI_ASSERT(rSlice.isString());
|
||||
return lSlice == rSlice;
|
||||
}
|
||||
|
@ -308,8 +309,8 @@ void AnyDirectionEdgeIndexIterator::reset() {
|
|||
EdgeIndex::EdgeIndex(TRI_idx_iid_t iid, TRI_document_collection_t* collection)
|
||||
: Index(iid, collection,
|
||||
std::vector<std::vector<arangodb::basics::AttributeName>>(
|
||||
{{{TRI_VOC_ATTRIBUTE_FROM, false}},
|
||||
{{TRI_VOC_ATTRIBUTE_TO, false}}}),
|
||||
{{{Transaction::FromString, false}},
|
||||
{{Transaction::ToString, false}}}),
|
||||
false, false),
|
||||
_edgesFrom(nullptr),
|
||||
_edgesTo(nullptr),
|
||||
|
@ -555,8 +556,8 @@ bool EdgeIndex::supportsFilterCondition(
|
|||
arangodb::aql::Variable const* reference, size_t itemsInIndex,
|
||||
size_t& estimatedItems, double& estimatedCost) const {
|
||||
SimpleAttributeEqualityMatcher matcher(
|
||||
{{arangodb::basics::AttributeName(TRI_VOC_ATTRIBUTE_FROM, false)},
|
||||
{arangodb::basics::AttributeName(TRI_VOC_ATTRIBUTE_TO, false)}});
|
||||
{{arangodb::basics::AttributeName(Transaction::FromString, false)},
|
||||
{arangodb::basics::AttributeName(Transaction::ToString, false)}});
|
||||
return matcher.matchOne(this, node, reference, itemsInIndex, estimatedItems,
|
||||
estimatedCost);
|
||||
}
|
||||
|
@ -572,8 +573,8 @@ IndexIterator* EdgeIndex::iteratorForCondition(
|
|||
TRI_ASSERT(node->type == aql::NODE_TYPE_OPERATOR_NARY_AND);
|
||||
|
||||
SimpleAttributeEqualityMatcher matcher(
|
||||
{{arangodb::basics::AttributeName(TRI_VOC_ATTRIBUTE_FROM, false)},
|
||||
{arangodb::basics::AttributeName(TRI_VOC_ATTRIBUTE_TO, false)}});
|
||||
{{arangodb::basics::AttributeName(Transaction::FromString, false)},
|
||||
{arangodb::basics::AttributeName(Transaction::ToString, false)}});
|
||||
|
||||
TRI_ASSERT(node->numMembers() == 1);
|
||||
|
||||
|
@ -628,8 +629,8 @@ arangodb::aql::AstNode* EdgeIndex::specializeCondition(
|
|||
arangodb::aql::AstNode* node,
|
||||
arangodb::aql::Variable const* reference) const {
|
||||
SimpleAttributeEqualityMatcher matcher(
|
||||
{{arangodb::basics::AttributeName(TRI_VOC_ATTRIBUTE_FROM, false)},
|
||||
{arangodb::basics::AttributeName(TRI_VOC_ATTRIBUTE_TO, false)}});
|
||||
{{arangodb::basics::AttributeName(Transaction::FromString, false)},
|
||||
{arangodb::basics::AttributeName(Transaction::ToString, false)}});
|
||||
|
||||
return matcher.specializeOne(this, node, reference);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "Basics/hashes.h"
|
||||
#include "Basics/tri-strings.h"
|
||||
#include "Indexes/SimpleAttributeEqualityMatcher.h"
|
||||
#include "Utils/Transaction.h"
|
||||
#include "VocBase/document-collection.h"
|
||||
#include "VocBase/transaction.h"
|
||||
|
||||
|
@ -60,7 +61,7 @@ static bool IsEqualKeyElement(void*, uint8_t const* key,
|
|||
|
||||
VPackSlice slice(key);
|
||||
VPackSlice other(element->vpack());
|
||||
return other.get(TRI_VOC_ATTRIBUTE_KEY).equals(slice);
|
||||
return other.get(Transaction::KeyString).equals(slice);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -76,7 +77,7 @@ static bool IsEqualElementElement(void*, TRI_doc_mptr_t const* left,
|
|||
VPackSlice l(left->vpack());
|
||||
VPackSlice r(right->vpack());
|
||||
|
||||
return l.get(TRI_VOC_ATTRIBUTE_KEY).equals(r.get(TRI_VOC_ATTRIBUTE_KEY));
|
||||
return l.get(Transaction::KeyString).equals(r.get(Transaction::KeyString));
|
||||
}
|
||||
|
||||
TRI_doc_mptr_t* PrimaryIndexIterator::next() {
|
||||
|
@ -124,7 +125,7 @@ void AnyIndexIterator::reset() {
|
|||
PrimaryIndex::PrimaryIndex(TRI_document_collection_t* collection)
|
||||
: Index(0, collection,
|
||||
std::vector<std::vector<arangodb::basics::AttributeName>>(
|
||||
{{{TRI_VOC_ATTRIBUTE_KEY, false}}}),
|
||||
{{{Transaction::KeyString, false}}}),
|
||||
true, false),
|
||||
_primaryIndex(nullptr) {
|
||||
uint32_t indexBuckets = 1;
|
||||
|
@ -396,8 +397,8 @@ bool PrimaryIndex::supportsFilterCondition(
|
|||
arangodb::aql::Variable const* reference, size_t itemsInIndex,
|
||||
size_t& estimatedItems, double& estimatedCost) const {
|
||||
SimpleAttributeEqualityMatcher matcher(
|
||||
{{arangodb::basics::AttributeName(TRI_VOC_ATTRIBUTE_ID, false)},
|
||||
{arangodb::basics::AttributeName(TRI_VOC_ATTRIBUTE_KEY, false)}});
|
||||
{{arangodb::basics::AttributeName(Transaction::IdString, false)},
|
||||
{arangodb::basics::AttributeName(Transaction::KeyString, false)}});
|
||||
|
||||
return matcher.matchOne(this, node, reference, itemsInIndex, estimatedItems,
|
||||
estimatedCost);
|
||||
|
@ -414,8 +415,8 @@ IndexIterator* PrimaryIndex::iteratorForCondition(
|
|||
TRI_ASSERT(node->type == aql::NODE_TYPE_OPERATOR_NARY_AND);
|
||||
|
||||
SimpleAttributeEqualityMatcher matcher(
|
||||
{{arangodb::basics::AttributeName(TRI_VOC_ATTRIBUTE_ID, false)},
|
||||
{arangodb::basics::AttributeName(TRI_VOC_ATTRIBUTE_KEY, false)}});
|
||||
{{arangodb::basics::AttributeName(Transaction::IdString, false)},
|
||||
{arangodb::basics::AttributeName(Transaction::KeyString, false)}});
|
||||
|
||||
TRI_ASSERT(node->numMembers() == 1);
|
||||
|
||||
|
@ -484,8 +485,8 @@ arangodb::aql::AstNode* PrimaryIndex::specializeCondition(
|
|||
arangodb::aql::AstNode* node,
|
||||
arangodb::aql::Variable const* reference) const {
|
||||
SimpleAttributeEqualityMatcher matcher(
|
||||
{{arangodb::basics::AttributeName(TRI_VOC_ATTRIBUTE_ID, false)},
|
||||
{arangodb::basics::AttributeName(TRI_VOC_ATTRIBUTE_KEY, false)}});
|
||||
{{arangodb::basics::AttributeName(Transaction::IdString, false)},
|
||||
{arangodb::basics::AttributeName(Transaction::KeyString, false)}});
|
||||
|
||||
return matcher.specializeOne(this, node, reference);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "Basics/AttributeNameParser.h"
|
||||
#include "Basics/debugging.h"
|
||||
#include "Basics/VelocyPackHelper.h"
|
||||
#include "Utils/Transaction.h"
|
||||
#include "VocBase/document-collection.h"
|
||||
|
||||
#include <velocypack/Iterator.h>
|
||||
|
@ -543,8 +544,8 @@ int SkiplistIndex::ElementElementComparator::operator()(
|
|||
}
|
||||
|
||||
// We break this tie in the key comparison by looking at the key:
|
||||
VPackSlice leftKey = VPackSlice(leftElement->document()->vpack()).get(TRI_VOC_ATTRIBUTE_KEY);
|
||||
VPackSlice rightKey = VPackSlice(rightElement->document()->vpack()).get(TRI_VOC_ATTRIBUTE_KEY);
|
||||
VPackSlice leftKey = VPackSlice(leftElement->document()->vpack()).get(Transaction::KeyString);
|
||||
VPackSlice rightKey = VPackSlice(rightElement->document()->vpack()).get(Transaction::KeyString);
|
||||
|
||||
int compareResult = leftKey.compareString(rightKey.copyString());
|
||||
|
||||
|
|
|
@ -57,6 +57,16 @@
|
|||
#include <velocypack/velocypack-aliases.h>
|
||||
|
||||
using namespace arangodb;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief constants for _id, _key, _rev
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::string const Transaction::KeyString(TRI_VOC_ATTRIBUTE_KEY);
|
||||
std::string const Transaction::RevString(TRI_VOC_ATTRIBUTE_REV);
|
||||
std::string const Transaction::IdString(TRI_VOC_ATTRIBUTE_ID);
|
||||
std::string const Transaction::FromString(TRI_VOC_ATTRIBUTE_FROM);
|
||||
std::string const Transaction::ToString(TRI_VOC_ATTRIBUTE_TO);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief IndexHandle getter method
|
||||
|
@ -593,7 +603,7 @@ DocumentDitch* Transaction::orderDitch(TRI_voc_cid_t cid) {
|
|||
std::string Transaction::extractKey(VPackSlice const slice) {
|
||||
// extract _key
|
||||
if (slice.isObject()) {
|
||||
VPackSlice k = slice.get(TRI_VOC_ATTRIBUTE_KEY);
|
||||
VPackSlice k = slice.get(KeyString);
|
||||
if (!k.isString()) {
|
||||
return ""; // fail
|
||||
}
|
||||
|
@ -630,7 +640,7 @@ std::string Transaction::extractIdString(CollectionNameResolver const* resolver,
|
|||
VPackSlice id = slice;
|
||||
if (slice.isObject()) {
|
||||
// extract id attribute from object
|
||||
id = slice.get(TRI_VOC_ATTRIBUTE_ID);
|
||||
id = slice.get(IdString);
|
||||
}
|
||||
if (id.isString()) {
|
||||
// already a string...
|
||||
|
@ -644,9 +654,9 @@ std::string Transaction::extractIdString(CollectionNameResolver const* resolver,
|
|||
// we now need to extract the _key attribute
|
||||
VPackSlice key;
|
||||
if (slice.isObject()) {
|
||||
key = slice.get(TRI_VOC_ATTRIBUTE_KEY);
|
||||
key = slice.get(KeyString);
|
||||
} else if (base.isObject()) {
|
||||
key = base.get(TRI_VOC_ATTRIBUTE_KEY);
|
||||
key = base.get(KeyString);
|
||||
}
|
||||
|
||||
if (!key.isString()) {
|
||||
|
@ -680,13 +690,11 @@ void Transaction::buildDocumentIdentity(VPackBuilder& builder,
|
|||
VPackSlice const oldRid,
|
||||
TRI_doc_mptr_t const* oldMptr,
|
||||
TRI_doc_mptr_t const* newMptr) {
|
||||
std::string collectionName = resolver()->getCollectionName(cid);
|
||||
|
||||
builder.openObject();
|
||||
builder.add(TRI_VOC_ATTRIBUTE_ID, VPackValue(collectionName + "/" + key));
|
||||
builder.add(TRI_VOC_ATTRIBUTE_KEY, VPackValue(key));
|
||||
builder.add(IdString, VPackValue(resolver()->getCollectionName(cid) + "/" + key));
|
||||
builder.add(KeyString, VPackValue(key));
|
||||
TRI_ASSERT(!rid.isNone());
|
||||
builder.add(TRI_VOC_ATTRIBUTE_REV, rid);
|
||||
builder.add(RevString, rid);
|
||||
if (!oldRid.isNone()) {
|
||||
builder.add("_oldRev", oldRid);
|
||||
}
|
||||
|
@ -1228,7 +1236,7 @@ OperationResult Transaction::insertLocal(std::string const& collectionName,
|
|||
TRI_ASSERT(mptr.getDataPtr() != nullptr);
|
||||
|
||||
std::string keyString
|
||||
= VPackSlice(mptr.vpack()).get(TRI_VOC_ATTRIBUTE_KEY).copyString();
|
||||
= VPackSlice(mptr.vpack()).get(KeyString).copyString();
|
||||
|
||||
TIMER_START(TRANSACTION_INSERT_BUILD_DOCUMENT_IDENTITY);
|
||||
|
||||
|
@ -1280,10 +1288,10 @@ OperationResult Transaction::insertLocal(std::string const& collectionName,
|
|||
auto doOneDoc = [&](VPackSlice doc, VPackSlice result) {
|
||||
VPackObjectBuilder guard(&payload);
|
||||
TRI_SanitizeObject(doc, payload);
|
||||
VPackSlice s = result.get(TRI_VOC_ATTRIBUTE_KEY);
|
||||
payload.add(TRI_VOC_ATTRIBUTE_KEY, s);
|
||||
s = result.get(TRI_VOC_ATTRIBUTE_REV);
|
||||
payload.add(TRI_VOC_ATTRIBUTE_REV, s);
|
||||
VPackSlice s = result.get(KeyString);
|
||||
payload.add(KeyString, s);
|
||||
s = result.get(RevString);
|
||||
payload.add(RevString, s);
|
||||
};
|
||||
|
||||
VPackSlice ourResult = resultBuilder.slice();
|
||||
|
@ -1560,7 +1568,7 @@ OperationResult Transaction::modifyLocal(
|
|||
if (res == TRI_ERROR_ARANGO_CONFLICT) {
|
||||
// still return
|
||||
if ((!options.silent || doingSynchronousReplication) && !isBabies) {
|
||||
std::string key = newVal.get(TRI_VOC_ATTRIBUTE_KEY).copyString();
|
||||
std::string key = newVal.get(KeyString).copyString();
|
||||
buildDocumentIdentity(resultBuilder, cid, key, actualRevision,
|
||||
VPackSlice(),
|
||||
options.returnOld ? &previous : nullptr, nullptr);
|
||||
|
@ -1573,7 +1581,7 @@ OperationResult Transaction::modifyLocal(
|
|||
TRI_ASSERT(mptr.getDataPtr() != nullptr);
|
||||
|
||||
if (!options.silent || doingSynchronousReplication) {
|
||||
std::string key = newVal.get(TRI_VOC_ATTRIBUTE_KEY).copyString();
|
||||
std::string key = newVal.get(KeyString).copyString();
|
||||
buildDocumentIdentity(resultBuilder, cid, key,
|
||||
mptr.revisionIdAsSlice(), actualRevision,
|
||||
options.returnOld ? &previous : nullptr ,
|
||||
|
@ -1622,10 +1630,10 @@ OperationResult Transaction::modifyLocal(
|
|||
auto doOneDoc = [&](VPackSlice doc, VPackSlice result) {
|
||||
VPackObjectBuilder guard(&payload);
|
||||
TRI_SanitizeObject(doc, payload);
|
||||
VPackSlice s = result.get(TRI_VOC_ATTRIBUTE_KEY);
|
||||
payload.add(TRI_VOC_ATTRIBUTE_KEY, s);
|
||||
s = result.get(TRI_VOC_ATTRIBUTE_REV);
|
||||
payload.add(TRI_VOC_ATTRIBUTE_REV, s);
|
||||
VPackSlice s = result.get(KeyString);
|
||||
payload.add(KeyString, s);
|
||||
s = result.get(RevString);
|
||||
payload.add(RevString, s);
|
||||
};
|
||||
|
||||
VPackSlice ourResult = resultBuilder.slice();
|
||||
|
@ -1799,11 +1807,11 @@ OperationResult Transaction::removeLocal(std::string const& collectionName,
|
|||
value = builder->slice();
|
||||
}
|
||||
} else if (value.isObject()) {
|
||||
VPackSlice keySlice = value.get(TRI_VOC_ATTRIBUTE_KEY);
|
||||
VPackSlice keySlice = value.get(KeyString);
|
||||
if (!keySlice.isString()) {
|
||||
return TRI_ERROR_ARANGO_DOCUMENT_HANDLE_BAD;
|
||||
}
|
||||
key = value.get(TRI_VOC_ATTRIBUTE_KEY).copyString();
|
||||
key = value.get(KeyString).copyString();
|
||||
} else {
|
||||
return TRI_ERROR_ARANGO_DOCUMENT_HANDLE_BAD;
|
||||
}
|
||||
|
@ -1869,10 +1877,10 @@ OperationResult Transaction::removeLocal(std::string const& collectionName,
|
|||
auto doOneDoc = [&](VPackSlice doc, VPackSlice result) {
|
||||
VPackObjectBuilder guard(&payload);
|
||||
TRI_SanitizeObject(doc, payload);
|
||||
VPackSlice s = result.get(TRI_VOC_ATTRIBUTE_KEY);
|
||||
payload.add(TRI_VOC_ATTRIBUTE_KEY, s);
|
||||
s = result.get(TRI_VOC_ATTRIBUTE_REV);
|
||||
payload.add(TRI_VOC_ATTRIBUTE_REV, s);
|
||||
VPackSlice s = result.get(KeyString);
|
||||
payload.add(KeyString, s);
|
||||
s = result.get(RevString);
|
||||
payload.add(RevString, s);
|
||||
};
|
||||
|
||||
VPackSlice ourResult = resultBuilder.slice();
|
||||
|
|
|
@ -842,12 +842,22 @@ class Transaction {
|
|||
|
||||
std::shared_ptr<TransactionContext> _transactionContext;
|
||||
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief makeNolockHeaders
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public:
|
||||
static thread_local std::unordered_set<std::string>* _makeNolockHeaders;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief constants for _id, _key, _rev
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static std::string const KeyString;
|
||||
static std::string const RevString;
|
||||
static std::string const IdString;
|
||||
static std::string const FromString;
|
||||
static std::string const ToString;
|
||||
};
|
||||
|
||||
class TransactionBuilderLeaser {
|
||||
|
|
|
@ -60,7 +60,7 @@ static OperationResult FetchDocumentById(arangodb::Transaction* trx,
|
|||
trx->addCollectionAtRuntime(col);
|
||||
builder.clear();
|
||||
builder.openObject();
|
||||
builder.add(VPackValue(TRI_VOC_ATTRIBUTE_KEY));
|
||||
builder.add(VPackValue(Transaction::KeyString));
|
||||
builder.add(VPackValue(id.substr(pos + 1)));
|
||||
builder.close();
|
||||
|
||||
|
@ -102,9 +102,9 @@ struct BasicExpander {
|
|||
for (auto const& mptr : _cursor) {
|
||||
VPackSlice edge(mptr->vpack());
|
||||
std::string edgeId = _trx->extractIdString(edge);
|
||||
std::string from = edge.get(TRI_VOC_ATTRIBUTE_FROM).copyString();
|
||||
std::string from = edge.get(Transaction::FromString).copyString();
|
||||
if (from == v) {
|
||||
std::string to = edge.get(TRI_VOC_ATTRIBUTE_TO).copyString();
|
||||
std::string to = edge.get(Transaction::ToString).copyString();
|
||||
if (to != v) {
|
||||
res_edges.emplace_back(std::move(edgeId));
|
||||
neighbors.emplace_back(std::move(to));
|
||||
|
@ -241,8 +241,8 @@ class MultiCollectionEdgeExpander {
|
|||
if (!_isAllowed(edge)) {
|
||||
continue;
|
||||
}
|
||||
std::string const from = edge.get(TRI_VOC_ATTRIBUTE_FROM).copyString();
|
||||
std::string const to = edge.get(TRI_VOC_ATTRIBUTE_TO).copyString();
|
||||
std::string const from = edge.get(Transaction::FromString).copyString();
|
||||
std::string const to = edge.get(Transaction::ToString).copyString();
|
||||
double currentWeight = edgeCollection->weightEdge(edge);
|
||||
if (from == source) {
|
||||
inserter(from, to, currentWeight, edge);
|
||||
|
@ -307,8 +307,8 @@ class SimpleEdgeExpander {
|
|||
}
|
||||
VPackSlice edges = opRes->slice();
|
||||
for (auto const& edge : VPackArrayIterator(edges)) {
|
||||
std::string const from = edge.get(TRI_VOC_ATTRIBUTE_FROM).copyString();
|
||||
std::string const to = edge.get(TRI_VOC_ATTRIBUTE_TO).copyString();
|
||||
std::string const from = edge.get(Transaction::FromString).copyString();
|
||||
std::string const to = edge.get(Transaction::ToString).copyString();
|
||||
double currentWeight = _edgeCollection->weightEdge(edge);
|
||||
if (from == source) {
|
||||
inserter(std::move(from), std::move(to), currentWeight, edge);
|
||||
|
@ -505,7 +505,7 @@ bool NeighborsOptions::matchesVertex(std::string const& id) const {
|
|||
std::string key = id.substr(pos + 1);
|
||||
VPackBuilder tmp;
|
||||
tmp.openObject();
|
||||
tmp.add(TRI_VOC_ATTRIBUTE_KEY, VPackValue(key));
|
||||
tmp.add(Transaction::KeyString, VPackValue(key));
|
||||
tmp.close();
|
||||
OperationOptions opOpts;
|
||||
OperationResult opRes = _trx->document(col, tmp.slice(), opOpts);
|
||||
|
@ -568,7 +568,7 @@ std::unique_ptr<ArangoDBPathFinder::Path> TRI_RunShortestPathSearch(
|
|||
|
||||
VPackBuilder tmp;
|
||||
tmp.openObject();
|
||||
tmp.add(TRI_VOC_ATTRIBUTE_KEY, VPackValue(key));
|
||||
tmp.add(Transaction::KeyString, VPackValue(key));
|
||||
tmp.close();
|
||||
OperationOptions opOpts;
|
||||
OperationResult opRes = opts.trx()->document(col, tmp.slice(), opOpts);
|
||||
|
@ -656,7 +656,7 @@ static void InboundNeighbors(std::vector<EdgeCollectionInfo*>& collectionInfos,
|
|||
VPackSlice edge(mptr->vpack());
|
||||
if (opts.matchesEdge(edge)) {
|
||||
VPackValueLength l;
|
||||
char const* v = edge.get(TRI_VOC_ATTRIBUTE_FROM).getString(l);
|
||||
char const* v = edge.get(Transaction::FromString).getString(l);
|
||||
if (visited.find(std::string(v, l)) != visited.end()) {
|
||||
// We have already visited this vertex
|
||||
continue;
|
||||
|
@ -709,7 +709,7 @@ static void OutboundNeighbors(std::vector<EdgeCollectionInfo*>& collectionInfos,
|
|||
VPackSlice edge(mptr->vpack());
|
||||
if (opts.matchesEdge(edge)) {
|
||||
VPackValueLength l;
|
||||
char const* v = edge.get(TRI_VOC_ATTRIBUTE_TO).getString(l);
|
||||
char const* v = edge.get(Transaction::ToString).getString(l);
|
||||
if (visited.find(std::string(v, l)) != visited.end()) {
|
||||
// We have already visited this vertex
|
||||
continue;
|
||||
|
@ -763,7 +763,7 @@ static void AnyNeighbors(std::vector<EdgeCollectionInfo*>& collectionInfos,
|
|||
VPackSlice edge(mptr->vpack());
|
||||
if (opts.matchesEdge(edge)) {
|
||||
VPackValueLength l;
|
||||
char const* v = edge.get(TRI_VOC_ATTRIBUTE_TO).getString(l);
|
||||
char const* v = edge.get(Transaction::ToString).getString(l);
|
||||
if (visited.find(std::string(v, l)) == visited.end()) {
|
||||
std::string tmp(v, l);
|
||||
if (depth >= opts.minDepth) {
|
||||
|
@ -777,7 +777,7 @@ static void AnyNeighbors(std::vector<EdgeCollectionInfo*>& collectionInfos,
|
|||
visited.emplace(std::move(tmp));
|
||||
continue;
|
||||
}
|
||||
v = edge.get(TRI_VOC_ATTRIBUTE_FROM).getString(l);
|
||||
v = edge.get(Transaction::FromString).getString(l);
|
||||
if (visited.find(std::string(v, l)) == visited.end()) {
|
||||
std::string tmp(v, l);
|
||||
if (depth >= opts.minDepth) {
|
||||
|
@ -963,9 +963,9 @@ void DepthFirstTraverser::_defInternalFunctions() {
|
|||
TRI_ASSERT(it != _edges.end());
|
||||
VPackSlice v(it->second->data());
|
||||
// NOTE: We assume that we only have valid edges.
|
||||
result = v.get(TRI_VOC_ATTRIBUTE_FROM).copyString();
|
||||
result = v.get(Transaction::FromString).copyString();
|
||||
if (result == vertex) {
|
||||
result = v.get(TRI_VOC_ATTRIBUTE_TO).copyString();
|
||||
result = v.get(Transaction::ToString).copyString();
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
|
|
@ -2200,13 +2200,13 @@ static void JS_InsertVocbaseCol(
|
|||
if (tmpId.empty()) {
|
||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_DOCUMENT_HANDLE_BAD);
|
||||
}
|
||||
builder.add(TRI_VOC_ATTRIBUTE_FROM, VPackValue(tmpId));
|
||||
builder.add(Transaction::FromString, VPackValue(tmpId));
|
||||
|
||||
tmpId = ExtractIdString(isolate, args[1]);
|
||||
if (tmpId.empty()) {
|
||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_ARANGO_DOCUMENT_HANDLE_BAD);
|
||||
}
|
||||
builder.add(TRI_VOC_ATTRIBUTE_TO, VPackValue(tmpId));
|
||||
builder.add(Transaction::ToString, VPackValue(tmpId));
|
||||
}
|
||||
|
||||
builder.close();
|
||||
|
|
|
@ -123,8 +123,8 @@ static void EdgesQuery(TRI_edge_direction_e direction,
|
|||
builder->add(VPackValue(TRI_ObjectToString(val)));
|
||||
} else if (val->IsObject()) {
|
||||
v8::Handle<v8::Object> obj = val->ToObject();
|
||||
if (obj->Has(TRI_V8_ASCII_STRING(TRI_VOC_ATTRIBUTE_ID))) {
|
||||
builder->add(VPackValue(TRI_ObjectToString(obj->Get(TRI_V8_ASCII_STRING(TRI_VOC_ATTRIBUTE_ID)))));
|
||||
if (obj->Has(TRI_V8_ASCII_STD_STRING(isolate, Transaction::IdString))) {
|
||||
builder->add(VPackValue(TRI_ObjectToString(obj->Get(TRI_V8_ASCII_STD_STRING(isolate, Transaction::IdString)))));
|
||||
} else {
|
||||
builder->add(VPackValue(""));
|
||||
}
|
||||
|
@ -372,10 +372,10 @@ static void JS_ChecksumCollection(
|
|||
trx.invokeOnAllElements(col->_name, [&hash, &withData, &withRevisions](TRI_doc_mptr_t const* mptr) {
|
||||
VPackSlice const slice(mptr->vpack());
|
||||
|
||||
uint64_t localHash = slice.get(TRI_VOC_ATTRIBUTE_KEY).hash();
|
||||
uint64_t localHash = slice.get(Transaction::KeyString).hash();
|
||||
|
||||
if (withRevisions) {
|
||||
localHash += slice.get(TRI_VOC_ATTRIBUTE_REV).hash();
|
||||
localHash += slice.get(Transaction::RevString).hash();
|
||||
}
|
||||
|
||||
if (withData) {
|
||||
|
|
|
@ -1710,7 +1710,7 @@ static v8::Handle<v8::Value> VertexIdToData(v8::Isolate* isolate,
|
|||
|
||||
VPackBuilder builder;
|
||||
builder.openObject();
|
||||
builder.add(TRI_VOC_ATTRIBUTE_KEY, VPackValue(parts[1]));
|
||||
builder.add(Transaction::KeyString, VPackValue(parts[1]));
|
||||
builder.close();
|
||||
|
||||
OperationResult opRes = trx->document(parts[0], builder.slice(), options);
|
||||
|
|
|
@ -784,9 +784,9 @@ static int OpenIteratorHandleDocumentMarker(TRI_df_marker_t const* marker,
|
|||
arangodb::Transaction* trx = state->_trx;
|
||||
|
||||
VPackSlice const slice(reinterpret_cast<char const*>(marker) + DatafileHelper::VPackOffset(TRI_DF_MARKER_VPACK_DOCUMENT));
|
||||
VPackSlice const keySlice = slice.get(TRI_VOC_ATTRIBUTE_KEY);
|
||||
VPackSlice const keySlice = slice.get(Transaction::KeyString);
|
||||
std::string const key(keySlice.copyString());
|
||||
TRI_voc_rid_t const rid = std::stoull(slice.get(TRI_VOC_ATTRIBUTE_REV).copyString());
|
||||
TRI_voc_rid_t const rid = std::stoull(slice.get(Transaction::RevString).copyString());
|
||||
|
||||
SetRevision(document, rid, false);
|
||||
document->_keyGenerator->track(key);
|
||||
|
@ -888,9 +888,9 @@ static int OpenIteratorHandleDeletionMarker(TRI_df_marker_t const* marker,
|
|||
arangodb::Transaction* trx = state->_trx;
|
||||
|
||||
VPackSlice const slice(reinterpret_cast<char const*>(marker) + DatafileHelper::VPackOffset(TRI_DF_MARKER_VPACK_REMOVE));
|
||||
VPackSlice const keySlice = slice.get(TRI_VOC_ATTRIBUTE_KEY);
|
||||
VPackSlice const keySlice = slice.get(Transaction::KeyString);
|
||||
std::string const key(keySlice.copyString());
|
||||
TRI_voc_rid_t const rid = std::stoull(slice.get(TRI_VOC_ATTRIBUTE_REV).copyString());
|
||||
TRI_voc_rid_t const rid = std::stoull(slice.get(Transaction::RevString).copyString());
|
||||
|
||||
document->setLastRevision(rid, false);
|
||||
document->_keyGenerator->track(key);
|
||||
|
@ -3290,7 +3290,7 @@ int TRI_document_collection_t::insert(Transaction* trx, VPackSlice const slice,
|
|||
|
||||
if (_info.type() == TRI_COL_TYPE_EDGE) {
|
||||
// _from:
|
||||
VPackSlice s = slice.get(TRI_VOC_ATTRIBUTE_FROM);
|
||||
VPackSlice s = slice.get(Transaction::FromString);
|
||||
if (!s.isString()) {
|
||||
return TRI_ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE;
|
||||
}
|
||||
|
@ -3301,7 +3301,7 @@ int TRI_document_collection_t::insert(Transaction* trx, VPackSlice const slice,
|
|||
return TRI_ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE;
|
||||
}
|
||||
// _to:
|
||||
s = slice.get(TRI_VOC_ATTRIBUTE_TO);
|
||||
s = slice.get(Transaction::ToString);
|
||||
if (!s.isString()) {
|
||||
return TRI_ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE;
|
||||
}
|
||||
|
@ -3326,7 +3326,7 @@ int TRI_document_collection_t::insert(Transaction* trx, VPackSlice const slice,
|
|||
newSlice = slice;
|
||||
// we can get away with the fast hash function here, as key values are
|
||||
// restricted to strings
|
||||
hash = slice.get(TRI_VOC_ATTRIBUTE_KEY).hash();
|
||||
hash = slice.get(Transaction::KeyString).hash();
|
||||
}
|
||||
|
||||
TRI_ASSERT(mptr != nullptr);
|
||||
|
@ -3445,7 +3445,7 @@ int TRI_document_collection_t::update(Transaction* trx,
|
|||
|
||||
// get the header pointer of the previous revision
|
||||
TRI_doc_mptr_t* oldHeader;
|
||||
VPackSlice key = newSlice.get(TRI_VOC_ATTRIBUTE_KEY);
|
||||
VPackSlice key = newSlice.get(Transaction::KeyString);
|
||||
if (key.isNone()) {
|
||||
return TRI_ERROR_ARANGO_DOCUMENT_HANDLE_BAD;
|
||||
}
|
||||
|
@ -3469,7 +3469,7 @@ int TRI_document_collection_t::update(Transaction* trx,
|
|||
|
||||
// Check old revision:
|
||||
if (!options.ignoreRevs) {
|
||||
VPackSlice expectedRevSlice = newSlice.get(TRI_VOC_ATTRIBUTE_REV);
|
||||
VPackSlice expectedRevSlice = newSlice.get(Transaction::RevString);
|
||||
int res = checkRevision(trx, expectedRevSlice, prevRev);
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
return res;
|
||||
|
@ -3563,11 +3563,11 @@ int TRI_document_collection_t::replace(Transaction* trx,
|
|||
prevRev = VPackSlice();
|
||||
|
||||
if (_info.type() == TRI_COL_TYPE_EDGE) {
|
||||
VPackSlice s = newSlice.get(TRI_VOC_ATTRIBUTE_FROM);
|
||||
VPackSlice s = newSlice.get(Transaction::FromString);
|
||||
if (!s.isString()) {
|
||||
return TRI_ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE;
|
||||
}
|
||||
s = newSlice.get(TRI_VOC_ATTRIBUTE_TO);
|
||||
s = newSlice.get(Transaction::ToString);
|
||||
if (!s.isString()) {
|
||||
return TRI_ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE;
|
||||
}
|
||||
|
@ -3599,7 +3599,7 @@ int TRI_document_collection_t::replace(Transaction* trx,
|
|||
|
||||
// get the header pointer of the previous revision
|
||||
TRI_doc_mptr_t* oldHeader;
|
||||
VPackSlice key = newSlice.get(TRI_VOC_ATTRIBUTE_KEY);
|
||||
VPackSlice key = newSlice.get(Transaction::KeyString);
|
||||
if (key.isNone()) {
|
||||
return TRI_ERROR_ARANGO_DOCUMENT_HANDLE_BAD;
|
||||
}
|
||||
|
@ -3623,7 +3623,7 @@ int TRI_document_collection_t::replace(Transaction* trx,
|
|||
|
||||
// Check old revision:
|
||||
if (!options.ignoreRevs) {
|
||||
VPackSlice expectedRevSlice = newSlice.get(TRI_VOC_ATTRIBUTE_REV);
|
||||
VPackSlice expectedRevSlice = newSlice.get(Transaction::RevString);
|
||||
int res = checkRevision(trx, expectedRevSlice, prevRev);
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
return res;
|
||||
|
@ -3762,7 +3762,7 @@ int TRI_document_collection_t::remove(arangodb::Transaction* trx,
|
|||
if (slice.isString()) {
|
||||
key = slice;
|
||||
} else {
|
||||
key = slice.get(TRI_VOC_ATTRIBUTE_KEY);
|
||||
key = slice.get(Transaction::KeyString);
|
||||
}
|
||||
TRI_ASSERT(!key.isNone());
|
||||
res = lookupDocument(trx, key, oldHeader);
|
||||
|
@ -3776,7 +3776,7 @@ int TRI_document_collection_t::remove(arangodb::Transaction* trx,
|
|||
|
||||
// Check old revision:
|
||||
if (!options.ignoreRevs && slice.isObject()) {
|
||||
VPackSlice expectedRevSlice = slice.get(TRI_VOC_ATTRIBUTE_REV);
|
||||
VPackSlice expectedRevSlice = slice.get(Transaction::RevString);
|
||||
int res = checkRevision(trx, expectedRevSlice, prevRev);
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
return res;
|
||||
|
@ -4128,7 +4128,7 @@ int TRI_document_collection_t::deletePrimaryIndex(
|
|||
|
||||
auto found = primaryIndex()->removeKey(
|
||||
trx,
|
||||
VPackSlice(header->vpack()).get(TRI_VOC_ATTRIBUTE_KEY)); // ONLY IN INDEX, PROTECTED by RUNTIME
|
||||
VPackSlice(header->vpack()).get(Transaction::KeyString));
|
||||
|
||||
if (found == nullptr) {
|
||||
return TRI_ERROR_ARANGO_DOCUMENT_NOT_FOUND;
|
||||
|
@ -4182,7 +4182,7 @@ int TRI_document_collection_t::newObjectForInsert(
|
|||
VPackObjectBuilder guard(&builder);
|
||||
|
||||
TRI_SanitizeObject(value, builder);
|
||||
uint8_t* p = builder.add(TRI_VOC_ATTRIBUTE_ID,
|
||||
uint8_t* p = builder.add(Transaction::IdString,
|
||||
VPackValuePair(9ULL, VPackValueType::Custom));
|
||||
*p++ = 0xf3; // custom type for _id
|
||||
if (ServerState::instance()->isDBServer()) {
|
||||
|
@ -4192,7 +4192,7 @@ int TRI_document_collection_t::newObjectForInsert(
|
|||
// local server
|
||||
DatafileHelper::StoreNumber<uint64_t>(p, _info.id(), sizeof(uint64_t));
|
||||
}
|
||||
VPackSlice s = value.get(TRI_VOC_ATTRIBUTE_KEY);
|
||||
VPackSlice s = value.get(Transaction::KeyString);
|
||||
TRI_voc_rid_t newRev = 0;
|
||||
std::string newRevSt;
|
||||
if (isRestore) {
|
||||
|
@ -4211,7 +4211,7 @@ int TRI_document_collection_t::newObjectForInsert(
|
|||
if (keyString.empty()) {
|
||||
return TRI_ERROR_ARANGO_OUT_OF_KEYS;
|
||||
}
|
||||
uint8_t* where = builder.add(TRI_VOC_ATTRIBUTE_KEY,
|
||||
uint8_t* where = builder.add(Transaction::KeyString,
|
||||
VPackValue(keyString));
|
||||
s = VPackSlice(where); // point to newly built value, the string
|
||||
} else if (!s.isString()) {
|
||||
|
@ -4222,12 +4222,12 @@ int TRI_document_collection_t::newObjectForInsert(
|
|||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
return res;
|
||||
}
|
||||
builder.add(TRI_VOC_ATTRIBUTE_KEY, s);
|
||||
builder.add(Transaction::KeyString, s);
|
||||
}
|
||||
// we can get away with the fast hash function here, as key values are
|
||||
// restricted to strings
|
||||
hash = s.hash();
|
||||
builder.add(TRI_VOC_ATTRIBUTE_REV, VPackValue(newRevSt));
|
||||
builder.add(Transaction::RevString, VPackValue(newRevSt));
|
||||
}
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
@ -4247,13 +4247,13 @@ void TRI_document_collection_t::newObjectForReplace(
|
|||
builder.openObject();
|
||||
|
||||
TRI_SanitizeObject(newValue, builder);
|
||||
VPackSlice s = oldValue.get(TRI_VOC_ATTRIBUTE_ID);
|
||||
VPackSlice s = oldValue.get(Transaction::IdString);
|
||||
TRI_ASSERT(!s.isNone());
|
||||
builder.add(TRI_VOC_ATTRIBUTE_ID, s);
|
||||
s = oldValue.get(TRI_VOC_ATTRIBUTE_KEY);
|
||||
builder.add(Transaction::IdString, s);
|
||||
s = oldValue.get(Transaction::KeyString);
|
||||
TRI_ASSERT(!s.isNone());
|
||||
builder.add(TRI_VOC_ATTRIBUTE_KEY, s);
|
||||
builder.add(TRI_VOC_ATTRIBUTE_REV, VPackValue(rev));
|
||||
builder.add(Transaction::KeyString, s);
|
||||
builder.add(Transaction::RevString, VPackValue(rev));
|
||||
|
||||
builder.close();
|
||||
}
|
||||
|
@ -4279,9 +4279,9 @@ void TRI_document_collection_t::mergeObjectsForUpdate(
|
|||
VPackObjectIterator it(newValue);
|
||||
while (it.valid()) {
|
||||
std::string key = it.key().copyString();
|
||||
if (key != TRI_VOC_ATTRIBUTE_KEY &&
|
||||
key != TRI_VOC_ATTRIBUTE_ID &&
|
||||
key != TRI_VOC_ATTRIBUTE_REV) {
|
||||
if (key != Transaction::KeyString &&
|
||||
key != Transaction::IdString &&
|
||||
key != Transaction::RevString) {
|
||||
newValues.emplace(it.key().copyString(), it.value());
|
||||
}
|
||||
it.next();
|
||||
|
@ -4292,7 +4292,7 @@ void TRI_document_collection_t::mergeObjectsForUpdate(
|
|||
VPackObjectIterator it(oldValue);
|
||||
while (it.valid()) {
|
||||
auto key = it.key().copyString();
|
||||
if (key == TRI_VOC_ATTRIBUTE_REV) {
|
||||
if (key == Transaction::RevString) {
|
||||
it.next();
|
||||
continue;
|
||||
}
|
||||
|
@ -4338,7 +4338,7 @@ void TRI_document_collection_t::mergeObjectsForUpdate(
|
|||
}
|
||||
|
||||
// Finally, add the new revision:
|
||||
b.add(TRI_VOC_ATTRIBUTE_REV, VPackValue(rev));
|
||||
b.add(Transaction::RevString, VPackValue(rev));
|
||||
|
||||
b.close();
|
||||
}
|
||||
|
@ -4355,12 +4355,12 @@ void TRI_document_collection_t::newObjectForRemove(
|
|||
|
||||
builder.openObject();
|
||||
if (oldValue.isString()) {
|
||||
builder.add(TRI_VOC_ATTRIBUTE_KEY, oldValue);
|
||||
builder.add(Transaction::KeyString, oldValue);
|
||||
} else {
|
||||
VPackSlice s = oldValue.get(TRI_VOC_ATTRIBUTE_KEY);
|
||||
VPackSlice s = oldValue.get(Transaction::KeyString);
|
||||
TRI_ASSERT(s.isString());
|
||||
builder.add(TRI_VOC_ATTRIBUTE_KEY, s);
|
||||
builder.add(Transaction::KeyString, s);
|
||||
}
|
||||
builder.add(TRI_VOC_ATTRIBUTE_REV, VPackValue(rev));
|
||||
builder.add(Transaction::RevString, VPackValue(rev));
|
||||
builder.close();
|
||||
}
|
||||
|
|
|
@ -76,11 +76,9 @@ static const uint32_t V8DataSlot = 0;
|
|||
v8::String::NewFromOneByte(isolate, (uint8_t const*)(name), \
|
||||
v8::String::kNormalString, (int)strlen(name))
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief shortcut for creating a v8 symbol for the specified string
|
||||
/// implicites isolate available.
|
||||
/// @param name local string constant to source
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#define TRI_V8_ASCII_STD_STRING(isolate, name) \
|
||||
v8::String::NewFromOneByte(isolate, (uint8_t const*)(name.c_str()), \
|
||||
v8::String::kNormalString, (int)name.size())
|
||||
|
||||
#define TRI_V8_ASCII_PAIR_STRING(name, length) \
|
||||
v8::String::NewFromOneByte(isolate, (uint8_t const*)(name), \
|
||||
|
|
Loading…
Reference in New Issue