mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-30 03:24:13 +08:00
mdbx++: поддержка вложенных пишущих транзакций.
This commit is contained in:
parent
9da743515c
commit
6f41276dbc
18
mdbx.h++
18
mdbx.h++
@ -3652,9 +3652,10 @@ public:
|
|||||||
|
|
||||||
/// \brief Operation mode.
|
/// \brief Operation mode.
|
||||||
enum mode {
|
enum mode {
|
||||||
readonly, ///< \copydoc MDBX_RDONLY
|
readonly, ///< \copydoc MDBX_RDONLY
|
||||||
write_file_io, // don't available on OpenBSD
|
write_file_io, // don't available on OpenBSD
|
||||||
write_mapped_io ///< \copydoc MDBX_WRITEMAP
|
write_mapped_io, ///< \copydoc MDBX_WRITEMAP
|
||||||
|
nested_transactions = write_file_io
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief Durability level.
|
/// \brief Durability level.
|
||||||
@ -4197,6 +4198,9 @@ public:
|
|||||||
/// \brief Creates but not start read transaction.
|
/// \brief Creates but not start read transaction.
|
||||||
inline txn_managed prepare_read() const;
|
inline txn_managed prepare_read() const;
|
||||||
|
|
||||||
|
/// \brief Starts write (read-write) transaction.
|
||||||
|
inline txn_managed start_write(txn &parent);
|
||||||
|
|
||||||
/// \brief Starts write (read-write) transaction.
|
/// \brief Starts write (read-write) transaction.
|
||||||
inline txn_managed start_write(bool dont_wait = false);
|
inline txn_managed start_write(bool dont_wait = false);
|
||||||
|
|
||||||
@ -6404,6 +6408,14 @@ inline txn_managed env::start_write(bool dont_wait) {
|
|||||||
return txn_managed(ptr);
|
return txn_managed(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline txn_managed env::start_write(txn &parent) {
|
||||||
|
::MDBX_txn *ptr;
|
||||||
|
error::success_or_throw(
|
||||||
|
::mdbx_txn_begin(handle_, parent, MDBX_TXN_READWRITE, &ptr));
|
||||||
|
assert(ptr != nullptr);
|
||||||
|
return txn_managed(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
inline txn_managed env::try_start_write() { return start_write(true); }
|
inline txn_managed env::try_start_write() { return start_write(true); }
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user