mirror of https://gitee.com/bigwinds/arangodb
moved attribute names to defines
This commit is contained in:
parent
ebb121b44a
commit
d79d95a3a7
|
@ -346,14 +346,14 @@ TRI_aql_index_t* TRI_DetermineIndexAql (TRI_aql_context_t* const context,
|
||||||
|
|
||||||
if (idx->_type == TRI_IDX_TYPE_PRIMARY_INDEX) {
|
if (idx->_type == TRI_IDX_TYPE_PRIMARY_INDEX) {
|
||||||
// primary index key names must be treated differently. _id and _key are the same
|
// primary index key names must be treated differently. _id and _key are the same
|
||||||
if (! TRI_EqualString("_id", fieldName) && ! TRI_EqualString("_key", fieldName)) {
|
if (! TRI_EqualString("_id", fieldName) && ! TRI_EqualString(TRI_VOC_ATTRIBUTE_KEY, fieldName)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (idx->_type == TRI_IDX_TYPE_EDGE_INDEX) {
|
else if (idx->_type == TRI_IDX_TYPE_EDGE_INDEX) {
|
||||||
// edge index key names must be treated differently. _from and _to can be used independently
|
// edge index key names must be treated differently. _from and _to can be used independently
|
||||||
if (! TRI_EqualString("_from", fieldName) &&
|
if (! TRI_EqualString(TRI_VOC_ATTRIBUTE_FROM, fieldName) &&
|
||||||
! TRI_EqualString("_to", fieldName)) {
|
! TRI_EqualString(TRI_VOC_ATTRIBUTE_TO, fieldName)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,6 +238,7 @@ int ReplicationFetcher::applyMarker (TRI_transaction_collection_t* trxCollection
|
||||||
|
|
||||||
if (res == TRI_ERROR_ARANGO_DOCUMENT_NOT_FOUND) {
|
if (res == TRI_ERROR_ARANGO_DOCUMENT_NOT_FOUND) {
|
||||||
// insert
|
// insert
|
||||||
|
const TRI_voc_rid_t rid = StringUtils::uint64(JsonHelper::getStringValue(json, TRI_VOC_ATTRIBUTE_REV, ""));
|
||||||
|
|
||||||
if (type[7] == 'e') {
|
if (type[7] == 'e') {
|
||||||
// edge
|
// edge
|
||||||
|
@ -248,8 +249,9 @@ int ReplicationFetcher::applyMarker (TRI_transaction_collection_t* trxCollection
|
||||||
res = TRI_ERROR_NO_ERROR;
|
res = TRI_ERROR_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
string from = JsonHelper::getStringValue(json, "_from", "");
|
string from = JsonHelper::getStringValue(json, TRI_VOC_ATTRIBUTE_FROM, "");
|
||||||
string to = JsonHelper::getStringValue(json, "_to", "");
|
string to = JsonHelper::getStringValue(json, TRI_VOC_ATTRIBUTE_TO, "");
|
||||||
|
|
||||||
|
|
||||||
// parse _from
|
// parse _from
|
||||||
TRI_document_edge_t edge;
|
TRI_document_edge_t edge;
|
||||||
|
@ -263,7 +265,7 @@ int ReplicationFetcher::applyMarker (TRI_transaction_collection_t* trxCollection
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res == TRI_ERROR_NO_ERROR) {
|
if (res == TRI_ERROR_NO_ERROR) {
|
||||||
res = primary->insert(trxCollection, key, &mptr, TRI_DOC_MARKER_KEY_EDGE, shaped, &edge, false, false);
|
res = primary->insert(trxCollection, key, rid, &mptr, TRI_DOC_MARKER_KEY_EDGE, shaped, &edge, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -272,7 +274,7 @@ int ReplicationFetcher::applyMarker (TRI_transaction_collection_t* trxCollection
|
||||||
res = TRI_ERROR_ARANGO_COLLECTION_TYPE_INVALID;
|
res = TRI_ERROR_ARANGO_COLLECTION_TYPE_INVALID;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
res = primary->insert(trxCollection, key, &mptr, TRI_DOC_MARKER_KEY_DOCUMENT, shaped, 0, false, false);
|
res = primary->insert(trxCollection, key, rid, &mptr, TRI_DOC_MARKER_KEY_DOCUMENT, shaped, 0, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,7 +275,7 @@ bool RestImportHandler::createByDocumentsLines () {
|
||||||
TRI_doc_mptr_t document;
|
TRI_doc_mptr_t document;
|
||||||
|
|
||||||
if (isEdgeCollection) {
|
if (isEdgeCollection) {
|
||||||
const char* from = extractJsonStringValue(values, "_from");
|
const char* from = extractJsonStringValue(values, TRI_VOC_ATTRIBUTE_FROM);
|
||||||
|
|
||||||
if (from == 0) {
|
if (from == 0) {
|
||||||
LOGGER_WARNING("missing '_from' attribute at position " << i);
|
LOGGER_WARNING("missing '_from' attribute at position " << i);
|
||||||
|
@ -284,7 +284,7 @@ bool RestImportHandler::createByDocumentsLines () {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* to = extractJsonStringValue(values, "_to");
|
const char* to = extractJsonStringValue(values, TRI_VOC_ATTRIBUTE_TO);
|
||||||
if (to == 0) {
|
if (to == 0) {
|
||||||
LOGGER_WARNING("missing '_to' attribute at position " << i);
|
LOGGER_WARNING("missing '_to' attribute at position " << i);
|
||||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, values);
|
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, values);
|
||||||
|
@ -454,7 +454,7 @@ bool RestImportHandler::createByDocumentsList () {
|
||||||
TRI_doc_mptr_t document;
|
TRI_doc_mptr_t document;
|
||||||
|
|
||||||
if (isEdgeCollection) {
|
if (isEdgeCollection) {
|
||||||
const char* from = extractJsonStringValue(values, "_from");
|
const char* from = extractJsonStringValue(values, TRI_VOC_ATTRIBUTE_FROM);
|
||||||
|
|
||||||
if (from == 0) {
|
if (from == 0) {
|
||||||
LOGGER_WARNING("missing '_from' attribute at position " << (i + 1));
|
LOGGER_WARNING("missing '_from' attribute at position " << (i + 1));
|
||||||
|
@ -462,7 +462,7 @@ bool RestImportHandler::createByDocumentsList () {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* to = extractJsonStringValue(values, "_to");
|
const char* to = extractJsonStringValue(values, TRI_VOC_ATTRIBUTE_TO);
|
||||||
if (to == 0) {
|
if (to == 0) {
|
||||||
LOGGER_WARNING("missing '_to' attribute at position " << (i + 1));
|
LOGGER_WARNING("missing '_to' attribute at position " << (i + 1));
|
||||||
++numError;
|
++numError;
|
||||||
|
@ -696,7 +696,7 @@ bool RestImportHandler::createByKeyValueList () {
|
||||||
TRI_doc_mptr_t document;
|
TRI_doc_mptr_t document;
|
||||||
|
|
||||||
if (isEdgeCollection) {
|
if (isEdgeCollection) {
|
||||||
const char* from = extractJsonStringValue(json, "_from");
|
const char* from = extractJsonStringValue(json, TRI_VOC_ATTRIBUTE_FROM);
|
||||||
|
|
||||||
if (from == 0) {
|
if (from == 0) {
|
||||||
LOGGER_WARNING("missing '_from' attribute at line " << lineNumber);
|
LOGGER_WARNING("missing '_from' attribute at line " << lineNumber);
|
||||||
|
@ -705,7 +705,7 @@ bool RestImportHandler::createByKeyValueList () {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* to = extractJsonStringValue(json, "_to");
|
const char* to = extractJsonStringValue(json, TRI_VOC_ATTRIBUTE_TO);
|
||||||
if (to == 0) {
|
if (to == 0) {
|
||||||
LOGGER_WARNING("missing '_to' attribute at line " << lineNumber);
|
LOGGER_WARNING("missing '_to' attribute at line " << lineNumber);
|
||||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json);
|
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json);
|
||||||
|
|
|
@ -234,9 +234,9 @@ void RestVocbaseBaseHandler::generate20x (const HttpResponse::HttpResponseCode r
|
||||||
_response->body()
|
_response->body()
|
||||||
.appendText("{\"error\":false,\"_id\":\"")
|
.appendText("{\"error\":false,\"_id\":\"")
|
||||||
.appendText(handle)
|
.appendText(handle)
|
||||||
.appendText("\",\"_rev\":\"")
|
.appendText("\",\"" TRI_VOC_ATTRIBUTE_REV "\":\"")
|
||||||
.appendText(rev)
|
.appendText(rev)
|
||||||
.appendText("\",\"_key\":\"")
|
.appendText("\",\"" TRI_VOC_ATTRIBUTE_KEY "\":\"")
|
||||||
.appendText(key)
|
.appendText(key)
|
||||||
.appendText("\"}");
|
.appendText("\"}");
|
||||||
}
|
}
|
||||||
|
@ -292,9 +292,9 @@ void RestVocbaseBaseHandler::generatePreconditionFailed (const TRI_voc_cid_t cid
|
||||||
.appendText(",\"errorMessage\":\"precondition failed\"")
|
.appendText(",\"errorMessage\":\"precondition failed\"")
|
||||||
.appendText(",\"_id\":\"")
|
.appendText(",\"_id\":\"")
|
||||||
.appendText(DocumentHelper::assembleDocumentId(_resolver.getCollectionName(cid), key))
|
.appendText(DocumentHelper::assembleDocumentId(_resolver.getCollectionName(cid), key))
|
||||||
.appendText("\",\"_rev\":\"")
|
.appendText("\",\"" TRI_VOC_ATTRIBUTE_REV "\":\"")
|
||||||
.appendText(StringUtils::itoa(rid))
|
.appendText(StringUtils::itoa(rid))
|
||||||
.appendText("\",\"_key\":\"")
|
.appendText("\",\"" TRI_VOC_ATTRIBUTE_KEY "\":\"")
|
||||||
.appendText(key)
|
.appendText(key)
|
||||||
.appendText("\"}");
|
.appendText("\"}");
|
||||||
}
|
}
|
||||||
|
@ -341,13 +341,13 @@ void RestVocbaseBaseHandler::generateDocument (const TRI_voc_cid_t cid,
|
||||||
TRI_json_t* _rev = TRI_CreateString2CopyJson(TRI_UNKNOWN_MEM_ZONE, rid.c_str(), rid.size());
|
TRI_json_t* _rev = TRI_CreateString2CopyJson(TRI_UNKNOWN_MEM_ZONE, rid.c_str(), rid.size());
|
||||||
|
|
||||||
if (_rev) {
|
if (_rev) {
|
||||||
TRI_Insert2ArrayJson(TRI_UNKNOWN_MEM_ZONE, &augmented, "_rev", _rev);
|
TRI_Insert2ArrayJson(TRI_UNKNOWN_MEM_ZONE, &augmented, TRI_VOC_ATTRIBUTE_REV, _rev);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRI_json_t* _key = TRI_CreateString2CopyJson(TRI_UNKNOWN_MEM_ZONE, document->_key, strlen(document->_key));
|
TRI_json_t* _key = TRI_CreateString2CopyJson(TRI_UNKNOWN_MEM_ZONE, document->_key, strlen(document->_key));
|
||||||
|
|
||||||
if (_key) {
|
if (_key) {
|
||||||
TRI_Insert2ArrayJson(TRI_UNKNOWN_MEM_ZONE, &augmented, "_key", _key);
|
TRI_Insert2ArrayJson(TRI_UNKNOWN_MEM_ZONE, &augmented, TRI_VOC_ATTRIBUTE_KEY, _key);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRI_df_marker_type_t type = ((TRI_df_marker_t*) document->_data)->_type;
|
TRI_df_marker_type_t type = ((TRI_df_marker_t*) document->_data)->_type;
|
||||||
|
@ -357,8 +357,8 @@ void RestVocbaseBaseHandler::generateDocument (const TRI_voc_cid_t cid,
|
||||||
const string from = DocumentHelper::assembleDocumentId(_resolver.getCollectionName(marker->_fromCid), string((char*) marker + marker->_offsetFromKey));
|
const string from = DocumentHelper::assembleDocumentId(_resolver.getCollectionName(marker->_fromCid), string((char*) marker + marker->_offsetFromKey));
|
||||||
const string to = DocumentHelper::assembleDocumentId(_resolver.getCollectionName(marker->_toCid), string((char*) marker + marker->_offsetToKey));
|
const string to = DocumentHelper::assembleDocumentId(_resolver.getCollectionName(marker->_toCid), string((char*) marker + marker->_offsetToKey));
|
||||||
|
|
||||||
TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, &augmented, "_from", TRI_CreateString2CopyJson(TRI_UNKNOWN_MEM_ZONE, from.c_str(), from.size()));
|
TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, &augmented, TRI_VOC_ATTRIBUTE_FROM, TRI_CreateString2CopyJson(TRI_UNKNOWN_MEM_ZONE, from.c_str(), from.size()));
|
||||||
TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, &augmented, "_to", TRI_CreateString2CopyJson(TRI_UNKNOWN_MEM_ZONE, to.c_str(), to.size()));
|
TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, &augmented, TRI_VOC_ATTRIBUTE_TO, TRI_CreateString2CopyJson(TRI_UNKNOWN_MEM_ZONE, to.c_str(), to.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// add document identifier to buffer
|
// add document identifier to buffer
|
||||||
|
|
|
@ -136,7 +136,7 @@ int DocumentHelper::getKey (TRI_json_t const* json,
|
||||||
}
|
}
|
||||||
|
|
||||||
// check _key is there
|
// check _key is there
|
||||||
const TRI_json_t* k = TRI_LookupArrayJson((TRI_json_t*) json, "_key");
|
const TRI_json_t* k = TRI_LookupArrayJson((TRI_json_t*) json, TRI_VOC_ATTRIBUTE_KEY);
|
||||||
|
|
||||||
if (k == 0) {
|
if (k == 0) {
|
||||||
return TRI_ERROR_NO_ERROR;
|
return TRI_ERROR_NO_ERROR;
|
||||||
|
|
|
@ -175,7 +175,7 @@ namespace triagens {
|
||||||
return TRI_ERROR_TRANSACTION_INTERNAL;
|
return TRI_ERROR_TRANSACTION_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this->create(this->trxCollection(), TRI_DOC_MARKER_KEY_DOCUMENT, key, mptr, shaped, 0, forceSync);
|
return this->create(this->trxCollection(), key, 0, TRI_DOC_MARKER_KEY_DOCUMENT, mptr, shaped, 0, forceSync);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -191,7 +191,7 @@ namespace triagens {
|
||||||
return TRI_ERROR_TRANSACTION_INTERNAL;
|
return TRI_ERROR_TRANSACTION_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this->create(this->trxCollection(), TRI_DOC_MARKER_KEY_EDGE, key, mptr, shaped, data, forceSync);
|
return this->create(this->trxCollection(), key, 0, TRI_DOC_MARKER_KEY_EDGE, mptr, shaped, data, forceSync);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -719,8 +719,9 @@ namespace triagens {
|
||||||
}
|
}
|
||||||
|
|
||||||
res = create(trxCollection,
|
res = create(trxCollection,
|
||||||
markerType,
|
|
||||||
key,
|
key,
|
||||||
|
0,
|
||||||
|
markerType,
|
||||||
mptr,
|
mptr,
|
||||||
shaped,
|
shaped,
|
||||||
data,
|
data,
|
||||||
|
@ -736,8 +737,9 @@ namespace triagens {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
inline int create (TRI_transaction_collection_t* trxCollection,
|
inline int create (TRI_transaction_collection_t* trxCollection,
|
||||||
const TRI_df_marker_type_e markerType,
|
|
||||||
const TRI_voc_key_t key,
|
const TRI_voc_key_t key,
|
||||||
|
TRI_voc_rid_t rid,
|
||||||
|
const TRI_df_marker_type_e markerType,
|
||||||
TRI_doc_mptr_t* mptr,
|
TRI_doc_mptr_t* mptr,
|
||||||
TRI_shaped_json_t const* shaped,
|
TRI_shaped_json_t const* shaped,
|
||||||
void const* data,
|
void const* data,
|
||||||
|
@ -747,6 +749,7 @@ namespace triagens {
|
||||||
|
|
||||||
int res = primary->insert(trxCollection,
|
int res = primary->insert(trxCollection,
|
||||||
key,
|
key,
|
||||||
|
rid,
|
||||||
mptr,
|
mptr,
|
||||||
markerType,
|
markerType,
|
||||||
shaped,
|
shaped,
|
||||||
|
|
|
@ -7479,7 +7479,7 @@ static v8::Handle<v8::Integer> PropertyQueryShapedJson (v8::Local<v8::String> na
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key[0] == '_') {
|
if (key[0] == '_') {
|
||||||
if (key == "_id" || key == "_rev" || key == "_key") {
|
if (key == "_id" || key == TRI_VOC_ATTRIBUTE_REV || key == TRI_VOC_ATTRIBUTE_KEY) {
|
||||||
return scope.Close(v8::Handle<v8::Integer>(v8::Integer::New(v8::ReadOnly)));
|
return scope.Close(v8::Handle<v8::Integer>(v8::Integer::New(v8::ReadOnly)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1227,6 +1227,7 @@ int TRI_WriteElementDatafile (TRI_datafile_t* datafile,
|
||||||
if (datafile->_tickMin == 0) {
|
if (datafile->_tickMin == 0) {
|
||||||
datafile->_tickMin = tick;
|
datafile->_tickMin = tick;
|
||||||
}
|
}
|
||||||
|
|
||||||
datafile->_tickMax = tick;
|
datafile->_tickMax = tick;
|
||||||
|
|
||||||
assert(markerSize > 0);
|
assert(markerSize > 0);
|
||||||
|
|
|
@ -396,6 +396,7 @@ static int CloneDocumentMarker (TRI_voc_tid_t tid,
|
||||||
|
|
||||||
static int CreateDocumentMarker (TRI_primary_collection_t* primary,
|
static int CreateDocumentMarker (TRI_primary_collection_t* primary,
|
||||||
TRI_voc_tid_t tid,
|
TRI_voc_tid_t tid,
|
||||||
|
TRI_voc_tick_t tick,
|
||||||
TRI_doc_document_key_marker_t** result,
|
TRI_doc_document_key_marker_t** result,
|
||||||
TRI_voc_size_t* totalSize,
|
TRI_voc_size_t* totalSize,
|
||||||
char** keyBody,
|
char** keyBody,
|
||||||
|
@ -408,7 +409,6 @@ static int CreateDocumentMarker (TRI_primary_collection_t* primary,
|
||||||
char* position;
|
char* position;
|
||||||
char keyBuffer[TRI_VOC_KEY_MAX_LENGTH + 1];
|
char keyBuffer[TRI_VOC_KEY_MAX_LENGTH + 1];
|
||||||
TRI_voc_size_t keyBodySize;
|
TRI_voc_size_t keyBodySize;
|
||||||
TRI_voc_tick_t tick;
|
|
||||||
size_t markerSize;
|
size_t markerSize;
|
||||||
size_t keySize;
|
size_t keySize;
|
||||||
size_t fromSize;
|
size_t fromSize;
|
||||||
|
@ -416,7 +416,10 @@ static int CreateDocumentMarker (TRI_primary_collection_t* primary,
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
*result = NULL;
|
*result = NULL;
|
||||||
|
|
||||||
|
if (tick == 0) {
|
||||||
tick = TRI_NewTickVocBase();
|
tick = TRI_NewTickVocBase();
|
||||||
|
}
|
||||||
|
|
||||||
// generate the key
|
// generate the key
|
||||||
keyGenerator = (TRI_key_generator_t*) primary->_keyGenerator;
|
keyGenerator = (TRI_key_generator_t*) primary->_keyGenerator;
|
||||||
|
@ -1477,6 +1480,7 @@ static int NotifyTransaction (TRI_primary_collection_t* primary,
|
||||||
|
|
||||||
static int InsertShapedJson (TRI_transaction_collection_t* trxCollection,
|
static int InsertShapedJson (TRI_transaction_collection_t* trxCollection,
|
||||||
const TRI_voc_key_t key,
|
const TRI_voc_key_t key,
|
||||||
|
TRI_voc_rid_t rid,
|
||||||
TRI_doc_mptr_t* mptr,
|
TRI_doc_mptr_t* mptr,
|
||||||
TRI_df_marker_type_e markerType,
|
TRI_df_marker_type_e markerType,
|
||||||
TRI_shaped_json_t const* shaped,
|
TRI_shaped_json_t const* shaped,
|
||||||
|
@ -1503,6 +1507,7 @@ static int InsertShapedJson (TRI_transaction_collection_t* trxCollection,
|
||||||
|
|
||||||
res = CreateDocumentMarker(primary,
|
res = CreateDocumentMarker(primary,
|
||||||
TRI_GetMarkerIdTransaction(trxCollection->_transaction),
|
TRI_GetMarkerIdTransaction(trxCollection->_transaction),
|
||||||
|
(TRI_voc_tick_t) rid,
|
||||||
&marker,
|
&marker,
|
||||||
&totalSize,
|
&totalSize,
|
||||||
&keyBody,
|
&keyBody,
|
||||||
|
|
|
@ -746,8 +746,8 @@ static TRI_json_t* JsonEdge (TRI_index_t* idx, TRI_primary_collection_t const* p
|
||||||
json = TRI_JsonIndex(TRI_CORE_MEM_ZONE, idx);
|
json = TRI_JsonIndex(TRI_CORE_MEM_ZONE, idx);
|
||||||
|
|
||||||
fields = TRI_CreateListJson(TRI_CORE_MEM_ZONE);
|
fields = TRI_CreateListJson(TRI_CORE_MEM_ZONE);
|
||||||
TRI_PushBack3ListJson(TRI_CORE_MEM_ZONE, fields, TRI_CreateStringCopyJson(TRI_CORE_MEM_ZONE, "_from"));
|
TRI_PushBack3ListJson(TRI_CORE_MEM_ZONE, fields, TRI_CreateStringCopyJson(TRI_CORE_MEM_ZONE, TRI_VOC_ATTRIBUTE_FROM));
|
||||||
TRI_PushBack3ListJson(TRI_CORE_MEM_ZONE, fields, TRI_CreateStringCopyJson(TRI_CORE_MEM_ZONE, "_to"));
|
TRI_PushBack3ListJson(TRI_CORE_MEM_ZONE, fields, TRI_CreateStringCopyJson(TRI_CORE_MEM_ZONE, TRI_VOC_ATTRIBUTE_TO));
|
||||||
TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "fields", fields);
|
TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, "fields", fields);
|
||||||
|
|
||||||
return json;
|
return json;
|
||||||
|
@ -800,7 +800,7 @@ TRI_index_t* TRI_CreateEdgeIndex (struct TRI_primary_collection_s* primary) {
|
||||||
idx = &edgeIndex->base;
|
idx = &edgeIndex->base;
|
||||||
|
|
||||||
TRI_InitVectorString(&idx->_fields, TRI_CORE_MEM_ZONE);
|
TRI_InitVectorString(&idx->_fields, TRI_CORE_MEM_ZONE);
|
||||||
id = TRI_DuplicateStringZ(TRI_CORE_MEM_ZONE, "_from");
|
id = TRI_DuplicateStringZ(TRI_CORE_MEM_ZONE, TRI_VOC_ATTRIBUTE_FROM);
|
||||||
TRI_PushBackVectorString(&idx->_fields, id);
|
TRI_PushBackVectorString(&idx->_fields, id);
|
||||||
|
|
||||||
idx->typeName = TypeNameEdge;
|
idx->typeName = TypeNameEdge;
|
||||||
|
|
|
@ -317,7 +317,7 @@ typedef struct TRI_primary_collection_s {
|
||||||
#endif
|
#endif
|
||||||
int (*notifyTransaction) (struct TRI_primary_collection_s*, TRI_transaction_status_e);
|
int (*notifyTransaction) (struct TRI_primary_collection_s*, TRI_transaction_status_e);
|
||||||
|
|
||||||
int (*insert) (struct TRI_transaction_collection_s*, const TRI_voc_key_t, TRI_doc_mptr_t*, TRI_df_marker_type_e, TRI_shaped_json_t const*, void const*, const bool, const bool);
|
int (*insert) (struct TRI_transaction_collection_s*, const TRI_voc_key_t, TRI_voc_rid_t, TRI_doc_mptr_t*, TRI_df_marker_type_e, TRI_shaped_json_t const*, void const*, const bool, const bool);
|
||||||
|
|
||||||
int (*read) (struct TRI_transaction_collection_s*, const TRI_voc_key_t, TRI_doc_mptr_t*, const bool);
|
int (*read) (struct TRI_transaction_collection_s*, const TRI_voc_key_t, TRI_doc_mptr_t*, const bool);
|
||||||
|
|
||||||
|
|
|
@ -365,6 +365,7 @@ static int LogEvent (TRI_replication_logger_t* logger,
|
||||||
|
|
||||||
res = primary->insert(logger->_trxCollection,
|
res = primary->insert(logger->_trxCollection,
|
||||||
NULL,
|
NULL,
|
||||||
|
0,
|
||||||
&mptr,
|
&mptr,
|
||||||
TRI_DOC_MARKER_KEY_DOCUMENT,
|
TRI_DOC_MARKER_KEY_DOCUMENT,
|
||||||
shaped,
|
shaped,
|
||||||
|
@ -631,9 +632,9 @@ static bool StringifyDocumentOperation (TRI_string_buffer_t* buffer,
|
||||||
APPEND_STRING(buffer, "\",\"doc\":{");
|
APPEND_STRING(buffer, "\",\"doc\":{");
|
||||||
|
|
||||||
// common document meta-data
|
// common document meta-data
|
||||||
APPEND_STRING(buffer, "\"_key\":\"");
|
APPEND_STRING(buffer, "\"" TRI_VOC_ATTRIBUTE_KEY "\":\"");
|
||||||
APPEND_STRING(buffer, key);
|
APPEND_STRING(buffer, key);
|
||||||
APPEND_STRING(buffer, "\",\"_rev\":\"");
|
APPEND_STRING(buffer, "\",\"" TRI_VOC_ATTRIBUTE_REV "\":\"");
|
||||||
APPEND_UINT64(buffer, (uint64_t) rid);
|
APPEND_UINT64(buffer, (uint64_t) rid);
|
||||||
APPEND_CHAR(buffer, '"');
|
APPEND_CHAR(buffer, '"');
|
||||||
|
|
||||||
|
@ -642,11 +643,11 @@ static bool StringifyDocumentOperation (TRI_string_buffer_t* buffer,
|
||||||
TRI_voc_key_t fromKey = ((char*) e) + e->_offsetFromKey;
|
TRI_voc_key_t fromKey = ((char*) e) + e->_offsetFromKey;
|
||||||
TRI_voc_key_t toKey = ((char*) e) + e->_offsetToKey;
|
TRI_voc_key_t toKey = ((char*) e) + e->_offsetToKey;
|
||||||
|
|
||||||
APPEND_STRING(buffer, ",\"_from\":\"");
|
APPEND_STRING(buffer, ",\"" TRI_VOC_ATTRIBUTE_FROM "\":\"");
|
||||||
APPEND_UINT64(buffer, (uint64_t) e->_fromCid);
|
APPEND_UINT64(buffer, (uint64_t) e->_fromCid);
|
||||||
APPEND_CHAR(buffer, '/');
|
APPEND_CHAR(buffer, '/');
|
||||||
APPEND_STRING(buffer, fromKey);
|
APPEND_STRING(buffer, fromKey);
|
||||||
APPEND_STRING(buffer, "\",\"_to\":\"");
|
APPEND_STRING(buffer, "\",\"" TRI_VOC_ATTRIBUTE_TO "\":\"");
|
||||||
APPEND_UINT64(buffer, (uint64_t) e->_toCid);
|
APPEND_UINT64(buffer, (uint64_t) e->_toCid);
|
||||||
APPEND_CHAR(buffer, '/');
|
APPEND_CHAR(buffer, '/');
|
||||||
APPEND_STRING(buffer, toKey);
|
APPEND_STRING(buffer, toKey);
|
||||||
|
@ -767,9 +768,9 @@ static bool StringifyMarkerReplication (TRI_string_buffer_t* buffer,
|
||||||
APPEND_STRING(buffer, "\",\"doc\":{");
|
APPEND_STRING(buffer, "\",\"doc\":{");
|
||||||
|
|
||||||
// common document meta-data
|
// common document meta-data
|
||||||
APPEND_STRING(buffer, "\"_key\":\"");
|
APPEND_STRING(buffer, "\"" TRI_VOC_ATTRIBUTE_KEY "\":\"");
|
||||||
APPEND_STRING(buffer, key);
|
APPEND_STRING(buffer, key);
|
||||||
APPEND_STRING(buffer, "\",\"_rev\":\"");
|
APPEND_STRING(buffer, "\",\"" TRI_VOC_ATTRIBUTE_REV "\":\"");
|
||||||
APPEND_UINT64(buffer, (uint64_t) rid);
|
APPEND_UINT64(buffer, (uint64_t) rid);
|
||||||
APPEND_CHAR(buffer, '"');
|
APPEND_CHAR(buffer, '"');
|
||||||
|
|
||||||
|
@ -778,11 +779,11 @@ static bool StringifyMarkerReplication (TRI_string_buffer_t* buffer,
|
||||||
TRI_voc_key_t fromKey = ((char*) e) + e->_offsetFromKey;
|
TRI_voc_key_t fromKey = ((char*) e) + e->_offsetFromKey;
|
||||||
TRI_voc_key_t toKey = ((char*) e) + e->_offsetToKey;
|
TRI_voc_key_t toKey = ((char*) e) + e->_offsetToKey;
|
||||||
|
|
||||||
APPEND_STRING(buffer, ",\"_from\":\"");
|
APPEND_STRING(buffer, ",\"" TRI_VOC_ATTRIBUTE_FROM "\":\"");
|
||||||
APPEND_UINT64(buffer, (uint64_t) e->_fromCid);
|
APPEND_UINT64(buffer, (uint64_t) e->_fromCid);
|
||||||
APPEND_CHAR(buffer, '/');
|
APPEND_CHAR(buffer, '/');
|
||||||
APPEND_STRING(buffer, fromKey);
|
APPEND_STRING(buffer, fromKey);
|
||||||
APPEND_STRING(buffer, "\",\"_to\":\"");
|
APPEND_STRING(buffer, "\",\"" TRI_VOC_ATTRIBUTE_TO "\":\"");
|
||||||
APPEND_UINT64(buffer, (uint64_t) e->_toCid);
|
APPEND_UINT64(buffer, (uint64_t) e->_toCid);
|
||||||
APPEND_CHAR(buffer, '/');
|
APPEND_CHAR(buffer, '/');
|
||||||
APPEND_STRING(buffer, toKey);
|
APPEND_STRING(buffer, toKey);
|
||||||
|
|
|
@ -725,7 +725,16 @@ static int InsertTrxCallback (TRI_transaction_collection_t* trxCollection,
|
||||||
return TRI_ERROR_OUT_OF_MEMORY;
|
return TRI_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = primary->insert(trxCollection, coordinator->_key, &coordinator->_mptr, TRI_DOC_MARKER_KEY_DOCUMENT, shaped, NULL, false, false);
|
res = primary->insert(trxCollection,
|
||||||
|
coordinator->_key,
|
||||||
|
0,
|
||||||
|
&coordinator->_mptr,
|
||||||
|
TRI_DOC_MARKER_KEY_DOCUMENT,
|
||||||
|
shaped,
|
||||||
|
NULL,
|
||||||
|
false,
|
||||||
|
false);
|
||||||
|
|
||||||
TRI_FreeShapedJson(primary->_shaper, shaped);
|
TRI_FreeShapedJson(primary->_shaper, shaped);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -189,6 +189,30 @@ struct TRI_transaction_context_s;
|
||||||
|
|
||||||
extern size_t PageSize;
|
extern size_t PageSize;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief name of the _from attribute
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define TRI_VOC_ATTRIBUTE_FROM "_from"
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief name of the _to attribute
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define TRI_VOC_ATTRIBUTE_TO "_to"
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief name of the _key attribute
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define TRI_VOC_ATTRIBUTE_KEY "_key"
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief name of the _rev attribute
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define TRI_VOC_ATTRIBUTE_REV "_rev"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief name of the system database
|
/// @brief name of the system database
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue