1
0
Fork 0

Merge branch 'spdvpk' of github.com:arangodb/arangodb into spdvpk

This commit is contained in:
Michael Hackstein 2016-02-25 13:03:28 +01:00
commit ef5e0fdd1a
9 changed files with 58 additions and 159 deletions

View File

@ -133,7 +133,7 @@ bool RestDocumentHandler::createDocument() {
int res = trx.begin(); int res = trx.begin();
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
generateTransactionError(collection, res); generateTransactionError(collection, res, "");
return false; return false;
} }
@ -157,7 +157,7 @@ bool RestDocumentHandler::createDocument() {
} }
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
generateTransactionError(collection, res); generateTransactionError(collectionName, res, "");
return false; return false;
} }
@ -184,7 +184,7 @@ bool RestDocumentHandler::createDocumentCoordinator(
resultHeaders, resultBody); resultHeaders, resultBody);
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
generateTransactionError(collection, res); generateTransactionError(collection, res, "");
return false; return false;
} }
@ -275,7 +275,7 @@ bool RestDocumentHandler::readSingleDocument(bool generateBody) {
int res = trx.begin(); int res = trx.begin();
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
generateTransactionError(collection, res); generateTransactionError(collection, res, "");
return false; return false;
} }
@ -284,20 +284,20 @@ bool RestDocumentHandler::readSingleDocument(bool generateBody) {
res = trx.finish(result.code); res = trx.finish(result.code);
if(!result.successful()) { if (!result.successful()) {
if (result.code == TRI_ERROR_ARANGO_DOCUMENT_NOT_FOUND) { if (result.code == TRI_ERROR_ARANGO_DOCUMENT_NOT_FOUND) {
generateDocumentNotFound(collection, (TRI_voc_key_t)key.c_str()); generateDocumentNotFound(collection, key);
return false; return false;
} else if (ifRid != 0 && result.code == TRI_ERROR_ARANGO_CONFLICT) { } else if (ifRid != 0 && result.code == TRI_ERROR_ARANGO_CONFLICT) {
generatePreconditionFailed(result.slice()); generatePreconditionFailed(result.slice());
} else { } else {
generateTransactionError(collection, res, (TRI_voc_key_t)key.c_str()); generateTransactionError(collection, res, key);
} }
return false; return false;
} }
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
generateTransactionError(collection, res, (TRI_voc_key_t)key.c_str()); generateTransactionError(collection, res, key);
return false; return false;
} }
@ -342,7 +342,7 @@ bool RestDocumentHandler::getDocumentCoordinator(std::string const& collname,
resultHeaders, resultBody); resultHeaders, resultBody);
if (error != TRI_ERROR_NO_ERROR) { if (error != TRI_ERROR_NO_ERROR) {
generateTransactionError(collname, error); generateTransactionError(collname, error, "");
return false; return false;
} }
// Essentially return the response we got from the DBserver, be it // Essentially return the response we got from the DBserver, be it
@ -390,7 +390,7 @@ bool RestDocumentHandler::readAllDocuments() {
int res = trx.begin(); int res = trx.begin();
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
generateTransactionError(collection, res); generateTransactionError(collection, res, "");
return false; return false;
} }
@ -407,7 +407,7 @@ bool RestDocumentHandler::readAllDocuments() {
// ............................................................................. // .............................................................................
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
generateTransactionError(collection, res); generateTransactionError(collection, res, "");
return false; return false;
} }
@ -467,7 +467,7 @@ bool RestDocumentHandler::getAllDocumentsCoordinator(
dbname, collname, returnType, responseCode, contentType, resultBody); dbname, collname, returnType, responseCode, contentType, resultBody);
if (error != TRI_ERROR_NO_ERROR) { if (error != TRI_ERROR_NO_ERROR) {
generateTransactionError(collname, error); generateTransactionError(collname, error, "");
return false; return false;
} }
// Return the response we got: // Return the response we got:
@ -522,7 +522,7 @@ bool RestDocumentHandler::modifyDocument(bool isPatch) {
} }
// split the document reference // split the document reference
std::string const& collection = suffix[0]; std::string const& collectionName = suffix[0];
std::string const& key = suffix[1]; std::string const& key = suffix[1];
bool parseSuccess = true; bool parseSuccess = true;
@ -535,8 +535,8 @@ bool RestDocumentHandler::modifyDocument(bool isPatch) {
VPackSlice body = parsedBody->slice(); VPackSlice body = parsedBody->slice();
if (!body.isObject()) { if (!body.isObject()) {
generateTransactionError(collection, generateTransactionError(collectionName,
TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID); TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID, "");
return false; return false;
} }
@ -570,7 +570,7 @@ bool RestDocumentHandler::modifyDocument(bool isPatch) {
// find and load collection given by name or identifier // find and load collection given by name or identifier
SingleCollectionTransaction trx(StandaloneTransactionContext::Create(_vocbase), SingleCollectionTransaction trx(StandaloneTransactionContext::Create(_vocbase),
collection, TRI_TRANSACTION_WRITE); collectionName, TRI_TRANSACTION_WRITE);
// ............................................................................. // .............................................................................
// inside write transaction // inside write transaction
@ -579,7 +579,7 @@ bool RestDocumentHandler::modifyDocument(bool isPatch) {
int res = trx.begin(); int res = trx.begin();
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
generateTransactionError(collection, res); generateTransactionError(collectionName, res, "");
return false; return false;
} }
@ -604,10 +604,10 @@ bool RestDocumentHandler::modifyDocument(bool isPatch) {
opOptions.mergeObjects = false; opOptions.mergeObjects = false;
} }
result = trx.update(collection, search, body, opOptions); result = trx.update(collectionName, search, body, opOptions);
} else { } else {
// replacing an existing document // replacing an existing document
result = trx.replace(collection, search, body, opOptions); result = trx.replace(collectionName, search, body, opOptions);
} }
res = trx.finish(result.code); res = trx.finish(result.code);
@ -622,13 +622,11 @@ bool RestDocumentHandler::modifyDocument(bool isPatch) {
} }
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
// This should not occur. Updated worked but commit failed generateTransactionError(collectionName, res, key, 0);
generateTransactionError(collection, res, (TRI_voc_key_t)key.c_str(), 0);
return false; return false;
} }
generateSaved(result, collection, TRI_col_type_e(trx.getCollectionType(collection))); generateSaved(result, collectionName, TRI_col_type_e(trx.getCollectionType(collectionName)));
return true; return true;
} }
@ -662,7 +660,7 @@ bool RestDocumentHandler::modifyDocumentCoordinator(
mergeObjects, document, headers, responseCode, resultHeaders, resultBody); mergeObjects, document, headers, responseCode, resultHeaders, resultBody);
if (error != TRI_ERROR_NO_ERROR) { if (error != TRI_ERROR_NO_ERROR) {
generateTransactionError(collname, error); generateTransactionError(collname, error, "");
return false; return false;
} }
@ -688,7 +686,7 @@ bool RestDocumentHandler::deleteDocument() {
} }
// split the document reference // split the document reference
std::string const& collection = suffix[0]; std::string const& collectionName = suffix[0];
std::string const& key = suffix[1]; std::string const& key = suffix[1];
// extract the revision // extract the revision
@ -710,15 +708,16 @@ bool RestDocumentHandler::deleteDocument() {
} }
SingleCollectionTransaction trx(StandaloneTransactionContext::Create(_vocbase), SingleCollectionTransaction trx(StandaloneTransactionContext::Create(_vocbase),
collection, TRI_TRANSACTION_WRITE); collectionName, TRI_TRANSACTION_WRITE);
// ............................................................................. // .............................................................................
// inside write transaction // inside write transaction
// ............................................................................. // .............................................................................
int res = trx.begin(); int res = trx.begin();
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
generateTransactionError(collection, res); generateTransactionError(collectionName, res, "");
return false; return false;
} }
@ -733,21 +732,21 @@ bool RestDocumentHandler::deleteDocument() {
} }
VPackSlice search = builder.slice(); VPackSlice search = builder.slice();
OperationResult result = trx.remove(collection, search, opOptions); OperationResult result = trx.remove(collectionName, search, opOptions);
res = trx.finish(result.code); res = trx.finish(result.code);
if(!result.successful()) { if (!result.successful()) {
generateTransactionError(result); generateTransactionError(result);
return false; return false;
} }
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
generateTransactionError(collection, res, (TRI_voc_key_t)key.c_str()); generateTransactionError(collectionName, res, key);
return false; return false;
} }
generateDeleted(result, collection, TRI_col_type_e(trx.getCollectionType(collection))); generateDeleted(result, collectionName, TRI_col_type_e(trx.getCollectionType(collectionName)));
return true; return true;
} }
@ -771,7 +770,7 @@ bool RestDocumentHandler::deleteDocumentCoordinator(
resultHeaders, resultBody); resultHeaders, resultBody);
if (error != TRI_ERROR_NO_ERROR) { if (error != TRI_ERROR_NO_ERROR) {
generateTransactionError(collname, error); generateTransactionError(collname, error, "");
return false; return false;
} }
// Essentially return the response we got from the DBserver, be it // Essentially return the response we got from the DBserver, be it

