Skip to content

Class mdbx::txn

ClassList > mdbx > txn

Unmanaged database transaction. More...

  • #include <mdbx.h++>

Inherited by the following classes: mdbx::txn_managed

Public Types

Type Name
typedef ::MDBX_cache_result_t cache_result
typedef ::MDBX_cache_status_t cache_status
typedef ::MDBX_canary canary
typedef ::MDBX_gc_info_t gc_info
typedef ::MDBX_txn_info info
typedef ::MDBX_stat map_stat

Public Functions

Type Name
void append (map_handle map, const pair & kv, bool multivalue_order_preserved=true)
bool clear_map (const char * name, bool throw_if_absent=false)
bool clear_map (const slice & name, bool throw_if_absent=false)
bool clear_map (const ::std::string_view & name, bool throw_if_absent=false)
size_t close_all_cursors () const
Close all cursors.
void copy (const wchar_t * destination, bool compactify, bool force_dynamic_size=false)
Copy an MVCC-snapshot of the database to the destination path.
void copy (const ::std::wstring & destination, bool compactify, bool force_dynamic_size=false)
Copy an MVCC-snapshot of the database to the destination path.
map_handle create_map (const ::std::string_view & 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.
bool drop_map (const char * name, bool throw_if_absent=false)
Drops key-value map using name.
bool drop_map (const slice & name, bool throw_if_absent=false)
Drop key-value map.
bool drop_map (const ::std::string_view & name, bool throw_if_absent=false)
Drop key-value map.
const MDBX_txn * handle () noexcept const
MDBX_txn * handle () noexcept
void insert (map_handle map, const pair & kv)
bool is_dirty (const slice & item) const
Checks whether the given slice is on a dirty page.
bool is_readonly () const
Checks whether the transaction is read-only.
bool is_readwrite () const
Checks whether the transaction is read-write.
map_handle open_map (const ::std::string_view & 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.
map_handle open_map_accede (const ::std::string_view & name) const
Open existing key-value map.
constexpr operator MDBX_txn * () noexcept
constexpr operator const MDBX_txn * () noexcept const
txn & operator= (const txn &) noexcept
void put (map_handle map, const pair & kv, put_mode mode)
size_t put_multiple_samelength (map_handle map, const slice & key, const VALUE * values_array, size_t values_count, put_mode mode, bool allow_partial=false)
void put_multiple_samelength (map_handle map, const slice & key, const ::std::vector< VALUE > & vector, put_mode mode)
bool rename_map (const char * old_name, const char * new_name, bool throw_if_absent=false)
Переименовывает таблицу ключ-значение.
bool rename_map (const ::std::string & old_name, const ::std::string & new_name, bool throw_if_absent=false)
Переименовывает таблицу ключ-значение.
bool rename_map (const slice & old_name, const slice & new_name, bool throw_if_absent=false)
Переименовывает таблицу ключ-значение.
void rename_map (map_handle map, const ::std::string_view & new_name)
Переименовывает таблицу ключ-значение.
bool rename_map (const ::std::string_view & old_name, const ::std::string_view & new_name, bool throw_if_absent=false)
Переименовывает таблицу ключ-значение.
size_t size_current () const
Returns current write transaction size (i.e. summary volume of dirty pages) in bytes.
size_t size_max () const
Returns maximal write transaction size (i.e. limit for summary volume of dirty pages) in bytes.
txn_managed start_nested ()
Start nested write transaction.
txn_managed start_nested (bool readonly)
Start nested transaction.
value_result try_insert (map_handle map, const pair & kv)
constexpr txn () noexcept
txn (const txn &) noexcept
size_t unbind_all_cursors () const
Unbind all cursors.
void upsert (map_handle map, const pair & kv)

Protected Attributes

Type Name
MDBX_txn * handle_ = {nullptr}

Detailed Description

Like other unmanaged classes, txn allows copying and assignment for handles as a values, but does not manage nor destroys the represented underlying object from the own class destructor.

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

Public Types Documentation

typedef cache_result

using mdbx::txn::cache_result = ::MDBX_cache_result_t;

typedef cache_status

using mdbx::txn::cache_status = ::MDBX_cache_status_t;

typedef canary

using mdbx::txn::canary = ::MDBX_canary;

typedef gc_info

using mdbx::txn::gc_info = ::MDBX_gc_info_t;

typedef info

using mdbx::txn::info = ::MDBX_txn_info;

typedef map_stat

using mdbx::txn::map_stat = ::MDBX_stat;

Public Functions Documentation

function append

inline void mdbx::txn::append (
    map_handle map,
    const pair & kv,
    bool multivalue_order_preserved=true
) 

function clear_map [1/3]

bool mdbx::txn::clear_map (
    const char * name,
    bool throw_if_absent=false
) 

Returns:

True if the key-value map existed and was cleared, either false if the key-value map did not exist and there is nothing to clear.


function clear_map [2/3]

bool mdbx::txn::clear_map (
    const slice & name,
    bool throw_if_absent=false
) 

Returns:

True if the key-value map existed and was cleared, either false if the key-value map did not exist and there is nothing to clear.


function clear_map [3/3]

inline bool mdbx::txn::clear_map (
    const ::std::string_view & name,
    bool throw_if_absent=false
) 

Returns:

True if the key-value map existed and was cleared, either false if the key-value map did not exist and there is nothing to clear.


function close_all_cursors

Close all cursors.

inline size_t mdbx::txn::close_all_cursors () const

function copy [1/2]

Copy an MVCC-snapshot of the database to the destination path.

inline void mdbx::txn::copy (
    const wchar_t * destination,
    bool compactify,
    bool force_dynamic_size=false
) 

Copies the consistent state as seen by this transaction, see mdbx_txn_copy2pathname().

See also: env::copy()


function copy [2/2]

Copy an MVCC-snapshot of the database to the destination path.

inline void mdbx::txn::copy (
    const ::std::wstring & destination,
    bool compactify,
    bool force_dynamic_size=false
) 

Copies the consistent state as seen by this transaction, see mdbx_txn_copy2pathname().

See also: env::copy()


function create_map

Create new or open existing key-value map.

inline map_handle mdbx::txn::create_map (
    const ::std::string_view & name,
    const ::mdbx::key_mode key_mode=::mdbx::key_mode::usual,
    const ::mdbx::value_mode value_mode=::mdbx::value_mode::single
) 

function drop_map [1/3]

Drops key-value map using name.

bool mdbx::txn::drop_map (
    const char * name,
    bool throw_if_absent=false
) 

Returns:

True if the key-value map existed and was deleted, either false if the key-value map did not exist and there is nothing to delete.


function drop_map [2/3]

Drop key-value map.

bool mdbx::txn::drop_map (
    const slice & name,
    bool throw_if_absent=false
) 

Returns:

True if the key-value map existed and was deleted, either false if the key-value map did not exist and there is nothing to delete.


function drop_map [3/3]

Drop key-value map.

inline bool mdbx::txn::drop_map (
    const ::std::string_view & name,
    bool throw_if_absent=false
) 

Returns:

True if the key-value map existed and was deleted, either false if the key-value map did not exist and there is nothing to delete.


function handle [1/2]

inline const MDBX_txn * mdbx::txn::handle () noexcept const

function handle [2/2]

inline MDBX_txn * mdbx::txn::handle () noexcept

function insert

inline void mdbx::txn::insert (
    map_handle map,
    const pair & kv
) 

function is_dirty

Checks whether the given slice is on a dirty page.

inline bool mdbx::txn::is_dirty (
    const slice & item
) const

function is_readonly

Checks whether the transaction is read-only.

inline bool mdbx::txn::is_readonly () const

function is_readwrite

Checks whether the transaction is read-write.

inline bool mdbx::txn::is_readwrite () const

function open_map

Open existing key-value map.

inline map_handle mdbx::txn::open_map (
    const ::std::string_view & name,
    const ::mdbx::key_mode key_mode=::mdbx::key_mode::usual,
    const ::mdbx::value_mode value_mode=::mdbx::value_mode::single
) const

function open_map_accede

Open existing key-value map.

inline map_handle mdbx::txn::open_map_accede (
    const ::std::string_view & name
) const

function operator MDBX_txn *

inline constexpr mdbx::txn::operator MDBX_txn * () noexcept

function operator const MDBX_txn *

inline constexpr mdbx::txn::operator const MDBX_txn * () noexcept const

function operator=

txn & mdbx::txn::operator= (
    const txn &
) noexcept

function put

inline void mdbx::txn::put (
    map_handle map,
    const pair & kv,
    put_mode mode
) 

function put_multiple_samelength [1/2]

template<typename VALUE>
inline size_t mdbx::txn::put_multiple_samelength (
    map_handle map,
    const slice & key,
    const VALUE * values_array,
    size_t values_count,
    put_mode mode,
    bool allow_partial=false
) 

function put_multiple_samelength [2/2]

template<typename VALUE>
inline void mdbx::txn::put_multiple_samelength (
    map_handle map,
    const slice & key,
    const ::std::vector< VALUE > & vector,
    put_mode mode
) 

function rename_map [1/5]

Переименовывает таблицу ключ-значение.

bool mdbx::txn::rename_map (
    const char * old_name,
    const char * new_name,
    bool throw_if_absent=false
) 

Returns:

True если таблица существует и была переименована, либо false в случае отсутствия исходной таблицы.


function rename_map [2/5]

Переименовывает таблицу ключ-значение.

bool mdbx::txn::rename_map (
    const ::std::string & old_name,
    const ::std::string & new_name,
    bool throw_if_absent=false
) 

Returns:

True если таблица существует и была переименована, либо false в случае отсутствия исходной таблицы.


function rename_map [3/5]

Переименовывает таблицу ключ-значение.

bool mdbx::txn::rename_map (
    const slice & old_name,
    const slice & new_name,
    bool throw_if_absent=false
) 

Returns:

True если таблица существует и была переименована, либо false в случае отсутствия исходной таблицы.


function rename_map [4/5]

Переименовывает таблицу ключ-значение.

inline void mdbx::txn::rename_map (
    map_handle map,
    const ::std::string_view & new_name
) 

function rename_map [5/5]

Переименовывает таблицу ключ-значение.

inline bool mdbx::txn::rename_map (
    const ::std::string_view & old_name,
    const ::std::string_view & new_name,
    bool throw_if_absent=false
) 

Returns:

True если таблица существует и была переименована, либо false в случае отсутствия исходной таблицы.


function size_current

Returns current write transaction size (i.e. summary volume of dirty pages) in bytes.

inline size_t mdbx::txn::size_current () const

function size_max

Returns maximal write transaction size (i.e. limit for summary volume of dirty pages) in bytes.

inline size_t mdbx::txn::size_max () const

function start_nested [1/2]

Start nested write transaction.

txn_managed mdbx::txn::start_nested () 

function start_nested [2/2]

Start nested transaction.

txn_managed mdbx::txn::start_nested (
    bool readonly
) 

function try_insert

inline value_result mdbx::txn::try_insert (
    map_handle map,
    const pair & kv
) 

function txn [1/2]

constexpr mdbx::txn::txn () noexcept

function txn [2/2]

mdbx::txn::txn (
    const txn &
) noexcept

function unbind_all_cursors

Unbind all cursors.

inline size_t mdbx::txn::unbind_all_cursors () const

function upsert

inline void mdbx::txn::upsert (
    map_handle map,
    const pair & kv
) 

Protected Attributes Documentation

variable handle_

MDBX_txn* mdbx::txn::handle_;

Friends Documentation

friend operator!=

inline bool mdbx::txn::operator!= (
    const txn & a,
    const txn & b
) noexcept

friend operator==

inline bool mdbx::txn::operator== (
    const txn & a,
    const txn & b
) noexcept


The documentation for this class was generated from the following file docs/mdbx.h++