mdbx++: поддержка вложенных пишущих транзакций.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2024-11-10 01:21:10 +03:00
parent 9da743515c
commit 6f41276dbc

View File

@ -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); }
//------------------------------------------------------------------------------