View File

@ -114,7 +114,7 @@ bool RestEdgeHandler::createDocument() {
if (!parsedBody->isOpenObject()) { if (!parsedBody->isOpenObject()) {
generateTransactionError(collection, generateTransactionError(collection,
TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID); TRI_ERROR_ARANGO_DOCUMENT_TYPE_INVALID, "");
return false; return false;
} }
@ -137,7 +137,7 @@ bool RestEdgeHandler::createDocument() {
int res = trx.begin(); int res = trx.begin();
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
generateTransactionError(collection, res); generateTransactionError(collection, res, "");
return false; return false;
} }
@ -181,12 +181,12 @@ bool RestEdgeHandler::createDocument() {
wrongPart + " is not a document handle"); wrongPart + " is not a document handle");
} }
*/ */
generateTransactionError(collection, result.code); generateTransactionError(collection, result.code, "");
return false; return false;
} }
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
generateTransactionError(collection, res); generateTransactionError(collection, res, "");
return false; return false;
} }
@ -228,7 +228,7 @@ bool RestEdgeHandler::createDocumentCoordinator(std::string const& collname,
resultHeaders, resultBody); resultHeaders, resultBody);
if (error != TRI_ERROR_NO_ERROR) { if (error != TRI_ERROR_NO_ERROR) {
generateTransactionError(collname.c_str(), error); generateTransactionError(collname, error, "");
return false; return false;
} }

