Associates MDBX transactions with threads.
More...
#include <TransactionTracker.hpp>
|
void | bind_txn (MDBX_txn *txn) |
| Registers a transaction for a specific thread.
|
|
void | unbind_txn () |
| Unregisters a transaction for a specific thread.
|
|
MDBX_txn * | thread_txn () const |
| Retrieves the transaction associated with the current thread.
|
|
virtual | ~TransactionTracker ()=default |
|
|
std::mutex | m_mutex |
| Protects access to m_thread_txns.
|
|
std::unordered_map< std::thread::id, MDBX_txn * > | m_thread_txns |
| Map of thread IDs to transaction pointers.
|
|
Associates MDBX transactions with threads.
Manages a map from thread IDs to MDBX transaction pointers, allowing reuse and cleanup of transactions for specific threads.
Definition at line 16 of file TransactionTracker.hpp.
◆ ~TransactionTracker()
virtual mdbxc::TransactionTracker::~TransactionTracker |
( |
| ) |
|
|
protectedvirtualdefault |
◆ bind_txn()
void mdbxc::TransactionTracker::bind_txn |
( |
MDBX_txn * | txn | ) |
|
|
inlineprotected |
Registers a transaction for a specific thread.
- Parameters
-
txn | Pointer to the MDBX transaction. |
Definition at line 3 of file TransactionTracker.ipp.
◆ thread_txn()
MDBX_txn * mdbxc::TransactionTracker::thread_txn |
( |
| ) |
const |
|
inlineprotected |
Retrieves the transaction associated with the current thread.
- Returns
- Pointer to the MDBX transaction, or nullptr if not found.
Definition at line 13 of file TransactionTracker.ipp.
◆ unbind_txn()
void mdbxc::TransactionTracker::unbind_txn |
( |
| ) |
|
|
inlineprotected |
◆ Transaction
◆ m_mutex
std::mutex mdbxc::TransactionTracker::m_mutex |
|
mutableprivate |
◆ m_thread_txns
std::unordered_map<std::thread::id, MDBX_txn*> mdbxc::TransactionTracker::m_thread_txns |
|
private |
The documentation for this class was generated from the following files: