1
0
Fork 0

removed unused collection functions

This commit is contained in:
Jan Steemann 2012-10-31 13:18:57 +01:00
parent 07a9f35572
commit 8cb8f2ce0e
3 changed files with 14 additions and 73 deletions

View File

@ -1221,8 +1221,11 @@ static v8::Handle<v8::Value> DeleteVocbaseCol (TRI_vocbase_t* vocbase,
TRI_primary_collection_t* primary = collection->_collection;
TRI_voc_rid_t oldRid;
int res = primary->destroyLock(primary, key, rid, &oldRid, policy, forceSync);
if (key) TRI_FreeString(TRI_CORE_MEM_ZONE, key);
primary->beginWrite(primary);
int res = primary->destroy(primary, key, rid, &oldRid, policy, true, forceSync);
if (key) {
TRI_FreeString(TRI_CORE_MEM_ZONE, key);
}
// .............................................................................
// outside a write transaction
@ -1735,15 +1738,10 @@ static v8::Handle<v8::Value> JS_Trx (v8::Arguments const& argv) {
TRI_transaction_t* trx = TRI_CreateTransaction(context, TRI_TRANSACTION_READ_REPEATABLE);
TRI_AddCollectionTransaction(trx, "users", TRI_TRANSACTION_READ);
TRI_AddCollectionTransaction(trx, "friends", TRI_TRANSACTION_WRITE);
TRI_AddCollectionTransaction(trx, "relations", TRI_TRANSACTION_READ);
TRI_AddCollectionTransaction(trx, "hans", TRI_TRANSACTION_READ);
TRI_AddCollectionTransaction(trx, "peter", TRI_TRANSACTION_READ);
TRI_AddCollectionTransaction(trx, "peter", TRI_TRANSACTION_WRITE);
TRI_AddCollectionTransaction(trx, "friends", TRI_TRANSACTION_READ);
TRI_DumpTransaction(trx);
TRI_StartTransaction(trx);
int res = TRI_StartTransaction(trx);
TRI_DumpTransaction(trx);
bool commit = true;
@ -1751,13 +1749,15 @@ static v8::Handle<v8::Value> JS_Trx (v8::Arguments const& argv) {
commit = TRI_ObjectToBoolean(argv[0]);
}
if (commit) {
TRI_CommitTransaction(trx);
if (res == TRI_ERROR_NO_ERROR) {
if (commit) {
TRI_CommitTransaction(trx);
}
else {
TRI_AbortTransaction(trx);
}
TRI_DumpTransaction(trx);
}
else {
TRI_AbortTransaction(trx);
}
TRI_DumpTransaction(trx);
TRI_DumpTransactionContext(context);

View File

@ -72,19 +72,6 @@ static bool IsEqualKeyDocument (TRI_associative_pointer_t* array, void const* ke
return (strcmp(k, e->_key) == 0);
}
////////////////////////////////////////////////////////////////////////////////
/// @brief creates a new document in the collection from shaped json
////////////////////////////////////////////////////////////////////////////////
static TRI_voc_key_t CreateLock (TRI_primary_collection_t* document,
TRI_df_marker_type_e type,
TRI_shaped_json_t const* json,
void const* data,
bool forceSync) {
document->beginWrite(document);
return document->create(document, type, json, data, 0, true, forceSync)._key;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief creates a new document in the collection from json
////////////////////////////////////////////////////////////////////////////////
@ -121,30 +108,6 @@ static TRI_doc_mptr_t CreateJson (TRI_primary_collection_t* collection,
return result;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief updates a document in the collection from shaped json
////////////////////////////////////////////////////////////////////////////////
static int UpdateLock (TRI_primary_collection_t* document,
TRI_shaped_json_t const* json,
TRI_voc_key_t key,
TRI_voc_rid_t rid,
TRI_voc_rid_t* oldRid,
TRI_doc_update_policy_e policy,
bool forceSync) {
TRI_doc_mptr_t result;
document->beginWrite(document);
result = document->update(document, json, key, rid, oldRid, policy, true, forceSync);
if (result._key == 0) {
return TRI_errno();
}
else {
return TRI_ERROR_NO_ERROR;
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief updates a document in the collection from json
////////////////////////////////////////////////////////////////////////////////
@ -175,20 +138,6 @@ static TRI_doc_mptr_t UpdateJson (TRI_primary_collection_t* collection,
return result;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief deletes a json document given the identifier under a write lock
////////////////////////////////////////////////////////////////////////////////
static int DestroyLock (TRI_primary_collection_t* document,
TRI_voc_key_t key,
TRI_voc_rid_t rid,
TRI_voc_rid_t* oldRid,
TRI_doc_update_policy_e policy,
bool forceSync) {
document->beginWrite(document);
return document->destroy(document, key, rid, oldRid, policy, true, forceSync);
}
////////////////////////////////////////////////////////////////////////////////
/// @brief returns information about the collection
////////////////////////////////////////////////////////////////////////////////
@ -505,14 +454,9 @@ void TRI_InitPrimaryCollection (TRI_primary_collection_t* collection,
collection->_shaper = shaper;
collection->_capConstraint = NULL;
collection->createLock = CreateLock;
collection->createJson = CreateJson;
collection->updateLock = UpdateLock;
collection->updateJson = UpdateJson;
collection->destroyLock = DestroyLock;
collection->figures = Figures;
TRI_InitBarrierList(&collection->_barrierList, collection);

View File

@ -318,15 +318,12 @@ typedef struct TRI_primary_collection_s {
TRI_doc_mptr_t (*create) (struct TRI_primary_collection_s*, TRI_df_marker_type_e, TRI_shaped_json_t const*, void const*, TRI_voc_key_t key, bool, bool);
TRI_doc_mptr_t (*createJson) (struct TRI_primary_collection_s*, TRI_df_marker_type_e, TRI_json_t const*, void const*, bool, bool);
TRI_voc_key_t (*createLock) (struct TRI_primary_collection_s*, TRI_df_marker_type_e, TRI_shaped_json_t const*, void const*, bool);
TRI_doc_mptr_t (*read) (struct TRI_primary_collection_s*, TRI_voc_key_t);
TRI_doc_mptr_t (*update) (struct TRI_primary_collection_s*, TRI_shaped_json_t const*, TRI_voc_key_t, TRI_voc_rid_t, TRI_voc_rid_t*, TRI_doc_update_policy_e, bool, bool);
TRI_doc_mptr_t (*updateJson) (struct TRI_primary_collection_s*, TRI_json_t const*, TRI_voc_key_t, TRI_voc_rid_t, TRI_voc_rid_t*, TRI_doc_update_policy_e, bool, bool);
int (*updateLock) (struct TRI_primary_collection_s*, TRI_shaped_json_t const*, TRI_voc_key_t, TRI_voc_rid_t, TRI_voc_rid_t*, TRI_doc_update_policy_e, bool);
int (*destroy) (struct TRI_primary_collection_s* collection, TRI_voc_key_t, TRI_voc_rid_t, TRI_voc_rid_t*, TRI_doc_update_policy_e, bool, bool);
int (*destroyLock) (struct TRI_primary_collection_s* collection, TRI_voc_key_t, TRI_voc_rid_t, TRI_voc_rid_t*, TRI_doc_update_policy_e, bool);
TRI_doc_collection_info_t* (*figures) (struct TRI_primary_collection_s* collection);
TRI_voc_size_t (*size) (struct TRI_primary_collection_s* collection);