View File

@ -200,7 +200,7 @@ bool RestEdgesHandler::readEdges(
int res = trx.begin(); int res = trx.begin();
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
generateTransactionError(collectionName, res); generateTransactionError(collectionName, res, "");
return false; return false;
} }
@ -223,7 +223,7 @@ bool RestEdgesHandler::readEdges(
} }
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
generateTransactionError(collectionName, res); generateTransactionError(collectionName, res, "");
return false; return false;
} }
@ -328,7 +328,7 @@ bool RestEdgesHandler::readEdgesForMultipleVertices() {
int res = trx.begin(); int res = trx.begin();
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
generateTransactionError(collectionName, res); generateTransactionError(collectionName, res, "");
return false; return false;
} }
@ -356,7 +356,7 @@ bool RestEdgesHandler::readEdgesForMultipleVertices() {
res = trx.finish(res); res = trx.finish(res);
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
generateTransactionError(collectionName, res); generateTransactionError(collectionName, res, "");
return false; return false;
} }

View File

@ -379,7 +379,7 @@ bool RestImportHandler::createFromJson(std::string const& type) {
int res = trx.begin(); int res = trx.begin();
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
generateTransactionError(collection, res); generateTransactionError(collection, res, "");
return false; return false;
} }
@ -518,7 +518,7 @@ bool RestImportHandler::createFromJson(std::string const& type) {
// ............................................................................. // .............................................................................
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
generateTransactionError(collection, res); generateTransactionError(collection, res, "");
} else { } else {
// generate result // generate result
generateDocumentsCreated(result); generateDocumentsCreated(result);
@ -632,7 +632,7 @@ bool RestImportHandler::createFromKeyValueList() {
int res = trx.begin(); int res = trx.begin();
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
generateTransactionError(collection, res); generateTransactionError(collection, res, "");
return false; return false;
} }
@ -730,7 +730,7 @@ bool RestImportHandler::createFromKeyValueList() {
// ............................................................................. // .............................................................................
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
generateTransactionError(collection, res); generateTransactionError(collection, res, "");
} else { } else {
// generate result // generate result
generateDocumentsCreated(result); generateDocumentsCreated(result);

View File

@ -185,7 +185,7 @@ bool RestVocbaseBaseHandler::checkCreateCollection(std::string const& name,
if (ServerState::instance()->isCoordinator() || if (ServerState::instance()->isCoordinator() ||
ServerState::instance()->isDBServer()) { ServerState::instance()->isDBServer()) {
// create-collection is not supported in a cluster // create-collection is not supported in a cluster
generateTransactionError(name, TRI_ERROR_CLUSTER_UNSUPPORTED); generateTransactionError(name, TRI_ERROR_CLUSTER_UNSUPPORTED, "");
return false; return false;
} }
@ -193,7 +193,7 @@ bool RestVocbaseBaseHandler::checkCreateCollection(std::string const& name,
TRI_FindCollectionByNameOrCreateVocBase(_vocbase, name.c_str(), type); TRI_FindCollectionByNameOrCreateVocBase(_vocbase, name.c_str(), type);
if (collection == nullptr) { if (collection == nullptr) {
generateTransactionError(name, TRI_errno()); generateTransactionError(name, TRI_errno(), "");
return false; return false;
} }
@ -327,12 +327,11 @@ void RestVocbaseBaseHandler::generatePreconditionFailed(
createResponse(HttpResponse::PRECONDITION_FAILED); createResponse(HttpResponse::PRECONDITION_FAILED);
_response->setContentType("application/json; charset=utf-8"); _response->setContentType("application/json; charset=utf-8");
std::string rev = VelocyPackHelper::getStringValue(slice, TRI_VOC_ATTRIBUTE_REV, ""); std::string const rev = VelocyPackHelper::getStringValue(slice, TRI_VOC_ATTRIBUTE_REV, "");
_response->setHeader("etag", 4, "\"" + rev + "\""); _response->setHeader("etag", 4, "\"" + rev + "\"");
VPackBuilder builder; VPackBuilder builder;
{ {
VPackObjectBuilder guard(&builder); VPackObjectBuilder guard(&builder);
// _id and _key are safe and do not need to be JSON-encoded
builder.add("error", VPackValue(true)); builder.add("error", VPackValue(true));
builder.add( builder.add(
"code", "code",
@ -360,7 +359,7 @@ void RestVocbaseBaseHandler::generatePreconditionFailed(
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void RestVocbaseBaseHandler::generatePreconditionFailed( void RestVocbaseBaseHandler::generatePreconditionFailed(
std::string const& collectionName, TRI_voc_key_t key, TRI_voc_rid_t rid) { std::string const& collectionName, std::string const& key, TRI_voc_rid_t rid) {
std::string rev(StringUtils::itoa(rid)); std::string rev(StringUtils::itoa(rid));
createResponse(HttpResponse::PRECONDITION_FAILED); createResponse(HttpResponse::PRECONDITION_FAILED);
@ -383,8 +382,6 @@ void RestVocbaseBaseHandler::generatePreconditionFailed(
.appendText("\"}"); .appendText("\"}");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief generates not modified /// @brief generates not modified
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -545,7 +542,7 @@ void RestVocbaseBaseHandler::generateDocument(VPackSlice const& document,
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void RestVocbaseBaseHandler::generateTransactionError( void RestVocbaseBaseHandler::generateTransactionError(
std::string const& collectionName, int res, TRI_voc_key_t key, std::string const& collectionName, int res, std::string const& key,
TRI_voc_rid_t rid) { TRI_voc_rid_t rid) {
switch (res) { switch (res) {
case TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND: case TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND:
@ -591,7 +588,7 @@ void RestVocbaseBaseHandler::generateTransactionError(
case TRI_ERROR_ARANGO_CONFLICT: case TRI_ERROR_ARANGO_CONFLICT:
generatePreconditionFailed(collectionName, generatePreconditionFailed(collectionName,
key ? key : (TRI_voc_key_t) "unknown", rid); key.empty() ? "unknown" : key, rid);
return; return;
case TRI_ERROR_CLUSTER_SHARD_GONE: case TRI_ERROR_CLUSTER_SHARD_GONE:

View File

@ -169,28 +169,6 @@ class RestVocbaseBaseHandler : public RestBaseHandler {
createResponse(code); createResponse(code);
} }
//////////////////////////////////////////////////////////////////////////////
/// @brief generates message for a saved document
/// DEPRECATED
//////////////////////////////////////////////////////////////////////////////
void generateSaved(arangodb::SingleCollectionTransaction& trx,
TRI_voc_cid_t cid, TRI_doc_mptr_copy_t const& mptr) {
TRI_ASSERT(mptr.getDataPtr() != nullptr); // PROTECTED by trx here
rest::HttpResponse::HttpResponseCode statusCode;
if (trx.synchronous()) {
statusCode = rest::HttpResponse::CREATED;
} else {
statusCode = rest::HttpResponse::ACCEPTED;
}
TRI_col_type_e type = trx.documentCollection()->_info.type();
generate20x(statusCode, trx.resolver()->getCollectionName(cid),
(TRI_voc_key_t)TRI_EXTRACT_MARKER_KEY(&mptr), mptr._rid,
type); // PROTECTED by trx here
}
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
/// @brief generates message for a saved document /// @brief generates message for a saved document
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
@ -198,26 +176,6 @@ class RestVocbaseBaseHandler : public RestBaseHandler {
void generateSaved(arangodb::OperationResult const& result, void generateSaved(arangodb::OperationResult const& result,
std::string const& collectionName, TRI_col_type_e type); std::string const& collectionName, TRI_col_type_e type);
//////////////////////////////////////////////////////////////////////////////
/// @brief generates deleted message
/// DEPRECATED
//////////////////////////////////////////////////////////////////////////////
void generateDeleted(arangodb::SingleCollectionTransaction& trx,
TRI_voc_cid_t cid, TRI_voc_key_t key,
TRI_voc_rid_t rid) {
rest::HttpResponse::HttpResponseCode statusCode;
if (trx.synchronous()) {
statusCode = rest::HttpResponse::OK;
} else {
statusCode = rest::HttpResponse::ACCEPTED;
}
TRI_col_type_e type = trx.documentCollection()->_info.type();
generate20x(statusCode, trx.resolver()->getCollectionName(cid), key, rid,
type);
}
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
/// @brief generates deleted message /// @brief generates deleted message
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
@ -225,24 +183,13 @@ class RestVocbaseBaseHandler : public RestBaseHandler {
void generateDeleted(arangodb::OperationResult const& result, void generateDeleted(arangodb::OperationResult const& result,
std::string const& collectionName, TRI_col_type_e type); std::string const& collectionName, TRI_col_type_e type);
//////////////////////////////////////////////////////////////////////////////
/// @brief generates document not found error message, read transaction
//////////////////////////////////////////////////////////////////////////////
void generateDocumentNotFound(
arangodb::SingleCollectionTransaction& trx, TRI_voc_cid_t cid,
TRI_voc_key_t key) {
generateDocumentNotFound(trx.resolver()->getCollectionName(cid), key);
}
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
/// @brief generates document not found error message, no transaction info /// @brief generates document not found error message, no transaction info
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
void generateDocumentNotFound(std::string const&, void generateDocumentNotFound(std::string const& /* collection name */,
TRI_voc_key_t) { std::string const& /* document key */) {
generateError(rest::HttpResponse::NOT_FOUND, generateError(rest::HttpResponse::NOT_FOUND, TRI_ERROR_ARANGO_DOCUMENT_NOT_FOUND);
TRI_ERROR_ARANGO_DOCUMENT_NOT_FOUND);
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
@ -257,26 +204,12 @@ class RestVocbaseBaseHandler : public RestBaseHandler {
void generateForbidden(); void generateForbidden();
//////////////////////////////////////////////////////////////////////////////
/// @brief generates precondition failed, for a read-transaction
//////////////////////////////////////////////////////////////////////////////
void generatePreconditionFailed(SingleCollectionTransaction& trx,
TRI_voc_cid_t cid,
TRI_doc_mptr_copy_t const& mptr,
TRI_voc_rid_t rid) {
return generatePreconditionFailed(
trx.resolver()->getCollectionName(cid),
(TRI_voc_key_t)TRI_EXTRACT_MARKER_KEY(&mptr),
rid); // PROTECTED by RUNTIME
}
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
/// @brief generates precondition failed, without transaction info /// @brief generates precondition failed, without transaction info
/// DEPRECATED /// DEPRECATED
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
void generatePreconditionFailed(std::string const&, TRI_voc_key_t key, void generatePreconditionFailed(std::string const&, std::string const& key,
TRI_voc_rid_t rid); TRI_voc_rid_t rid);
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
@ -311,7 +244,7 @@ class RestVocbaseBaseHandler : public RestBaseHandler {
/// DEPRECATED /// DEPRECATED
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
void generateTransactionError(std::string const&, int, TRI_voc_key_t = 0, void generateTransactionError(std::string const&, int, std::string const& key,
TRI_voc_rid_t = 0); TRI_voc_rid_t = 0);
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -172,14 +172,6 @@ class SingleCollectionTransaction : public Transaction {
return this->lock(this->trxCollection(), TRI_TRANSACTION_WRITE); return this->lock(this->trxCollection(), TRI_TRANSACTION_WRITE);
} }
//////////////////////////////////////////////////////////////////////////////
/// @brief return whether a write in the transaction was synchronous
//////////////////////////////////////////////////////////////////////////////
inline bool synchronous() const {
return TRI_WasSynchronousCollectionTransaction(this->_trx, _cid);
}
private: private:
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
/// @brief collection id /// @brief collection id

View File

@ -794,7 +794,6 @@ void TRI_FreeTransaction(TRI_transaction_t* trx) {
} }
TRI_DestroyVectorPointer(&trx->_collections); TRI_DestroyVectorPointer(&trx->_collections);
TRI_Free(TRI_UNKNOWN_MEM_ZONE, trx); TRI_Free(TRI_UNKNOWN_MEM_ZONE, trx);
} }
@ -807,23 +806,9 @@ TRI_transaction_type_e TRI_GetTransactionTypeFromStr(char const* s) {
return TRI_TRANSACTION_READ; return TRI_TRANSACTION_READ;
} else if (TRI_EqualString(s, "write")) { } else if (TRI_EqualString(s, "write")) {
return TRI_TRANSACTION_WRITE; return TRI_TRANSACTION_WRITE;
} else { }
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
"invalid transaction type"); "invalid transaction type");
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief return the collection from a transaction
////////////////////////////////////////////////////////////////////////////////
bool TRI_WasSynchronousCollectionTransaction(TRI_transaction_t const* trx,
TRI_voc_cid_t cid) {
TRI_ASSERT(trx->_status == TRI_TRANSACTION_RUNNING ||
trx->_status == TRI_TRANSACTION_ABORTED ||
trx->_status == TRI_TRANSACTION_COMMITTED);
return trx->_waitForSync;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -192,13 +192,6 @@ static inline TRI_voc_tid_t TRI_MarkerIdTransaction(
/// @brief return the collection from a transaction /// @brief return the collection from a transaction
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool TRI_WasSynchronousCollectionTransaction(TRI_transaction_t const*,
TRI_voc_cid_t);
////////////////////////////////////////////////////////////////////////////////
/// @brief return the collection from a transaction
////////////////////////////////////////////////////////////////////////////////
TRI_transaction_collection_t* TRI_GetCollectionTransaction( TRI_transaction_collection_t* TRI_GetCollectionTransaction(
TRI_transaction_t const*, TRI_voc_cid_t, TRI_transaction_type_e); TRI_transaction_t const*, TRI_voc_cid_t, TRI_transaction_type_e);