mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-28 03:08:49 +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.
|
||||
enum mode {
|
||||
readonly, ///< \copydoc MDBX_RDONLY
|
||||
write_file_io, // don't available on OpenBSD
|
||||
write_mapped_io ///< \copydoc MDBX_WRITEMAP
|
||||
readonly, ///< \copydoc MDBX_RDONLY
|
||||
write_file_io, // don't available on OpenBSD
|
||||
write_mapped_io, ///< \copydoc MDBX_WRITEMAP
|
||||
nested_transactions = write_file_io
|
||||
};
|
||||
|
||||
/// \brief Durability level.
|
||||
@ -4197,6 +4198,9 @@ public:
|
||||
/// \brief Creates but not start read transaction.
|
||||
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.
|
||||
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);
|
||||
}
|
||||
|
||||
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); }
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user