1
0
Fork 0

Add de/stringifyier for transaction type enum

This commit is contained in:
Willi Goesgens 2014-09-11 17:59:32 +02:00
parent ffbfc9e9e3
commit f97044952e
2 changed files with 24 additions and 0 deletions

View File

@ -64,6 +64,19 @@
/// @brief whether or not a transaction consists of a single operation
////////////////////////////////////////////////////////////////////////////////
TRI_transaction_type_e TRI_GetTransactionTypeFromStr(const char* s) {
if (!strcmp(s, "read")) {
return TRI_TRANSACTION_READ;
}
else if (!strcmp(s, "write")) {
return TRI_TRANSACTION_WRITE;
}
else {
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "invalid transaction type");
}
}
static triagens::wal::LogfileManager* GetLogfileManager () {
return triagens::wal::LogfileManager::instance();
}

View File

@ -177,6 +177,17 @@ TRI_transaction_collection_t;
// -----------------------------------------------------------------------------
// --SECTION-- constructors / destructors
// -----------------------------------------------------------------------------
inline const char* TRI_TransactionTypeGetStr(TRI_transaction_type_e t) {
switch (t) {
case TRI_TRANSACTION_READ:
return "read";
case TRI_TRANSACTION_WRITE:
return "write";
}
return "";
}
TRI_transaction_type_e TRI_GetTransactionTypeFromStr(const char* s);
////////////////////////////////////////////////////////////////////////////////
/// @brief create a new transaction