mirror of https://gitee.com/bigwinds/arangodb
introduced additional transaction type for import
This commit is contained in:
parent
00c9955ed2
commit
12d76b8306
|
@ -87,14 +87,10 @@ bin_arangod_SOURCES = \
|
||||||
arangod/VocBase/shadow-data.c \
|
arangod/VocBase/shadow-data.c \
|
||||||
arangod/VocBase/shape-collection.c \
|
arangod/VocBase/shape-collection.c \
|
||||||
arangod/VocBase/synchroniser.c \
|
arangod/VocBase/synchroniser.c \
|
||||||
|
arangod/VocBase/transaction.c \
|
||||||
arangod/VocBase/voc-shaper.c \
|
arangod/VocBase/voc-shaper.c \
|
||||||
arangod/VocBase/vocbase.c
|
arangod/VocBase/vocbase.c
|
||||||
|
|
||||||
bin_arangod_SOURCES += \
|
|
||||||
arangod/VocBase/versioned-index.c \
|
|
||||||
arangod/VocBase/transaction.c
|
|
||||||
|
|
||||||
|
|
||||||
if ENABLE_MRUBY
|
if ENABLE_MRUBY
|
||||||
|
|
||||||
bin_arangod_LDADD += \
|
bin_arangod_LDADD += \
|
||||||
|
|
|
@ -404,7 +404,7 @@ bool RestDocumentHandler::readSingleDocument (bool generateBody) {
|
||||||
|
|
||||||
// find and load collection given by name or identifier
|
// find and load collection given by name or identifier
|
||||||
Collection c(_vocbase, collection, getCollectionType(), false);
|
Collection c(_vocbase, collection, getCollectionType(), false);
|
||||||
SelfContainedReadTransaction trx(&c);
|
SingleCollectionReadOnlyTransaction trx(&c);
|
||||||
|
|
||||||
// .............................................................................
|
// .............................................................................
|
||||||
// inside read transaction
|
// inside read transaction
|
||||||
|
@ -494,7 +494,7 @@ bool RestDocumentHandler::readAllDocuments () {
|
||||||
|
|
||||||
// find and load collection given by name or identifier
|
// find and load collection given by name or identifier
|
||||||
Collection c(_vocbase, collection, getCollectionType(), false);
|
Collection c(_vocbase, collection, getCollectionType(), false);
|
||||||
SelfContainedReadTransaction trx(&c);
|
SingleCollectionReadOnlyTransaction trx(&c);
|
||||||
|
|
||||||
vector<string> ids;
|
vector<string> ids;
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
#include "VocBase/document-collection.h"
|
#include "VocBase/document-collection.h"
|
||||||
#include "VocBase/vocbase.h"
|
#include "VocBase/vocbase.h"
|
||||||
|
|
||||||
|
#include "Utils/ImportTransaction.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace triagens::basics;
|
using namespace triagens::basics;
|
||||||
using namespace triagens::rest;
|
using namespace triagens::rest;
|
||||||
|
@ -200,7 +202,7 @@ bool RestImportHandler::createByArray () {
|
||||||
|
|
||||||
// find and load collection given by name or identifier
|
// find and load collection given by name or identifier
|
||||||
Collection c(_vocbase, collection, TRI_COL_TYPE_DOCUMENT, create);
|
Collection c(_vocbase, collection, TRI_COL_TYPE_DOCUMENT, create);
|
||||||
SelfContainedWriteTransaction trx(&c);
|
ImportTransaction trx(&c);
|
||||||
|
|
||||||
// .............................................................................
|
// .............................................................................
|
||||||
// inside write transaction
|
// inside write transaction
|
||||||
|
@ -376,7 +378,7 @@ bool RestImportHandler::createByList () {
|
||||||
|
|
||||||
// find and load collection given by name or identifier
|
// find and load collection given by name or identifier
|
||||||
Collection c(_vocbase, collection, TRI_COL_TYPE_DOCUMENT, create);
|
Collection c(_vocbase, collection, TRI_COL_TYPE_DOCUMENT, create);
|
||||||
SelfContainedWriteTransaction trx(&c);
|
ImportTransaction trx(&c);
|
||||||
|
|
||||||
// .............................................................................
|
// .............................................................................
|
||||||
// inside write transaction
|
// inside write transaction
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#include "Logger/Logger.h"
|
#include "Logger/Logger.h"
|
||||||
#include "Rest/HttpResponse.h"
|
#include "Rest/HttpResponse.h"
|
||||||
#include "Utils/Collection.h"
|
#include "Utils/Collection.h"
|
||||||
#include "Utils/SelfContainedReadTransaction.h"
|
#include "Utils/SingleCollectionReadOnlyTransaction.h"
|
||||||
#include "Utils/SelfContainedWriteTransaction.h"
|
#include "Utils/SelfContainedWriteTransaction.h"
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief wrapper for single collection, multi-operation write transactions
|
||||||
|
///
|
||||||
|
/// @file
|
||||||
|
///
|
||||||
|
/// DISCLAIMER
|
||||||
|
///
|
||||||
|
/// Copyright 2004-2012 triAGENS GmbH, Cologne, Germany
|
||||||
|
///
|
||||||
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
/// you may not use this file except in compliance with the License.
|
||||||
|
/// You may obtain a copy of the License at
|
||||||
|
///
|
||||||
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
///
|
||||||
|
/// Unless required by applicable law or agreed to in writing, software
|
||||||
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
/// See the License for the specific language governing permissions and
|
||||||
|
/// limitations under the License.
|
||||||
|
///
|
||||||
|
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||||
|
///
|
||||||
|
/// @author Jan Steemann
|
||||||
|
/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef TRIAGENS_UTILS_IMPORT_TRANSACTION_H
|
||||||
|
#define TRIAGENS_UTILS_IMPORT_TRANSACTION_H 1
|
||||||
|
|
||||||
|
#include "Utils/CollectionWriteLock.h"
|
||||||
|
#include "Utils/SingleCollectionWriteTransaction.h"
|
||||||
|
|
||||||
|
namespace triagens {
|
||||||
|
namespace arango {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- class ImportTransaction
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class ImportTransaction : public SingleCollectionWriteTransaction<UINT64_MAX> {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @addtogroup ArangoDB
|
||||||
|
/// @{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- constructors and destructors
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @addtogroup ArangoDB
|
||||||
|
/// @{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief create the transaction, using a collection object
|
||||||
|
///
|
||||||
|
/// An import transaction operates on a single collection and may execute any
|
||||||
|
/// number of writes on it.
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
ImportTransaction (Collection* collection) :
|
||||||
|
SingleCollectionWriteTransaction<UINT64_MAX>(collection, "ImportTransaction") {
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief end the transaction
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
~ImportTransaction () {
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Local Variables:
|
||||||
|
// mode: outline-minor
|
||||||
|
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}\\)"
|
||||||
|
// End:
|
|
@ -1,5 +1,5 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief wrapper for self-contained, single collection write transactions
|
/// @brief wrapper for single collection, single operation write transactions
|
||||||
///
|
///
|
||||||
/// @file
|
/// @file
|
||||||
///
|
///
|
||||||
|
@ -29,16 +29,16 @@
|
||||||
#define TRIAGENS_UTILS_SELF_CONTAINED_WRITE_TRANSACTION_H 1
|
#define TRIAGENS_UTILS_SELF_CONTAINED_WRITE_TRANSACTION_H 1
|
||||||
|
|
||||||
#include "Utils/CollectionWriteLock.h"
|
#include "Utils/CollectionWriteLock.h"
|
||||||
#include "Utils/SelfContainedTransaction.h"
|
#include "Utils/SingleCollectionWriteTransaction.h"
|
||||||
|
|
||||||
namespace triagens {
|
namespace triagens {
|
||||||
namespace arango {
|
namespace arango {
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- class SelfContainedWriteTransaction
|
// --SECTION-- ass SelfContainedWriteTransaction
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
class SelfContainedWriteTransaction : public SelfContainedTransaction {
|
class SelfContainedWriteTransaction : public SingleCollectionWriteTransaction<1> {
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @addtogroup ArangoDB
|
/// @addtogroup ArangoDB
|
||||||
|
@ -58,11 +58,13 @@ namespace triagens {
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief create the transaction, using a collection object
|
/// @brief create the transaction, using a collection object
|
||||||
|
///
|
||||||
|
/// A self contained write transaction operates on a single collection and may
|
||||||
|
/// execute at most one write operation
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
SelfContainedWriteTransaction (Collection* collection) :
|
SelfContainedWriteTransaction (Collection* collection) :
|
||||||
SelfContainedTransaction(collection),
|
SingleCollectionWriteTransaction<1>(collection, "SelfContainedWriteTransaction") {
|
||||||
_synchronous(false) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -72,156 +74,6 @@ namespace triagens {
|
||||||
~SelfContainedWriteTransaction () {
|
~SelfContainedWriteTransaction () {
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @}
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @addtogroup ArangoDB
|
|
||||||
/// @{
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
// --SECTION-- public functions
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief return whether the last write in a transaction was synchronous
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
inline bool synchronous () const {
|
|
||||||
return _synchronous;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief create a single document within a transaction
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
int createDocument (TRI_doc_mptr_t** mptr,
|
|
||||||
TRI_json_t const* json,
|
|
||||||
bool forceSync) {
|
|
||||||
TRI_primary_collection_t* primary = _collection->primary();
|
|
||||||
TRI_doc_operation_context_t context;
|
|
||||||
|
|
||||||
TRI_InitContextPrimaryCollection(&context, primary, TRI_DOC_UPDATE_ERROR, forceSync);
|
|
||||||
_synchronous = context._sync;
|
|
||||||
|
|
||||||
CollectionWriteLock lock(_collection);
|
|
||||||
|
|
||||||
return primary->createJson(&context, TRI_DOC_MARKER_KEY_DOCUMENT, mptr, json, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief create a single edge within a transaction
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
int createEdge (TRI_doc_mptr_t** mptr,
|
|
||||||
TRI_json_t const* json,
|
|
||||||
bool forceSync,
|
|
||||||
void const* data) {
|
|
||||||
TRI_primary_collection_t* primary = _collection->primary();
|
|
||||||
TRI_doc_operation_context_t context;
|
|
||||||
|
|
||||||
TRI_InitContextPrimaryCollection(&context, primary, TRI_DOC_UPDATE_ERROR, forceSync);
|
|
||||||
_synchronous = context._sync;
|
|
||||||
|
|
||||||
CollectionWriteLock lock(_collection);
|
|
||||||
|
|
||||||
return primary->createJson(&context, TRI_DOC_MARKER_KEY_EDGE, mptr, json, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief update a single document within a transaction
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
int updateJson (const string& key,
|
|
||||||
TRI_doc_mptr_t** mptr,
|
|
||||||
TRI_json_t* const json,
|
|
||||||
const TRI_doc_update_policy_e policy,
|
|
||||||
bool forceSync,
|
|
||||||
const TRI_voc_rid_t expectedRevision,
|
|
||||||
TRI_voc_rid_t* actualRevision) {
|
|
||||||
TRI_primary_collection_t* primary = _collection->primary();
|
|
||||||
TRI_doc_operation_context_t context;
|
|
||||||
|
|
||||||
TRI_InitContextPrimaryCollection(&context, primary, policy, forceSync);
|
|
||||||
context._expectedRid = expectedRevision;
|
|
||||||
context._previousRid = actualRevision;
|
|
||||||
_synchronous = context._sync;
|
|
||||||
|
|
||||||
CollectionWriteLock lock(_collection);
|
|
||||||
|
|
||||||
return primary->updateJson(&context, mptr, json, (TRI_voc_key_t) key.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief delete a single document within a transaction
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
int destroy (const string& key,
|
|
||||||
const TRI_doc_update_policy_e policy,
|
|
||||||
bool forceSync,
|
|
||||||
const TRI_voc_rid_t expectedRevision,
|
|
||||||
TRI_voc_rid_t* actualRevision) {
|
|
||||||
TRI_primary_collection_t* primary = _collection->primary();
|
|
||||||
TRI_doc_operation_context_t context;
|
|
||||||
|
|
||||||
TRI_InitContextPrimaryCollection(&context, primary, policy, forceSync);
|
|
||||||
context._expectedRid = expectedRevision;
|
|
||||||
context._previousRid = actualRevision;
|
|
||||||
_synchronous = context._sync;
|
|
||||||
|
|
||||||
CollectionWriteLock lock(_collection);
|
|
||||||
|
|
||||||
return primary->destroy(&context, (TRI_voc_key_t) key.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @}
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
// --SECTION-- virtual protected functions
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @addtogroup ArangoDB
|
|
||||||
/// @{
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief get the transaction type
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
TRI_transaction_type_e type () const {
|
|
||||||
return TRI_TRANSACTION_WRITE;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @}
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @addtogroup ArangoDB
|
|
||||||
/// @{
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
// --SECTION-- private variables
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief whether of not the last write action was executed synchronously
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
bool _synchronous;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @}
|
/// @}
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -25,19 +25,19 @@
|
||||||
/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany
|
/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef TRIAGENS_UTILS_SELF_CONTAINED_READ_TRANSACTION_H
|
#ifndef TRIAGENS_UTILS_SINGLE_COLLECTION_READ_ONLY_TRANSACTION_H
|
||||||
#define TRIAGENS_UTILS_SELF_CONTAINED_READ_TRANSACTION_H 1
|
#define TRIAGENS_UTILS_SINGLE_COLLECTION_READ_ONLY_TRANSACTION_H 1
|
||||||
|
|
||||||
#include "Utils/SelfContainedTransaction.h"
|
#include "Utils/SingleCollectionTransaction.h"
|
||||||
|
|
||||||
namespace triagens {
|
namespace triagens {
|
||||||
namespace arango {
|
namespace arango {
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- class SelfContainedReadTransaction
|
// --SECTION-- class SingleCollectionReadOnlyTransaction
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
class SelfContainedReadTransaction : public SelfContainedTransaction {
|
class SingleCollectionReadOnlyTransaction : public SingleCollectionTransaction {
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @addtogroup ArangoDB
|
/// @addtogroup ArangoDB
|
||||||
|
@ -57,40 +57,20 @@ namespace triagens {
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief create the transaction, using a collection object
|
/// @brief create the transaction, using a collection object
|
||||||
|
///
|
||||||
|
/// A self-contained read transaction is a transaction on a single collection
|
||||||
|
/// that only allows read operations. Write operations are not supported.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
SelfContainedReadTransaction (Collection* collection) :
|
SingleCollectionReadOnlyTransaction (Collection* collection) :
|
||||||
SelfContainedTransaction(collection) {
|
SingleCollectionTransaction(collection, "SingleCollectionReadOnlyTransaction", TRI_TRANSACTION_READ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief end the transaction
|
/// @brief end the transaction
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
~SelfContainedReadTransaction () {
|
~SingleCollectionReadOnlyTransaction () {
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @}
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
// --SECTION-- virtual protected functions
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @addtogroup ArangoDB
|
|
||||||
/// @{
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief get the transaction type
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
TRI_transaction_type_e type () const {
|
|
||||||
return TRI_TRANSACTION_READ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
|
@ -1,5 +1,5 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief wrapper for self-contained, single collection transactions
|
/// @brief wrapper for single collection transactions
|
||||||
///
|
///
|
||||||
/// @file
|
/// @file
|
||||||
///
|
///
|
||||||
|
@ -25,8 +25,8 @@
|
||||||
/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany
|
/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef TRIAGENS_UTILS_SELF_CONTAINED_TRANSACTION_H
|
#ifndef TRIAGENS_UTILS_SINGLE_COLLECTION_TRANSACTION_H
|
||||||
#define TRIAGENS_UTILS_SELF_CONTAINED_TRANSACTION_H 1
|
#define TRIAGENS_UTILS_SINGLE_COLLECTION_TRANSACTION_H 1
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
@ -41,10 +41,10 @@ namespace triagens {
|
||||||
namespace arango {
|
namespace arango {
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- class SelfContainedTransaction
|
// --SECTION-- class SingleCollectionTransaction
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
class SelfContainedTransaction : public Transaction {
|
class SingleCollectionTransaction : public Transaction {
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @addtogroup ArangoDB
|
/// @addtogroup ArangoDB
|
||||||
|
@ -64,18 +64,25 @@ namespace triagens {
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief create the transaction, using a collection object
|
/// @brief create the transaction, using a collection object
|
||||||
|
///
|
||||||
|
/// A single collection transaction operates on a single collection (you guessed
|
||||||
|
/// it), and may execute at most one write operation if it is a write
|
||||||
|
/// transaction. It may execute multiple reads, though.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
SelfContainedTransaction (Collection* collection) :
|
SingleCollectionTransaction (Collection* collection,
|
||||||
Transaction(collection->vocbase()),
|
const string& name,
|
||||||
_collection(collection) {
|
const TRI_transaction_type_e type) :
|
||||||
|
Transaction(collection->vocbase(), name),
|
||||||
|
_collection(collection),
|
||||||
|
_type(type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief end the transaction
|
/// @brief end the transaction
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
~SelfContainedTransaction () {
|
~SingleCollectionTransaction () {
|
||||||
if (_trx != 0) {
|
if (_trx != 0) {
|
||||||
if (status() == TRI_TRANSACTION_RUNNING) {
|
if (status() == TRI_TRANSACTION_RUNNING) {
|
||||||
// auto abort
|
// auto abort
|
||||||
|
@ -249,26 +256,13 @@ namespace triagens {
|
||||||
return TRI_ERROR_NO_ERROR;
|
return TRI_ERROR_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @}
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
// --SECTION-- virtual protected functions
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @addtogroup ArangoDB
|
|
||||||
/// @{
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief get the transaction type
|
/// @brief get the transaction type
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
virtual TRI_transaction_type_e type () const = 0;
|
inline TRI_transaction_type_e type () const {
|
||||||
|
return _type;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @}
|
/// @}
|
||||||
|
@ -291,6 +285,12 @@ namespace triagens {
|
||||||
|
|
||||||
Collection* _collection;
|
Collection* _collection;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief transaction type (READ | WRITE)
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
const TRI_transaction_type_e _type;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @}
|
/// @}
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
|
@ -0,0 +1,251 @@
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief wrapper for self-contained, single collection write transactions
|
||||||
|
///
|
||||||
|
/// @file
|
||||||
|
///
|
||||||
|
/// DISCLAIMER
|
||||||
|
///
|
||||||
|
/// Copyright 2004-2012 triAGENS GmbH, Cologne, Germany
|
||||||
|
///
|
||||||
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
/// you may not use this file except in compliance with the License.
|
||||||
|
/// You may obtain a copy of the License at
|
||||||
|
///
|
||||||
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
///
|
||||||
|
/// Unless required by applicable law or agreed to in writing, software
|
||||||
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
/// See the License for the specific language governing permissions and
|
||||||
|
/// limitations under the License.
|
||||||
|
///
|
||||||
|
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||||
|
///
|
||||||
|
/// @author Jan Steemann
|
||||||
|
/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef TRIAGENS_UTILS_SINGLE_COLLECTION_WRITE_TRANSACTION_H
|
||||||
|
#define TRIAGENS_UTILS_SINGLE_COLLECTION_WRITE_TRANSACTION_H 1
|
||||||
|
|
||||||
|
#include "Utils/CollectionWriteLock.h"
|
||||||
|
#include "Utils/SingleCollectionTransaction.h"
|
||||||
|
|
||||||
|
namespace triagens {
|
||||||
|
namespace arango {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- class SingleCollectionWriteTransaction
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
template<uint64_t M>
|
||||||
|
class SingleCollectionWriteTransaction : public SingleCollectionTransaction {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @addtogroup ArangoDB
|
||||||
|
/// @{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- constructors and destructors
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @addtogroup ArangoDB
|
||||||
|
/// @{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief create the transaction, using a collection object
|
||||||
|
///
|
||||||
|
/// A single collection write transaction must at most execute one write operation
|
||||||
|
/// on the underlying collection. Whenever it tries to execute more than one
|
||||||
|
/// write operation, an error is returned. Executing only one operation is
|
||||||
|
/// sufficient for the basic CRUD operations and allows using the transaction
|
||||||
|
/// API even for the single CRUD operations. However, much of the transaction
|
||||||
|
/// overhead can be avoided if the transaction only consists of a single
|
||||||
|
/// operation on a single collection.
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
SingleCollectionWriteTransaction (Collection* collection, const string& name) :
|
||||||
|
SingleCollectionTransaction(collection, name, TRI_TRANSACTION_WRITE),
|
||||||
|
_numWrites(0),
|
||||||
|
_synchronous(false) {
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief end the transaction
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
~SingleCollectionWriteTransaction () {
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @addtogroup ArangoDB
|
||||||
|
/// @{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- public functions
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief return whether the last write in a transaction was synchronous
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
inline bool synchronous () const {
|
||||||
|
return _synchronous;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief create a single document within a transaction
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
int createDocument (TRI_doc_mptr_t** mptr,
|
||||||
|
TRI_json_t const* json,
|
||||||
|
bool forceSync) {
|
||||||
|
|
||||||
|
if (_numWrites++ > M) {
|
||||||
|
return TRI_ERROR_TRANSACTION_INTERNAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
TRI_primary_collection_t* primary = _collection->primary();
|
||||||
|
TRI_doc_operation_context_t context;
|
||||||
|
|
||||||
|
TRI_InitContextPrimaryCollection(&context, primary, TRI_DOC_UPDATE_ERROR, forceSync);
|
||||||
|
_synchronous = context._sync;
|
||||||
|
|
||||||
|
CollectionWriteLock lock(_collection);
|
||||||
|
|
||||||
|
return primary->createJson(&context, TRI_DOC_MARKER_KEY_DOCUMENT, mptr, json, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief create a single edge within a transaction
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
int createEdge (TRI_doc_mptr_t** mptr,
|
||||||
|
TRI_json_t const* json,
|
||||||
|
bool forceSync,
|
||||||
|
void const* data) {
|
||||||
|
if (_numWrites++ > M) {
|
||||||
|
return TRI_ERROR_TRANSACTION_INTERNAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
TRI_primary_collection_t* primary = _collection->primary();
|
||||||
|
TRI_doc_operation_context_t context;
|
||||||
|
|
||||||
|
TRI_InitContextPrimaryCollection(&context, primary, TRI_DOC_UPDATE_ERROR, forceSync);
|
||||||
|
_synchronous = context._sync;
|
||||||
|
|
||||||
|
CollectionWriteLock lock(_collection);
|
||||||
|
|
||||||
|
return primary->createJson(&context, TRI_DOC_MARKER_KEY_EDGE, mptr, json, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief update a single document within a transaction
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
int updateJson (const string& key,
|
||||||
|
TRI_doc_mptr_t** mptr,
|
||||||
|
TRI_json_t* const json,
|
||||||
|
const TRI_doc_update_policy_e policy,
|
||||||
|
bool forceSync,
|
||||||
|
const TRI_voc_rid_t expectedRevision,
|
||||||
|
TRI_voc_rid_t* actualRevision) {
|
||||||
|
if (_numWrites++ > M) {
|
||||||
|
return TRI_ERROR_TRANSACTION_INTERNAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
TRI_primary_collection_t* primary = _collection->primary();
|
||||||
|
TRI_doc_operation_context_t context;
|
||||||
|
|
||||||
|
TRI_InitContextPrimaryCollection(&context, primary, policy, forceSync);
|
||||||
|
context._expectedRid = expectedRevision;
|
||||||
|
context._previousRid = actualRevision;
|
||||||
|
_synchronous = context._sync;
|
||||||
|
|
||||||
|
CollectionWriteLock lock(_collection);
|
||||||
|
|
||||||
|
return primary->updateJson(&context, mptr, json, (TRI_voc_key_t) key.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief delete a single document within a transaction
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
int destroy (const string& key,
|
||||||
|
const TRI_doc_update_policy_e policy,
|
||||||
|
bool forceSync,
|
||||||
|
const TRI_voc_rid_t expectedRevision,
|
||||||
|
TRI_voc_rid_t* actualRevision) {
|
||||||
|
if (_numWrites++ > M) {
|
||||||
|
return TRI_ERROR_TRANSACTION_INTERNAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
TRI_primary_collection_t* primary = _collection->primary();
|
||||||
|
TRI_doc_operation_context_t context;
|
||||||
|
|
||||||
|
TRI_InitContextPrimaryCollection(&context, primary, policy, forceSync);
|
||||||
|
context._expectedRid = expectedRevision;
|
||||||
|
context._previousRid = actualRevision;
|
||||||
|
_synchronous = context._sync;
|
||||||
|
|
||||||
|
CollectionWriteLock lock(_collection);
|
||||||
|
|
||||||
|
return primary->destroy(&context, (TRI_voc_key_t) key.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @addtogroup ArangoDB
|
||||||
|
/// @{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- private variables
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief number of writes the transaction has executed
|
||||||
|
/// the value should be 0 or 1, but not get any higher because values higher
|
||||||
|
/// than one indicate internal errors
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
uint64_t _numWrites;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief whether of not the last write action was executed synchronously
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
bool _synchronous;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Local Variables:
|
||||||
|
// mode: outline-minor
|
||||||
|
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}\\)"
|
||||||
|
// End:
|
|
@ -71,8 +71,10 @@ namespace triagens {
|
||||||
/// @brief create the transaction
|
/// @brief create the transaction
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
Transaction (const TRI_vocbase_t* const vocbase) :
|
Transaction (const TRI_vocbase_t* const vocbase, const string& name) :
|
||||||
_vocbase(vocbase), _trx(0) {
|
_vocbase(vocbase),
|
||||||
|
_name(name),
|
||||||
|
_trx(0) {
|
||||||
assert(_vocbase != 0);
|
assert(_vocbase != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,6 +103,14 @@ namespace triagens {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief return the name of the transaction
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
inline string name () const {
|
||||||
|
return _name;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief get the status of the transaction
|
/// @brief get the status of the transaction
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -183,6 +193,12 @@ namespace triagens {
|
||||||
|
|
||||||
const TRI_vocbase_t* const _vocbase;
|
const TRI_vocbase_t* const _vocbase;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief transaction name
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
string _name;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief the actual transaction
|
/// @brief the actual transaction
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -103,6 +103,7 @@
|
||||||
"ERROR_TRANSACTION_INCOMPLETE" : { "code" : 1650, "message" : "transaction definition is incomplete" },
|
"ERROR_TRANSACTION_INCOMPLETE" : { "code" : 1650, "message" : "transaction definition is incomplete" },
|
||||||
"ERROR_TRANSACTION_INVALID_STATE" : { "code" : 1651, "message" : "invalid transaction state" },
|
"ERROR_TRANSACTION_INVALID_STATE" : { "code" : 1651, "message" : "invalid transaction state" },
|
||||||
"ERROR_TRANSACTION_NESTED" : { "code" : 1652, "message" : "nested write transaction detected" },
|
"ERROR_TRANSACTION_NESTED" : { "code" : 1652, "message" : "nested write transaction detected" },
|
||||||
|
"ERROR_TRANSACTION_INTERNAL" : { "code" : 1653, "message" : "internal transaction error" },
|
||||||
"ERROR_KEYVALUE_INVALID_KEY" : { "code" : 1800, "message" : "invalid key declaration" },
|
"ERROR_KEYVALUE_INVALID_KEY" : { "code" : 1800, "message" : "invalid key declaration" },
|
||||||
"ERROR_KEYVALUE_KEY_EXISTS" : { "code" : 1801, "message" : "key already exists" },
|
"ERROR_KEYVALUE_KEY_EXISTS" : { "code" : 1801, "message" : "key already exists" },
|
||||||
"ERROR_KEYVALUE_KEY_NOT_FOUND" : { "code" : 1802, "message" : "key not found" },
|
"ERROR_KEYVALUE_KEY_NOT_FOUND" : { "code" : 1802, "message" : "key not found" },
|
||||||
|
|
|
@ -143,6 +143,7 @@ ERROR_CURSOR_NOT_FOUND,1600,"cursor not found","Will be raised when a cursor is
|
||||||
ERROR_TRANSACTION_INCOMPLETE,1650,"transaction definition is incomplete","Will be raised when the transaction definition is incomplete (e.g. lacks collections to use)."
|
ERROR_TRANSACTION_INCOMPLETE,1650,"transaction definition is incomplete","Will be raised when the transaction definition is incomplete (e.g. lacks collections to use)."
|
||||||
ERROR_TRANSACTION_INVALID_STATE,1651,"invalid transaction state","Will be raised when an operation is requested on a transaction that has an incompatible state."
|
ERROR_TRANSACTION_INVALID_STATE,1651,"invalid transaction state","Will be raised when an operation is requested on a transaction that has an incompatible state."
|
||||||
ERROR_TRANSACTION_NESTED,1652,"nested write transaction detected","Will be raised when write transactions are nested."
|
ERROR_TRANSACTION_NESTED,1652,"nested write transaction detected","Will be raised when write transactions are nested."
|
||||||
|
ERROR_TRANSACTION_INTERNAL,1653,"internal transaction error","Will be raised when a wrong usage of transactions is detected. this is an internal error and indicates a bug in ArangoDB."
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
## Key value access
|
## Key value access
|
||||||
|
|
|
@ -99,6 +99,7 @@ void TRI_InitialiseErrorMessages (void) {
|
||||||
REG_ERROR(ERROR_TRANSACTION_INCOMPLETE, "transaction definition is incomplete");
|
REG_ERROR(ERROR_TRANSACTION_INCOMPLETE, "transaction definition is incomplete");
|
||||||
REG_ERROR(ERROR_TRANSACTION_INVALID_STATE, "invalid transaction state");
|
REG_ERROR(ERROR_TRANSACTION_INVALID_STATE, "invalid transaction state");
|
||||||
REG_ERROR(ERROR_TRANSACTION_NESTED, "nested write transaction detected");
|
REG_ERROR(ERROR_TRANSACTION_NESTED, "nested write transaction detected");
|
||||||
|
REG_ERROR(ERROR_TRANSACTION_INTERNAL, "internal transaction error");
|
||||||
REG_ERROR(ERROR_KEYVALUE_INVALID_KEY, "invalid key declaration");
|
REG_ERROR(ERROR_KEYVALUE_INVALID_KEY, "invalid key declaration");
|
||||||
REG_ERROR(ERROR_KEYVALUE_KEY_EXISTS, "key already exists");
|
REG_ERROR(ERROR_KEYVALUE_KEY_EXISTS, "key already exists");
|
||||||
REG_ERROR(ERROR_KEYVALUE_KEY_NOT_FOUND, "key not found");
|
REG_ERROR(ERROR_KEYVALUE_KEY_NOT_FOUND, "key not found");
|
||||||
|
|
|
@ -216,6 +216,9 @@ extern "C" {
|
||||||
/// an incompatible state.
|
/// an incompatible state.
|
||||||
/// - 1652: @CODE{nested write transaction detected}
|
/// - 1652: @CODE{nested write transaction detected}
|
||||||
/// Will be raised when write transactions are nested.
|
/// Will be raised when write transactions are nested.
|
||||||
|
/// - 1653: @CODE{internal transaction error}
|
||||||
|
/// Will be raised when a wrong usage of transactions is detected. this is an
|
||||||
|
/// internal error and indicates a bug in ArangoDB.
|
||||||
/// - 1800: @CODE{invalid key declaration}
|
/// - 1800: @CODE{invalid key declaration}
|
||||||
/// Will be raised when an invalid key specification is passed to the server
|
/// Will be raised when an invalid key specification is passed to the server
|
||||||
/// - 1801: @CODE{key already exists}
|
/// - 1801: @CODE{key already exists}
|
||||||
|
@ -1236,6 +1239,17 @@ void TRI_InitialiseErrorMessages (void);
|
||||||
|
|
||||||
#define TRI_ERROR_TRANSACTION_NESTED (1652)
|
#define TRI_ERROR_TRANSACTION_NESTED (1652)
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief 1653: ERROR_TRANSACTION_INTERNAL
|
||||||
|
///
|
||||||
|
/// internal transaction error
|
||||||
|
///
|
||||||
|
/// Will be raised when a wrong usage of transactions is detected. this is an
|
||||||
|
/// internal error and indicates a bug in ArangoDB.
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define TRI_ERROR_TRANSACTION_INTERNAL (1653)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief 1800: ERROR_KEYVALUE_INVALID_KEY
|
/// @brief 1800: ERROR_KEYVALUE_INVALID_KEY
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in New Issue