mdbx: rework MDBX_txn.

This commit is contained in:
Leo Yuriev
2017-05-23 21:36:09 +03:00
parent 34213c554a
commit ac8e987346
10 changed files with 262 additions and 261 deletions

View File

@@ -154,7 +154,7 @@ void testcase::txn_begin(bool readonly) {
log_trace(">> txn_begin(%s)", readonly ? "read-only" : "read-write");
assert(!txn_guard);
MDB_txn *txn = nullptr;
MDBX_txn *txn = nullptr;
int rc =
mdbx_txn_begin(db_guard.get(), nullptr, readonly ? MDB_RDONLY : 0, &txn);
if (unlikely(rc != MDB_SUCCESS))
@@ -168,7 +168,7 @@ void testcase::txn_end(bool abort) {
log_trace(">> txn_end(%s)", abort ? "abort" : "commit");
assert(txn_guard);
MDB_txn *txn = txn_guard.release();
MDBX_txn *txn = txn_guard.release();
if (abort) {
int rc = mdbx_txn_abort(txn);
if (unlikely(rc != MDB_SUCCESS))

View File

@@ -58,8 +58,8 @@ struct db_deleter : public std::unary_function<void, MDB_env *> {
void operator()(MDB_env *env) const { mdbx_env_close(env); }
};
struct txn_deleter : public std::unary_function<void, MDB_txn *> {
void operator()(MDB_txn *txn) const {
struct txn_deleter : public std::unary_function<void, MDBX_txn *> {
void operator()(MDBX_txn *txn) const {
int rc = mdbx_txn_abort(txn);
if (rc)
log_trouble(__func__, "mdbx_txn_abort()", rc);
@@ -71,7 +71,7 @@ struct cursor_deleter : public std::unary_function<void, MDB_cursor *> {
};
typedef std::unique_ptr<MDB_env, db_deleter> scoped_db_guard;
typedef std::unique_ptr<MDB_txn, txn_deleter> scoped_txn_guard;
typedef std::unique_ptr<MDBX_txn, txn_deleter> scoped_txn_guard;
typedef std::unique_ptr<MDB_cursor, cursor_deleter> scoped_cursor_guard;
//-----------------------------------------------------------------------------