libmdbx  0.11.6.39 (2022-04-13T11:05:50+03:00)
One of the fastest compact embeddable key-value ACID database without WAL.
mdbx::txn_managed Class Reference

Managed database transaction. More...

#include <mdbx.h++>

Inherits mdbx::txn.

Public Member Functions

MDBX_CXX11_CONSTEXPR txn_managed () noexcept=default
 
 txn_managed (txn_managed &&)=default
 
txn_managedoperator= (txn_managed &&other)
 
 txn_managed (const txn_managed &)=delete
 
txn_managedoperator= (const txn_managed &)=delete
 
 ~txn_managed () noexcept
 
void abort ()
 Abandon all the operations of the transaction instead of saving them. More...
 
void commit ()
 Commit all the operations of a transaction into the database. More...
 
- Public Member Functions inherited from mdbx::txn
MDBX_CXX11_CONSTEXPR txn () noexcept=default
 
 txn (const txn &) noexcept=default
 
txnoperator= (txn &&other) noexcept
 
 txn (txn &&other) noexcept
 
 ~txn () noexcept
 
MDBX_CXX14_CONSTEXPR operator bool () const noexcept
 
MDBX_CXX14_CONSTEXPR operator const MDBX_txn * () const
 
MDBX_CXX14_CONSTEXPR operator MDBX_txn * ()
 
inline ::mdbx::env env () const noexcept
 Returns the transaction's environment. More...
 
MDBX_txn_flags_t flags () const
 Returns transaction's flags. More...
 
uint64_t id () const
 Return the transaction's ID. More...
 
bool is_dirty (const void *ptr) const
 Checks whether the given data is on a dirty page. More...
 
bool is_readonly () const
 Checks whether the transaction is read-only. More...
 
bool is_readwrite () const
 Checks whether the transaction is read-write. More...
 
info get_info (bool scan_reader_lock_table=false) const
 Returns information about the MDBX transaction. More...
 
size_t size_max () const
 Returns maximal write transaction size (i.e. limit for summary volume of dirty pages) in bytes. More...
 
size_t size_current () const
 Returns current write transaction size (i.e.summary volume of dirty pages) in bytes. More...
 
void reset_reading ()
 Reset a read-only transaction. More...
 
void renew_reading ()
 Renew a read-only transaction. More...
 
txn_managed start_nested ()
 Start nested write transaction. More...
 
cursor_managed open_cursor (map_handle map)
 Opens cursor for specified key-value map handle. More...
 
map_handle open_map (const char *name, const ::mdbx::key_mode key_mode=::mdbx::key_mode::usual, const ::mdbx::value_mode value_mode=::mdbx::value_mode::single) const
 Open existing key-value map. More...
 
map_handle open_map (const ::std::string &name, const ::mdbx::key_mode key_mode=::mdbx::key_mode::usual, const ::mdbx::value_mode value_mode=::mdbx::value_mode::single) const
 Open existing key-value map. More...
 
map_handle create_map (const char *name, const ::mdbx::key_mode key_mode=::mdbx::key_mode::usual, const ::mdbx::value_mode value_mode=::mdbx::value_mode::single)
 Create new or open existing key-value map. More...
 
map_handle create_map (const ::std::string &name, const ::mdbx::key_mode key_mode=::mdbx::key_mode::usual, const ::mdbx::value_mode value_mode=::mdbx::value_mode::single)
 Create new or open existing key-value map. More...
 
void drop_map (map_handle map)
 Drops key-value map using handle. More...
 
bool drop_map (const char *name, bool throw_if_absent=false)
 Drops key-value map using name. More...
 
bool drop_map (const ::std::string &name, bool throw_if_absent=false)
 Drop key-value map. More...
 
void clear_map (map_handle map)
 Clear key-value map. More...
 
bool clear_map (const char *name, bool throw_if_absent=false)
 
bool clear_map (const ::std::string &name, bool throw_if_absent=false)
 
map_stat get_map_stat (map_handle map) const
 Returns statistics for a sub-database. More...
 
uint32_t get_tree_deepmask (map_handle map) const
 Returns depth (bitmask) information of nested dupsort (multi-value) B+trees for given database. More...
 
map_handle::info get_handle_info (map_handle map) const
 Returns information about key-value map (aka sub-database) handle. More...
 
txnput_canary (const canary &)
 Set integers markers (aka "canary") associated with the environment. More...
 
canary get_canary () const
 Returns fours integers markers (aka "canary") associated with the environment. More...
 
uint64_t sequence (map_handle map) const
 
uint64_t sequence (map_handle map, uint64_t increment)
 Reads and increment sequence generator associated with a key-value map (aka sub-database). More...
 
int compare_keys (map_handle map, const slice &a, const slice &b) const noexcept
 Compare two keys according to a particular key-value map (aka sub-database). More...
 
int compare_values (map_handle map, const slice &a, const slice &b) const noexcept
 Compare two values according to a particular key-value map (aka sub-database). More...
 
int compare_keys (map_handle map, const pair &a, const pair &b) const noexcept
 Compare keys of two pairs according to a particular key-value map (aka sub-database). More...
 
int compare_values (map_handle map, const pair &a, const pair &b) const noexcept
 Compare values of two pairs according to a particular key-value map (aka sub-database). More...
 
slice get (map_handle map, const slice &key) const
 Get value by key from a key-value map (aka sub-database). More...
 
slice get (map_handle map, slice key, size_t &values_count) const
 Get first of multi-value and values count by key from a key-value multimap (aka sub-database). More...
 
