1
0
Fork 0

removed TRI_voc_did_t, removed some deprecated typedefs

This commit is contained in:
Jan Steemann 2012-10-29 15:45:52 +01:00
parent 21735bb267
commit b9008cbdd5
6 changed files with 51 additions and 138 deletions

View File

@ -439,7 +439,6 @@ bool RestDocumentHandler::readSingleDocument (bool generateBody) {
TRI_voc_cid_t cid = ca.cid(); TRI_voc_cid_t cid = ca.cid();
TRI_shaper_t* shaper = ca.shaper(); TRI_shaper_t* shaper = ca.shaper();
//TRI_voc_did_t id = StringUtils::uint64(did);
// ............................................................................. // .............................................................................
// inside read transaction // inside read transaction
@ -983,7 +982,6 @@ bool RestDocumentHandler::deleteDocument () {
string key = suffix[1]; string key = suffix[1];
// extract document identifier // extract document identifier
//TRI_voc_did_t did = StringUtils::uint64(didStr);
// extract the revision // extract the revision
TRI_voc_rid_t revision = extractRevision("if-match", "rev"); TRI_voc_rid_t revision = extractRevision("if-match", "rev");

View File

@ -58,7 +58,6 @@ v8::Handle<v8::Value> TRI_ObjectReference (TRI_voc_cid_t cid, TRI_voc_key_t key)
TRI_InitStringBuffer(&buffer, TRI_CORE_MEM_ZONE); TRI_InitStringBuffer(&buffer, TRI_CORE_MEM_ZONE);
TRI_AppendUInt64StringBuffer(&buffer, cid); TRI_AppendUInt64StringBuffer(&buffer, cid);
TRI_AppendCharStringBuffer(&buffer, TRI_DOCUMENT_HANDLE_SEPARATOR_CHR); TRI_AppendCharStringBuffer(&buffer, TRI_DOCUMENT_HANDLE_SEPARATOR_CHR);
//TRI_AppendUInt64StringBuffer(&buffer, did);
TRI_AppendStringStringBuffer(&buffer, (char*) key); TRI_AppendStringStringBuffer(&buffer, (char*) key);
v8::Handle<v8::String> ref = v8::String::New(buffer._buffer); v8::Handle<v8::String> ref = v8::String::New(buffer._buffer);
@ -68,42 +67,6 @@ v8::Handle<v8::Value> TRI_ObjectReference (TRI_voc_cid_t cid, TRI_voc_key_t key)
return scope.Close(ref); return scope.Close(ref);
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief extratcs identifiers from a object reference
////////////////////////////////////////////////////////////////////////////////
bool TRI_IdentifiersObjectReference (v8::Handle<v8::Value> value, TRI_voc_cid_t& cid, TRI_voc_did_t& did) {
bool error;
cid = 0;
did = 0;
if (value->IsNumber() || value->IsNumberObject()) {
did = (TRI_voc_did_t) TRI_ObjectToDouble(value, error);
return ! error;
}
string v = TRI_ObjectToString(value);
vector<string> doc = StringUtils::split(v, TRI_DOCUMENT_HANDLE_SEPARATOR_STR);
switch (doc.size()) {
case 1:
did = StringUtils::uint64(doc[1]);
return did != 0;
case 2:
cid = StringUtils::uint64(doc[0]);
did = StringUtils::uint64(doc[1]);
return cid != 0 && did != 0;
default:
return false;
}
return false;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @} /// @}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -52,12 +52,6 @@
v8::Handle<v8::Value> TRI_ObjectReference (TRI_voc_cid_t, TRI_voc_key_t); v8::Handle<v8::Value> TRI_ObjectReference (TRI_voc_cid_t, TRI_voc_key_t);
////////////////////////////////////////////////////////////////////////////////
/// @brief extratcs identifiers from a object reference
////////////////////////////////////////////////////////////////////////////////
bool TRI_IdentifiersObjectReference (v8::Handle<v8::Value>, TRI_voc_cid_t&, TRI_voc_did_t&);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @} /// @}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -260,33 +260,6 @@ static bool IsDocumentHandle (v8::Handle<v8::Value> arg, TRI_voc_cid_t& cid, TRI
TRI_v8_global_t* v8g; TRI_v8_global_t* v8g;
v8g = (TRI_v8_global_t*) v8::Isolate::GetCurrent()->GetData(); v8g = (TRI_v8_global_t*) v8::Isolate::GetCurrent()->GetData();
/*
if (arg->IsNumber()) {
did = (TRI_voc_did_t) arg->ToNumber()->Value();
return true;
}
if (! arg->IsString()) {
return false;
}
TRI_Utf8ValueNFC str(TRI_UNKNOWN_MEM_ZONE, arg);
char const* s = *str;
if (s == 0) {
return false;
}
regmatch_t matches[3];
if (regexec(&v8g->DocumentIdRegex, s, sizeof(matches) / sizeof(matches[0]), matches, 0) == 0) {
cid = TRI_UInt64String2(s + matches[1].rm_so, matches[1].rm_eo - matches[1].rm_so);
did = TRI_UInt64String2(s + matches[2].rm_so, matches[2].rm_eo - matches[2].rm_so);
return true;
}
return false;
*/
if (! arg->IsString()) { if (! arg->IsString()) {
return false; return false;
@ -304,7 +277,6 @@ static bool IsDocumentHandle (v8::Handle<v8::Value> arg, TRI_voc_cid_t& cid, TRI
// "cid/key" // "cid/key"
if (regexec(&v8g->DocumentIdRegex, s, sizeof(matches) / sizeof(matches[0]), matches, 0) == 0) { if (regexec(&v8g->DocumentIdRegex, s, sizeof(matches) / sizeof(matches[0]), matches, 0) == 0) {
cid = TRI_UInt64String2(s + matches[1].rm_so, matches[1].rm_eo - matches[1].rm_so); cid = TRI_UInt64String2(s + matches[1].rm_so, matches[1].rm_eo - matches[1].rm_so);
//did = TRI_UInt64String2(s + matches[2].rm_so, matches[2].rm_eo - matches[2].rm_so);
key = TRI_DuplicateString2Z(TRI_CORE_MEM_ZONE, s + matches[2].rm_so, matches[2].rm_eo - matches[2].rm_so); key = TRI_DuplicateString2Z(TRI_CORE_MEM_ZONE, s + matches[2].rm_so, matches[2].rm_eo - matches[2].rm_so);
return true; return true;
} }
@ -2598,6 +2570,41 @@ static v8::Handle<v8::Value> JS_ParseAhuacatl (v8::Arguments const& argv) {
static v8::Handle<v8::Value> JS_UpgradeVocbaseCol (v8::Arguments const& argv) { static v8::Handle<v8::Value> JS_UpgradeVocbaseCol (v8::Arguments const& argv) {
v8::HandleScope scope; v8::HandleScope scope;
// some typedefs for deprecated markers, only used inside this function
typedef uint64_t voc_did_t;
typedef struct {
TRI_df_marker_t base;
voc_did_t _did; // this is the tick for a create, but not an update
TRI_voc_rid_t _rid; // this is the tick for an create and update
TRI_voc_eid_t _sid;
TRI_shape_sid_t _shape;
}
doc_document_marker_t_deprecated;
typedef struct {
doc_document_marker_t_deprecated base;
TRI_voc_cid_t _toCid;
voc_did_t _toDid;
TRI_voc_cid_t _fromCid;
voc_did_t _fromDid;
}
doc_edge_marker_t_deprecated;
typedef struct {
TRI_df_marker_t base;
voc_did_t _did; // this is the tick for a create, but not an update
TRI_voc_rid_t _rid; // this is the tick for an create and update
TRI_voc_eid_t _sid;
}
doc_deletion_marker_t_deprecated;
if (argv.Length() != 0) { if (argv.Length() != 0) {
return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_ERROR_ILLEGAL_OPTION, "usage: upgrade()"))); return scope.Close(v8::ThrowException(TRI_CreateErrorObject(TRI_ERROR_ILLEGAL_OPTION, "usage: upgrade()")));
} }
@ -2731,13 +2738,13 @@ static v8::Handle<v8::Value> JS_UpgradeVocbaseCol (v8::Arguments const& argv) {
switch (marker._type) { switch (marker._type) {
case TRI_DOC_MARKER_DOCUMENT: { case TRI_DOC_MARKER_DOCUMENT: {
TRI_doc_document_marker_t_deprecated* oldMarker = (TRI_doc_document_marker_t_deprecated*) &payload; doc_document_marker_t_deprecated* oldMarker = (doc_document_marker_t_deprecated*) &payload;
TRI_doc_document_key_marker_t newMarker; TRI_doc_document_key_marker_t newMarker;
TRI_voc_size_t newMarkerSize = sizeof(TRI_doc_document_key_marker_t); TRI_voc_size_t newMarkerSize = sizeof(TRI_doc_document_key_marker_t);
char* body = ((char*) oldMarker) + sizeof(TRI_doc_document_marker_t_deprecated); char* body = ((char*) oldMarker) + sizeof(doc_document_marker_t_deprecated);
TRI_voc_size_t bodySize = oldMarker->base._size - sizeof(TRI_doc_document_marker_t_deprecated); TRI_voc_size_t bodySize = oldMarker->base._size - sizeof(doc_document_marker_t_deprecated);
TRI_voc_size_t bodySizePadded = paddedSize - sizeof(TRI_doc_document_marker_t_deprecated); TRI_voc_size_t bodySizePadded = paddedSize - sizeof(doc_document_marker_t_deprecated);
char* keyBody = 0; char* keyBody = 0;
TRI_voc_size_t keyBodySize = 0; TRI_voc_size_t keyBodySize = 0;
@ -2777,13 +2784,13 @@ static v8::Handle<v8::Value> JS_UpgradeVocbaseCol (v8::Arguments const& argv) {
} }
case TRI_DOC_MARKER_EDGE: { case TRI_DOC_MARKER_EDGE: {
TRI_doc_edge_marker_t_deprecated* oldMarker = (TRI_doc_edge_marker_t_deprecated*) &payload; doc_edge_marker_t_deprecated* oldMarker = (doc_edge_marker_t_deprecated*) &payload;
TRI_doc_edge_key_marker_t newMarker; TRI_doc_edge_key_marker_t newMarker;
TRI_voc_size_t newMarkerSize = sizeof(TRI_doc_edge_key_marker_t); TRI_voc_size_t newMarkerSize = sizeof(TRI_doc_edge_key_marker_t);
char* body = ((char*) oldMarker) + sizeof(TRI_doc_edge_marker_t_deprecated); char* body = ((char*) oldMarker) + sizeof(doc_edge_marker_t_deprecated);
TRI_voc_size_t bodySize = oldMarker->base.base._size - sizeof(TRI_doc_edge_marker_t_deprecated); TRI_voc_size_t bodySize = oldMarker->base.base._size - sizeof(doc_edge_marker_t_deprecated);
TRI_voc_size_t bodySizePadded = paddedSize - sizeof(TRI_doc_edge_marker_t_deprecated); TRI_voc_size_t bodySizePadded = paddedSize - sizeof(doc_edge_marker_t_deprecated);
char* keyBody = 0; char* keyBody = 0;
TRI_voc_size_t keyBodySize = 0; TRI_voc_size_t keyBodySize = 0;
@ -2844,7 +2851,7 @@ static v8::Handle<v8::Value> JS_UpgradeVocbaseCol (v8::Arguments const& argv) {
} }
case TRI_DOC_MARKER_DELETION: { case TRI_DOC_MARKER_DELETION: {
TRI_doc_deletion_marker_t_deprecated* oldMarker = (TRI_doc_deletion_marker_t_deprecated*) &payload; doc_deletion_marker_t_deprecated* oldMarker = (doc_deletion_marker_t_deprecated*) &payload;
TRI_doc_deletion_key_marker_t newMarker; TRI_doc_deletion_key_marker_t newMarker;
TRI_voc_size_t newMarkerSize = sizeof(TRI_doc_deletion_key_marker_t); TRI_voc_size_t newMarkerSize = sizeof(TRI_doc_deletion_key_marker_t);

View File

@ -223,12 +223,12 @@ TRI_doc_collection_info_t;
/// ///
/// As before, but instead of a shaped json a json object must be given. /// As before, but instead of a shaped json a json object must be given.
/// ///
/// @FUN{TRI_voc_did_t createLock (TRI_primary_collection_t*, TRI_df_marker_type_e, TRI_shaped_json_t const*)} /// @FUN{TRI_voc_key_t createLock (TRI_primary_collection_t*, TRI_df_marker_type_e, TRI_shaped_json_t const*)}
////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////
/// ///
/// As before, but the function will acquire and release the write lock. /// As before, but the function will acquire and release the write lock.
/// ///
/// @FUN{TRI_doc_mptr_t const read (TRI_primary_collection_t*, TRI_voc_did_t)} /// @FUN{TRI_doc_mptr_t const read (TRI_primary_collection_t*, TRI_voc_key_t)}
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
/// ///
/// Returns the master pointer of the document with the given identifier. If the /// Returns the master pointer of the document with the given identifier. If the
@ -236,7 +236,7 @@ TRI_doc_collection_info_t;
/// the result is @LIT{0}. The function DOES NOT acquire or release a read /// the result is @LIT{0}. The function DOES NOT acquire or release a read
/// lock. This must be done by the caller. /// lock. This must be done by the caller.
/// ///
/// @FUN{TRI_doc_mptr_t const update (TRI_primary_collection_t*, TRI_shaped_json_t const*, TRI_voc_did_t, TRI_voc_rid_t @FA{rid}, TRI_voc_rid_t* @FA{current}, TRI_doc_update_policy_e, bool @FA{release})} /// @FUN{TRI_doc_mptr_t const update (TRI_primary_collection_t*, TRI_shaped_json_t const*, TRI_voc_key_t, TRI_voc_rid_t @FA{rid}, TRI_voc_rid_t* @FA{current}, TRI_doc_update_policy_e, bool @FA{release})}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// ///
/// Updates an existing document of the collection and returns copy of a valid /// Updates an existing document of the collection and returns copy of a valid
@ -252,17 +252,17 @@ TRI_doc_collection_info_t;
/// performed if the current revision matches the given. In any case the current /// performed if the current revision matches the given. In any case the current
/// revision after the updated of the document is returned in @FA{current}. /// revision after the updated of the document is returned in @FA{current}.
/// ///
/// @FUN{TRI_doc_mptr_t const updateJson (TRI_primary_collection_t*, TRI_json_t const*, TRI_voc_did_t, TRI_voc_rid_t @FA{rid}, TRI_voc_rid_t* @FA{current}, TRI_doc_update_policy_e, bool @FA{release})} /// @FUN{TRI_doc_mptr_t const updateJson (TRI_primary_collection_t*, TRI_json_t const*, TRI_voc_key_t, TRI_voc_rid_t @FA{rid}, TRI_voc_rid_t* @FA{current}, TRI_doc_update_policy_e, bool @FA{release})}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// ///
/// As before, but instead of a shaped json a json object must be given. /// As before, but instead of a shaped json a json object must be given.
/// ///
/// @FUN{int updateLock (TRI_primary_collection_t*, TRI_shaped_json_t const*, TRI_voc_did_t, TRI_voc_rid_t @FA{rid}, TRI_voc_rid_t* @FA{current}, TRI_doc_update_policy_e)} /// @FUN{int updateLock (TRI_primary_collection_t*, TRI_shaped_json_t const*, TRI_voc_key_t, TRI_voc_rid_t @FA{rid}, TRI_voc_rid_t* @FA{current}, TRI_doc_update_policy_e)}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// ///
/// As before, but the function will acquire and release the write lock. /// As before, but the function will acquire and release the write lock.
/// ///
/// @FUN{int destroy (TRI_primary_collection_t*, TRI_voc_did_t, TRI_voc_rid_t, TRI_voc_rid_t @FA{rid}, TRI_voc_rid_t* @FA{current}, TRI_doc_update_policy_e, bool @FA{release})} /// @FUN{int destroy (TRI_primary_collection_t*, TRI_voc_key_t, TRI_voc_rid_t, TRI_voc_rid_t @FA{rid}, TRI_voc_rid_t* @FA{current}, TRI_doc_update_policy_e, bool @FA{release})}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// ///
/// Deletes an existing document from the given collection and returns @ref /// Deletes an existing document from the given collection and returns @ref
@ -277,7 +277,7 @@ TRI_doc_collection_info_t;
/// valid revision of the document. If the delete was aborted, than @FA{current} /// valid revision of the document. If the delete was aborted, than @FA{current}
/// contains the revision of the still alive document. /// contains the revision of the still alive document.
/// ///
/// @FUN{int destroyLock (TRI_primary_collection_t*, TRI_voc_did_t, TRI_voc_rid_t @FA{rid}, TRI_voc_rid_t* @FA{current}, TRI_doc_update_policy_e)} /// @FUN{int destroyLock (TRI_primary_collection_t*, TRI_voc_key_t, TRI_voc_rid_t @FA{rid}, TRI_voc_rid_t* @FA{current}, TRI_doc_update_policy_e)}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// ///
/// As before, but the function will acquire and release the write lock. /// As before, but the function will acquire and release the write lock.
@ -333,36 +333,6 @@ typedef struct TRI_primary_collection_s {
} }
TRI_primary_collection_t; TRI_primary_collection_t;
////////////////////////////////////////////////////////////////////////////////
/// @brief document datafile marker
////////////////////////////////////////////////////////////////////////////////
typedef struct TRI_doc_document_marker_s_deprecated {
TRI_df_marker_t base;
TRI_voc_did_t _did; // this is the tick for a create, but not an update
TRI_voc_rid_t _rid; // this is the tick for an create and update
TRI_voc_eid_t _sid;
TRI_shape_sid_t _shape;
}
TRI_doc_document_marker_t_deprecated;
////////////////////////////////////////////////////////////////////////////////
/// @brief edge datafile marker
////////////////////////////////////////////////////////////////////////////////
typedef struct TRI_doc_edge_marker_s_deprecated {
TRI_doc_document_marker_t_deprecated base;
TRI_voc_cid_t _toCid;
TRI_voc_did_t _toDid;
TRI_voc_cid_t _fromCid;
TRI_voc_did_t _fromDid;
}
TRI_doc_edge_marker_t_deprecated;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief document datafile marker with key /// @brief document datafile marker with key
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -400,19 +370,6 @@ TRI_doc_edge_key_marker_t;
/// @brief document datafile deletion marker /// @brief document datafile deletion marker
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
typedef struct TRI_doc_deletion_marker_s_deprecated {
TRI_df_marker_t base;
TRI_voc_did_t _did; // this is the tick for a create, but not an update
TRI_voc_rid_t _rid; // this is the tick for an create and update
TRI_voc_eid_t _sid;
}
TRI_doc_deletion_marker_t_deprecated;
////////////////////////////////////////////////////////////////////////////////
/// @brief document datafile deletion marker
////////////////////////////////////////////////////////////////////////////////
typedef struct TRI_doc_deletion_key_marker_s { typedef struct TRI_doc_deletion_key_marker_s {
TRI_df_marker_t base; TRI_df_marker_t base;

View File

@ -277,12 +277,6 @@ typedef uint64_t TRI_voc_cid_t;
typedef uint64_t TRI_voc_fid_t; typedef uint64_t TRI_voc_fid_t;
////////////////////////////////////////////////////////////////////////////////
/// @brief document identifier type
////////////////////////////////////////////////////////////////////////////////
typedef uint64_t TRI_voc_did_t;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief document key identifier type /// @brief document key identifier type
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////