![]() |
MDBX Containers
|
Template class for managing key-value pairs in an MDBX database. More...
#include <KeyValueTable.hpp>
Classes | |
| class | AssignmentProxy |
| Helper proxy for convenient assignment via operator[]. More... | |
Public Member Functions | |
| KeyValueTable (std::shared_ptr< Connection > connection, std::string name="kv_store", MDBX_db_flags_t flags=MDBX_DB_DEFAULTS|MDBX_CREATE) | |
| Default constructor. | |
| KeyValueTable (const Config &config, std::string name="kv_store", MDBX_db_flags_t flags=MDBX_DB_DEFAULTS|MDBX_CREATE) | |
| Constructor with configuration. | |
| ~KeyValueTable () override final=default | |
| Destructor. | |
| template<template< class... > class ContainerT> | |
| KeyValueTable & | operator= (const ContainerT< KeyT, ValueT > &container) |
| Assigns a container (e.g., std::map or std::unordered_map) to the database. | |
| KeyValueTable & | operator= (const std::vector< std::pair< KeyT, ValueT > > &container) |
| Assigns a vector of key-value pairs to the database. | |
| template<template< class... > class ContainerT = std::map> | |
| std::conditional< std::is_same< ContainerT< KeyT, ValueT >, std::vector< std::pair< KeyT, ValueT > > >::value, std::vector< std::pair< KeyT, ValueT > >, ContainerT< KeyT, ValueT > >::type | operator() () |
| Loads all key-value pairs from the database into a container. | |
| AssignmentProxy | operator[] (const KeyT &key) |
| Provides convenient access to insert or read a value by key. | |
| template<template< class... > class ContainerT> | |
| void | load (ContainerT< KeyT, ValueT > &container, MDBX_txn *txn=nullptr) |
| Loads data from the database into the container. | |
| template<template< class... > class ContainerT> | |
| void | load (ContainerT< KeyT, ValueT > &container, const Transaction &txn) |
| Loads data from the database into the container using provided transaction. | |
| void | load (std::vector< std::pair< KeyT, ValueT > > &container, MDBX_txn *txn=nullptr) |
| Loads all key-value pairs into a std::vector of pairs. | |
| void | load (std::vector< std::pair< KeyT, ValueT > > &container, const Transaction &txn) |
| Loads all key-value pairs into a std::vector of pairs. | |
| template<template< class... > class ContainerT = std::map> | |
| std::conditional< std::is_same< ContainerT< KeyT, ValueT >, std::vector< std::pair< KeyT, ValueT > > >::value, std::vector< std::pair< KeyT, ValueT > >, ContainerT< KeyT, ValueT > >::type | retrieve_all (MDBX_txn *txn=nullptr) |
| Retrieves all key-value pairs into the specified container type. | |
| template<template< class... > class ContainerT = std::map> | |
| std::conditional< std::is_same< ContainerT< KeyT, ValueT >, std::vector< std::pair< KeyT, ValueT > > >::value, std::vector< std::pair< KeyT, ValueT > >, ContainerT< KeyT, ValueT > >::type | retrieve_all (const Transaction &txn) |
| Retrieves all key-value pairs into the specified container type. | |
| template<template< class... > class ContainerT> | |
| void | append (const ContainerT< KeyT, ValueT > &container, MDBX_txn *txn=nullptr) |
| Appends data to the database. | |
| template<template< class... > class ContainerT> | |
| void | append (const ContainerT< KeyT, ValueT > &container, const Transaction &txn) |
| Appends data to the database. | |
| void | append (const std::vector< std::pair< KeyT, ValueT > > &container, MDBX_txn *txn=nullptr) |
| Appends data from a vector to the database. | |
| void | append (const std::vector< std::pair< KeyT, ValueT > > &container, const Transaction &txn) |
| Appends data from a vector to the database using a provided transaction. | |
| template<template< class... > class ContainerT> | |
| void | reconcile (const ContainerT< KeyT, ValueT > &container, MDBX_txn *txn=nullptr) |
| Reconciles the database with the container. | |
| template<template< class... > class ContainerT> | |
| void | reconcile (const ContainerT< KeyT, ValueT > &container, const Transaction &txn) |
| Reconciles the database with the container. | |
| void | reconcile (const std::vector< std::pair< KeyT, ValueT > > &container, MDBX_txn *txn=nullptr) |
| Reconciles the database with the vector of key-value pairs. | |
| void | reconcile (const std::vector< std::pair< KeyT, ValueT > > &container, const Transaction &txn) |
| Reconciles the database with the vector of key-value pairs using provided transaction. | |
| bool | insert (const KeyT &key, const ValueT &value, MDBX_txn *txn=nullptr) |
| Inserts key-value only if key is absent. | |
| bool | insert (const KeyT &key, const ValueT &value, const Transaction &txn) |
| Inserts key-value only if key is absent. | |
| bool | insert (const std::pair< KeyT, ValueT > &pair, MDBX_txn *txn=nullptr) |
| Inserts key-value only if key is absent. | |
| bool | insert (const std::pair< KeyT, ValueT > &pair, const Transaction &txn) |
| Inserts key-value only if key is absent. | |
| void | insert_or_assign (const KeyT &key, const ValueT &value, MDBX_txn *txn=nullptr) |
| Inserts or replaces key-value pair. | |
| void | insert_or_assign (const KeyT &key, const ValueT &value, const Transaction &txn) |
| Inserts or replaces key-value pair. | |
| void | insert_or_assign (const std::pair< KeyT, ValueT > &pair, MDBX_txn *txn=nullptr) |
| Inserts or replaces key-value pair. | |
| void | insert_or_assign (const std::pair< KeyT, ValueT > &pair, const Transaction &txn) |
| Inserts or replaces key-value pair. | |
| ValueT | at (const KeyT &key, MDBX_txn *txn=nullptr) const |
| Retrieves value by key or throws. | |
| ValueT | at (const KeyT &key, const Transaction &txn) const |
| Retrieves value by key or throws. | |
| bool | try_get (const KeyT &key, ValueT &out, MDBX_txn *txn) const |
| Tries to find value by key. | |
| bool | try_get (const KeyT &key, ValueT &out, const Transaction &txn) const |
| Tries to find value by key. | |
| std::pair< bool, ValueT > | find (const KeyT &key, MDBX_txn *txn=nullptr) const |
| Finds value by key. | |
| std::pair< bool, ValueT > | find (const KeyT &key, const Transaction &txn) const |
| Finds value by key. | |
| std::pair< bool, ValueT > | find_compat (const KeyT &key, MDBX_txn *txn=nullptr) const |
| Finds value by key. | |
| std::pair< bool, ValueT > | find_compat (const KeyT &key, const Transaction &txn) const |
| Finds value by key. | |
| bool | contains (const KeyT &key, MDBX_txn *txn=nullptr) const |
| Checks whether a key exists in the database. | |
| bool | contains (const KeyT &key, const Transaction &txn) const |
| Checks whether a key exists in the database. | |
| std::size_t | count (MDBX_txn *txn=nullptr) const |
| Returns the number of elements in the database. | |
| std::size_t | count (const Transaction &txn) const |
| Returns the number of elements in the database. | |
| bool | empty (MDBX_txn *txn=nullptr) const |
| Checks if the database is empty. | |
| bool | empty (const Transaction &txn) const |
| Checks if the database is empty. | |
| bool | erase (const KeyT &key, MDBX_txn *txn=nullptr) |
| Removes key from DB. | |
| bool | erase (const KeyT &key, const Transaction &txn) |
| Removes key from DB. | |
| void | clear (MDBX_txn *txn=nullptr) |
| Clears all key-value pairs from the database. | |
| void | clear (const Transaction &txn) |
| Clears all key-value pairs from the database. | |
Public Member Functions inherited from mdbxc::BaseTable | |
| BaseTable (std::shared_ptr< Connection > connection, std::string name, MDBX_db_flags_t flags) | |
| Construct the database table accessor. | |
| virtual | ~BaseTable ()=default |
| bool | is_connected () const |
| Checks if the connection is currently active. | |
| void | connect () |
| Connects to the MDBX environment if not already connected. | |
| void | disconnect () |
| Disconnects the MDBX environment. | |
| void | begin (TransactionMode mode=TransactionMode::WRITABLE) |
| Begins a manual transaction (must be committed or rolled back later). | |
| void | commit () |
| Commits the current manual transaction. | |
| void | rollback () |
| Rolls back the current manual transaction. | |
| template<typename Func> | |
| void | execute_in_transaction (Func operation, TransactionMode mode=TransactionMode::WRITABLE) |
| Executes an operation inside an automatic transaction. | |
Private Member Functions | |
| template<typename F> | |
| void | with_transaction (F &&action, TransactionMode mode=TransactionMode::WRITABLE, MDBX_txn *txn=nullptr) const |
| Executes a functor within a transaction context. | |
| template<template< class... > class ContainerT> | |
| void | db_load (ContainerT< KeyT, ValueT > &container, MDBX_txn *txn_handle) |
| Loads data from the database into the container. | |
| void | db_load (std::vector< std::pair< KeyT, ValueT > > &out_vector, MDBX_txn *txn) |
| Loads all key-value pairs into a std::vector of pairs. | |
| bool | db_get (const KeyT &key, ValueT &value, MDBX_txn *txn_handle) const |
| Gets a value by key from the database. | |
| bool | db_contains (const KeyT &key, MDBX_txn *txn_handle) const |
| Checks whether a key exists in the database. | |
| std::size_t | db_count (MDBX_txn *txn_handle) const |
| Returns the number of elements in the database. | |
| template<template< class... > class ContainerT> | |
| void | db_append (const ContainerT< KeyT, ValueT > &container, MDBX_txn *txn_handle) |
| Appends the content of the container to the database. | |
| void | db_append (const std::vector< std::pair< KeyT, ValueT > > &container, MDBX_txn *txn_handle) |
| Appends the content of the vector to the database. | |
| template<template< class... > class ContainerT> | |
| void | db_reconcile (const ContainerT< KeyT, ValueT > &container, MDBX_txn *txn_handle) |
| Reconciles the content of the database with the container. | |
| void | db_reconcile (const std::vector< std::pair< KeyT, ValueT > > &container, MDBX_txn *txn_handle) |
| Reconciles the content of the database with the given vector of key-value pairs. | |
| bool | db_insert_if_absent (const KeyT &key, const ValueT &value, MDBX_txn *txn_handle) |
| Inserts a key-value pair only if the key does not already exist. | |
| void | db_insert_or_assign (const KeyT &key, const ValueT &value, MDBX_txn *txn_handle) |
| Inserts or replaces the key-value pair. | |
| bool | db_erase (const KeyT &key, MDBX_txn *txn_handle) |
| Removes a key from the database. | |
| void | db_clear (MDBX_txn *txn_handle) |
| Clears all key-value pairs from the database. | |
Additional Inherited Members | |
Protected Member Functions inherited from mdbxc::BaseTable | |
| MDBX_txn * | thread_txn () const |
| Returns the transaction bound to the current thread, if any. | |
| MDBX_dbi | handle () const |
| Gets the raw DBI handle. | |
Protected Attributes inherited from mdbxc::BaseTable | |
| std::shared_ptr< Connection > | m_connection |
| Shared connection to MDBX environment. | |
| MDBX_dbi | m_dbi {} |
| DBI handle for the opened table. | |
Template class for managing key-value pairs in an MDBX database.
| KeyT | Type of the keys. |
| ValueT | Type of the values. |
This class provides functionality to store, retrieve, and manipulate key-value pairs in an MDBX database. It supports various container types, such as std::map, std::unordered_map, std::vector, and std::list. Key-value pairs can be inserted, reconciled, retrieved, and removed with transaction support. The class includes methods for bulk loading and appending data with transactional integrity, ensuring that operations are safely executed in a database environment. Additionally, temporary tables are used during reconciliation to ensure consistent data synchronization. This class also provides methods for checking the count and emptiness of the database, and efficiently handles database errors with detailed exception handling.
Definition at line 27 of file KeyValueTable.hpp.
|
inline |
Default constructor.
| connection | Existing Connection instance. |
| name | Name of the table within the MDBX environment. |
| flags | Additional MDBX database flags. |
Definition at line 34 of file KeyValueTable.hpp.
|
inlineexplicit |
Constructor with configuration.
| config | Configuration settings for the database. |
| name | Name of the table within the MDBX environment. |
| flags | Additional MDBX database flags. |
Definition at line 45 of file KeyValueTable.hpp.
|
finaloverridedefault |
Destructor.
|
inline |
Appends data to the database.
| ContainerT | Container type (e.g., std::map or std::unordered_map). |
| container | Container with content to be synchronized. |
| txn | Optional transaction handle. |
| MdbxException | if a database error occurs. |
Definition at line 289 of file KeyValueTable.hpp.
|
inline |
Appends data to the database.
| ContainerT | Container type (e.g., std::map or std::unordered_map). |
| container | Container with content to be synchronized. |
| txn | Active MDBX transaction. |
| MdbxException | if a database error occurs. |
Definition at line 277 of file KeyValueTable.hpp.
|
inline |
Appends data from a vector to the database using a provided transaction.
| container | Vector with content to be synchronized. |
| txn | Transaction wrapper. |
| MdbxException | if a database error occurs. |
Definition at line 308 of file KeyValueTable.hpp.
|
inline |
Appends data from a vector to the database.
| container | Vector with content to be synchronized. |
| txn | Active MDBX transaction. |
| MdbxException | if a database error occurs. |
Definition at line 298 of file KeyValueTable.hpp.
|
inline |
Retrieves value by key or throws.
| key | The key to look up. |
| txn | Transaction wrapper used for the lookup. |
| std::out_of_range | if key not found. |
| MdbxException | if DB error occurs. |
Definition at line 458 of file KeyValueTable.hpp.
|
inline |
Retrieves value by key or throws.
| key | The key to look up. |
| txn | Active MDBX transaction. |
| std::out_of_range | if key not found. |
| MdbxException | if DB error occurs. |
Definition at line 442 of file KeyValueTable.hpp.
|
inline |
Clears all key-value pairs from the database.
| txn | Transaction wrapper used for the operation. |
| MdbxException | if a database error occurs. |
Definition at line 657 of file KeyValueTable.hpp.
|
inline |
Clears all key-value pairs from the database.
| txn | Active transaction. |
| MdbxException | if a database error occurs. |
Definition at line 648 of file KeyValueTable.hpp.
|
inline |
Checks whether a key exists in the database.
| key | The key to look up. |
| txn | Transaction wrapper used for the lookup. |
| MdbxException | if DB error occurs. |
Definition at line 579 of file KeyValueTable.hpp.
|
inline |
Checks whether a key exists in the database.
| key | The key to look up. |
| txn | Active transaction. |
| MdbxException | if DB error occurs. |
Definition at line 566 of file KeyValueTable.hpp.
|
inline |
Returns the number of elements in the database.
| txn | Transaction wrapper used for the count operation. |
| MdbxException | if DB error occurs. |
Definition at line 599 of file KeyValueTable.hpp.
|
inline |
Returns the number of elements in the database.
| txn | Active transaction. |
| MdbxException | if DB error occurs. |
Definition at line 587 of file KeyValueTable.hpp.
|
inlineprivate |
Appends the content of the container to the database.
| ContainerT | Template for the container type (map or unordered_map). |
| container | Container with content to append. |
| txn_handle | Active transaction handle. |
| MdbxException | if a database error occurs. |
Definition at line 781 of file KeyValueTable.hpp.
|
inlineprivate |
Appends the content of the vector to the database.
| container | Vector with key-value pairs to append. |
| txn_handle | Active transaction handle. |
| MdbxException | if a database error occurs. |
Definition at line 799 of file KeyValueTable.hpp.
|
inlineprivate |
Clears all key-value pairs from the database.
| MdbxException | if an MDBX error occurs. |
Definition at line 961 of file KeyValueTable.hpp.
|
inlineprivate |
Checks whether a key exists in the database.
| key | The key to check. |
| txn_handle | The active transaction. |
| MdbxException | if a database error occurs. |
Definition at line 755 of file KeyValueTable.hpp.
|
inlineprivate |
Returns the number of elements in the database.
| txn_handle | Active transaction handle. |
| MdbxException | if a database error occurs. |
Definition at line 769 of file KeyValueTable.hpp.
|
inlineprivate |
Removes a key from the database.
| key | The key of the pair to be removed. |
| txn_handle | The active MDBX transaction. |
| MdbxException | if deletion fails for other reasons. |
Definition at line 949 of file KeyValueTable.hpp.
|
inlineprivate |
Gets a value by key from the database.
| key | The key to search for. |
| value | Reference to store the retrieved value. |
| txn_handle | The active transaction. |
| MdbxException | if a database error occurs. |
Definition at line 739 of file KeyValueTable.hpp.
|
inlineprivate |
Inserts a key-value pair only if the key does not already exist.
| key | The key to insert. |
| value | The value to insert. |
| txn_handle | The active MDBX transaction. |
| MdbxException | if the insert fails for reasons other than key existence. |
Definition at line 912 of file KeyValueTable.hpp.
|
inlineprivate |
Inserts or replaces the key-value pair.
| key | The key to insert or replace. |
| value | The value to set. |
| txn_handle | The active MDBX transaction. |
| MdbxException | if the operation fails. |
Definition at line 933 of file KeyValueTable.hpp.
|
inlineprivate |
Loads data from the database into the container.
| ContainerT | Template for the container type. |
| container | Container to be synchronized with database content. |
| txn_handle | Active transaction handle. |
| MdbxException | if a database error occurs. |
Definition at line 701 of file KeyValueTable.hpp.
|
inlineprivate |
Loads all key-value pairs into a std::vector of pairs.
| out_vector | The output vector to fill. |
| txn | Optional transaction. |
| MdbxException | if a database error occurs. |
Definition at line 719 of file KeyValueTable.hpp.
|
inlineprivate |
Reconciles the content of the database with the container.
Synchronizes the main table with the content of the container by using a temporary table. Clears old data, inserts new data, and updates existing records in the main table.
| ContainerT | Template for the container type (map or unordered_map). |
| container | Container with key-value pairs to be reconciled with the database. |
| txn_handle | Active MDBX transaction. |
| MdbxException | if a database error occurs. |
Definition at line 835 of file KeyValueTable.hpp.
|
inlineprivate |
Reconciles the content of the database with the given vector of key-value pairs.
Clears existing records not present in the vector, and upserts all from the vector.
| container | Vector of key-value pairs to reconcile with the database. |
| txn_handle | Active MDBX transaction. |
| MdbxException | if a database error occurs. |
Definition at line 871 of file KeyValueTable.hpp.
|
inline |
Checks if the database is empty.
| txn | Transaction wrapper used for the check. |
| MdbxException | if a database error occurs. |
Definition at line 619 of file KeyValueTable.hpp.
|
inline |
Checks if the database is empty.
| txn | Optional transaction handle. |
| MdbxException | if a database error occurs. |
Definition at line 607 of file KeyValueTable.hpp.
|
inline |
Removes key from DB.
| key | The key of the pair to be removed. |
| txn | Transaction wrapper used for the operation. |
| MdbxException | if deletion fails. |
Definition at line 641 of file KeyValueTable.hpp.
|
inline |
Removes key from DB.
| key | The key of the pair to be removed. |
| txn | Active transaction. |
| MdbxException | if deletion fails. |
Definition at line 628 of file KeyValueTable.hpp.
|
inline |
Finds value by key.
| key | Key to search for. |
| txn | Transaction wrapper used for the lookup. |
| MdbxException | on DB error. |
Definition at line 532 of file KeyValueTable.hpp.
|
inline |
Finds value by key.
| key | Key to search for. |
| txn | Optional active MDBX transaction. |
| MdbxException | on DB error. |
Definition at line 517 of file KeyValueTable.hpp.
|
inline |
Finds value by key.
| key | Key to search for. |
| txn | Transaction wrapper used for the lookup. |
| MdbxException | on DB error. |
Definition at line 557 of file KeyValueTable.hpp.
|
inline |
Finds value by key.
| key | Key to search for. |
| txn | Optional active MDBX transaction. |
| MdbxException | on DB error. |
Definition at line 542 of file KeyValueTable.hpp.
|
inline |
Inserts key-value only if key is absent.
| key | The key to be inserted. |
| value | The value to be inserted. |
| txn | Transaction wrapper used for the insertion. |
true if the pair was inserted, false when the key already exists. | MdbxException | if a database error occurs. |
Definition at line 372 of file KeyValueTable.hpp.
|
inline |
Inserts key-value only if key is absent.
| key | The key to be inserted. |
| value | The value to be inserted. |
| txn | Active MDBX transaction. |
true if the pair was inserted, false when the key already exists. | MdbxException | if a database error occurs. |
Definition at line 358 of file KeyValueTable.hpp.
|
inline |
Inserts key-value only if key is absent.
| pair | The key-value pair to be inserted. |
| txn | Transaction wrapper used for the operation. |
true if the pair was inserted, false when the key already exists. | MdbxException | if a database error occurs. |
Definition at line 394 of file KeyValueTable.hpp.
|
inline |
Inserts key-value only if key is absent.
| pair | The key-value pair to be inserted. |
| txn | Active MDBX transaction. |
true if the pair was inserted, false when the key already exists. | MdbxException | if a database error occurs. |
Definition at line 381 of file KeyValueTable.hpp.
|
inline |
Inserts or replaces key-value pair.
| key | The key to be inserted. |
| value | The value to be inserted. |
| txn | Transaction wrapper used for the operation. |
| MdbxException | if a database error occurs. |
Definition at line 414 of file KeyValueTable.hpp.
|
inline |
Inserts or replaces key-value pair.
| key | The key to be inserted. |
| value | The value to be inserted. |
| txn | Active MDBX transaction. |
| MdbxException | if a database error occurs. |
Definition at line 403 of file KeyValueTable.hpp.
|
inline |
Inserts or replaces key-value pair.
| pair | The key-value pair to be inserted. |
| txn | Transaction wrapper used for the operation. |
| MdbxException | if a database error occurs. |
Definition at line 432 of file KeyValueTable.hpp.
|
inline |
Inserts or replaces key-value pair.
| pair | The key-value pair to be inserted. |
| txn | Active MDBX transaction. |
| MdbxException | if a database error occurs. |
Definition at line 422 of file KeyValueTable.hpp.
|
inline |
Loads data from the database into the container using provided transaction.
| ContainerT | Container type (e.g., std::map or std::unordered_map). |
| container | Container to be synchronized with database content. |
| txn | Transaction wrapper used for the operation. |
| MdbxException | if a database error occurs. |
Definition at line 185 of file KeyValueTable.hpp.
|
inline |
Loads data from the database into the container.
| ContainerT | Container type (e.g., std::map or std::unordered_map). |
| container | Container to be synchronized with database content. |
| txn | Active MDBX transaction. |
| MdbxException | if a database error occurs. |
Definition at line 173 of file KeyValueTable.hpp.
|
inline |
Loads all key-value pairs into a std::vector of pairs.
| container | Container to be synchronized with database content. |
| txn | Transaction wrapper used for the operation. |
| MdbxException | if a database error occurs. |
Definition at line 203 of file KeyValueTable.hpp.
|
inline |
Loads all key-value pairs into a std::vector of pairs.
| container | Container to be synchronized with database content. |
| txn | Transaction wrapper used for the operation. |
| MdbxException | if a database error occurs. |
Definition at line 193 of file KeyValueTable.hpp.
|
inline |
Loads all key-value pairs from the database into a container.
| ContainerT | Container type (e.g., std::map, std::unordered_map, std::vector). |
| MdbxException | if a database error occurs. |
Definition at line 106 of file KeyValueTable.hpp.
|
inline |
Assigns a container (e.g., std::map or std::unordered_map) to the database.
| container | The container with key-value pairs. |
| MdbxException | if a database error occurs. |
Definition at line 63 of file KeyValueTable.hpp.
|
inline |
Assigns a vector of key-value pairs to the database.
| container | The vector with key-value pairs. |
| MdbxException | if a database error occurs. |
Definition at line 75 of file KeyValueTable.hpp.
|
inline |
Provides convenient access to insert or read a value by key.
| key | Key to access. |
Definition at line 161 of file KeyValueTable.hpp.
|
inline |
Reconciles the database with the container.
| ContainerT | Container type (e.g., std::map or std::unordered_map). |
| container | Container to be reconciled with the database. |
| txn | Transaction wrapper used for the operation. |
| MdbxException | if a database error occurs. |
Definition at line 330 of file KeyValueTable.hpp.
|
inline |
Reconciles the database with the container.
| ContainerT | Container type (e.g., std::map or std::unordered_map). |
| container | Container to be reconciled with the database. |
| txn | Active MDBX transaction. |
| MdbxException | if a database error occurs. |
Definition at line 318 of file KeyValueTable.hpp.
|
inline |
Reconciles the database with the vector of key-value pairs using provided transaction.
| container | Vector to be reconciled with the database. |
| txn | Transaction wrapper. |
| MdbxException | if a database error occurs. |
Definition at line 348 of file KeyValueTable.hpp.
|
inline |
Reconciles the database with the vector of key-value pairs.
| container | Vector to be reconciled with the database. |
| txn | Active MDBX transaction. |
| MdbxException | if a database error occurs. |
Definition at line 338 of file KeyValueTable.hpp.
|
inline |
Retrieves all key-value pairs into the specified container type.
| ContainerT | Container type (e.g., std::map, std::unordered_map, std::vector). |
| txn | Transaction wrapper used for the retrieval. |
| MdbxException | if a database error occurs. |
Definition at line 266 of file KeyValueTable.hpp.
|
inline |
Retrieves all key-value pairs into the specified container type.
| ContainerT | Container type (e.g., std::map, std::unordered_map, std::vector). |
| txn | Optional transaction handle. |
| MdbxException | if a database error occurs. |
Definition at line 242 of file KeyValueTable.hpp.
|
inline |
Tries to find value by key.
| key | The key to look up. |
| out | Reference to output value. |
| txn | Transaction wrapper used for the lookup. |
| MdbxException | if DB error occurs. |
Definition at line 482 of file KeyValueTable.hpp.
|
inline |
Tries to find value by key.
| key | The key to look up. |
| out | Reference to output value. |
| txn | Active MDBX transaction. |
| MdbxException | if DB error occurs. |
Definition at line 468 of file KeyValueTable.hpp.
|
inlineprivate |
Executes a functor within a transaction context.
| F | Callable type accepting MDBX_txn*. |
| action | Functor to execute. |
| mode | Transaction mode used when a new transaction is created. |
| txn | Optional existing transaction handle. |
Definition at line 669 of file KeyValueTable.hpp.