slice get (map_handle map, const slice &key, const slice &value_at_absence) const
 Get value by key from a key-value map (aka sub-database). More...
 
slice get (map_handle map, slice key, size_t &values_count, const slice &value_at_absence) const
 Get first of multi-value and values count by key from a key-value multimap (aka sub-database). More...
 
pair_result get_equal_or_great (map_handle map, const slice &key) const
 Get value for equal or great key from a database. More...
 
pair_result get_equal_or_great (map_handle map, const slice &key, const slice &value_at_absence) const
 Get value for equal or great key from a database. More...
 
MDBX_error_t put (map_handle map, const slice &key, slice *value, MDBX_put_flags_t flags) noexcept
 
void put (map_handle map, const slice &key, slice value, put_mode mode)
 
void insert (map_handle map, const slice &key, slice value)
 
value_result try_insert (map_handle map, const slice &key, slice value)
 
slice insert_reserve (map_handle map, const slice &key, size_t value_length)
 
value_result try_insert_reserve (map_handle map, const slice &key, size_t value_length)
 
void upsert (map_handle map, const slice &key, const slice &value)
 
slice upsert_reserve (map_handle map, const slice &key, size_t value_length)
 
void update (map_handle map, const slice &key, const slice &value)
 
bool try_update (map_handle map, const slice &key, const slice &value)
 
slice update_reserve (map_handle map, const slice &key, size_t value_length)
 
value_result try_update_reserve (map_handle map, const slice &key, size_t value_length)
 
bool erase (map_handle map, const slice &key)
 Removes all values for given key. More...
 
bool erase (map_handle map, const slice &key, const slice &value)
 Removes the particular multi-value entry of the key. More...
 
void replace (map_handle map, const slice &key, slice old_value, const slice &new_value)
 Replaces the particular multi-value of the key with a new value. More...
 
template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer< ALLOCATOR, CAPACITY_POLICY > extract (map_handle map, const slice &key, const typename buffer< ALLOCATOR, CAPACITY_POLICY >::allocator_type &allocator=buffer< ALLOCATOR, CAPACITY_POLICY >::allocator_type())
 Removes and return a value of the key. More...
 
template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer< ALLOCATOR, CAPACITY_POLICY > replace (map_handle map, const slice &key, const slice &new_value, const typename buffer< ALLOCATOR, CAPACITY_POLICY >::allocator_type &allocator=buffer< ALLOCATOR, CAPACITY_POLICY >::allocator_type())
 Replaces and returns a value of the key with new one. More...
 
template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer< ALLOCATOR, CAPACITY_POLICY > replace_reserve (map_handle map, const slice &key, slice &new_value, const typename buffer< ALLOCATOR, CAPACITY_POLICY >::allocator_type &allocator=buffer< ALLOCATOR, CAPACITY_POLICY >::allocator_type())
 
void append (map_handle map, const slice &key, const slice &value, bool multivalue_order_preserved=true)
 Adding a key-value pair, provided that ascending order of the keys and (optionally) values are preserved. More...
 
size_t put_multiple (map_handle map, const slice &key, const size_t value_length, const void *values_array, size_t values_count, put_mode mode, bool allow_partial=false)
 
template<typename VALUE >
void put_multiple (map_handle map, const slice &key, const ::std::vector< VALUE > &vector, put_mode mode)
 
ptrdiff_t estimate (map_handle map, pair from, pair to) const
 
ptrdiff_t estimate (map_handle map, slice from, slice to) const
 
ptrdiff_t estimate_from_first (map_handle map, slice to) const
 
ptrdiff_t estimate_to_last (map_handle map, slice from) const
 

Friends

class env
 
class txn
 

Additional Inherited Members

- Public Types inherited from mdbx::txn
using info = ::MDBX_txn_info
 
using map_stat = ::MDBX_stat
 
using canary = ::MDBX_canary
 
- Protected Member Functions inherited from mdbx::txn
MDBX_CXX11_CONSTEXPR txn (MDBX_txn *ptr) noexcept
 
- Protected Attributes inherited from mdbx::txn
MDBX_txnhandle_ {nullptr}
 

Detailed Description

Managed database transaction.

As other managed classes, txn_managed destroys the represented underlying object from the own class destructor, but disallows copying and assignment for instances.

All database operations require a transaction handle. Transactions may be read-only or read-write.

Constructor & Destructor Documentation

◆ txn_managed() [1/3]

MDBX_CXX11_CONSTEXPR mdbx::txn_managed::txn_managed ( )
defaultnoexcept

◆ txn_managed() [2/3]

mdbx::txn_managed::txn_managed ( txn_managed &&  )
default

◆ txn_managed() [3/3]

mdbx::txn_managed::txn_managed ( const txn_managed )
delete

◆ ~txn_managed()

mdbx::txn_managed::~txn_managed ( )
noexcept

Member Function Documentation

◆ abort()

void mdbx::txn_managed::abort ( )

Abandon all the operations of the transaction instead of saving them.

◆ commit()

void mdbx::txn_managed::commit ( )

Commit all the operations of a transaction into the database.

◆ operator=() [1/2]

txn_managed& mdbx::txn_managed::operator= ( const txn_managed )
delete

◆ operator=() [2/2]

txn_managed& mdbx::txn_managed::operator= ( txn_managed &&  other)
inline

Friends And Related Function Documentation

◆ env

friend class env
friend

◆ txn

friend class txn
friend

The documentation for this class was generated from the following file: