libmdbx  0.13.0.37 (2024-04-04T17:32:49+03:00)
One of the fastest compact embeddable key-value ACID database without WAL.
C++ API

Modules

 exceptions and errors
 
 slices and buffers
 

Classes

class  mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >
 The chunk of data stored inside the buffer or located outside it. More...
 
struct  mdbx::map_handle
 A handle for an individual database (key-value spaces) in the environment. More...
 
class  mdbx::env
 Unmanaged database environment. More...
 
class  mdbx::env_managed
 Managed database environment. More...
 
class  mdbx::txn
 Unmanaged database transaction. More...
 
class  mdbx::txn_managed
 Managed database transaction. More...
 
class  mdbx::cursor
 Unmanaged cursor. More...
 
class  mdbx::cursor_managed
 Managed cursor. More...
 
struct  std::hash<::mdbx::slice >
 

Macros

#define MDBX_STD_FILESYSTEM_PATH   ::mdbx::filesystem::path
 Defined if mdbx::filesystem::path is available. More...
 

Typedefs

using mdbx::byte = char8_t
 
using mdbx::version_info = ::MDBX_version_info
 libmdbx version information More...
 
using mdbx::build_info = ::MDBX_build_info
 libmdbx build information More...
 
using mdbx::legacy_allocator = ::std::string::allocator_type
 Legacy allocator but it is recommended to use polymorphic_allocator. More...
 
using mdbx::polymorphic_allocator = ::std::pmr::string::allocator_type
 Default polymorphic allocator for modern code. More...
 
using mdbx::default_allocator = polymorphic_allocator
 
using mdbx::default_buffer = buffer< default_allocator, default_capacity_policy >
 Default buffer. More...
 
template<class ALLOCATOR = default_allocator>
using mdbx::string = ::std::basic_string< char, ::std::char_traits< char >, ALLOCATOR >
 Default single-byte string. More...
 
using mdbx::filehandle = ::mdbx_filehandle_t
 
using mdbx::path = ::mdbx::filesystem::path
 
using mdbx::duration = ::std::chrono::duration< unsigned, ::std::ratio< 1, 65536 > >
 Duration in 1/65536 units of second. More...
 
using mdbx::comparator = ::MDBX_cmp_func *
 

Enumerations

enum  mdbx::loop_control { mdbx::continue_loop = 0 , mdbx::exit_loop = INT32_MIN }
 Loop control constants for readers enumeration functor and other cases. More...
 
enum class  mdbx::key_mode { mdbx::usual = MDBX_DB_DEFAULTS , mdbx::reverse = MDBX_REVERSEKEY , mdbx::ordinal = MDBX_INTEGERKEY , mdbx::msgpack = -1 }
 Kinds of the keys and corresponding modes of comparing it. More...
 
enum class  mdbx::value_mode {
  mdbx::single = MDBX_DB_DEFAULTS , mdbx::multi , mdbx::multi_reverse , mdbx::multi_samelength ,
  mdbx::multi_ordinal , mdbx::multi_reverse_samelength , mdbx::msgpack = -1
}
 Kind of the values and sorted multi-values with corresponding comparison. More...
 
enum  mdbx::put_mode { mdbx::insert_unique = MDBX_NOOVERWRITE , mdbx::upsert = MDBX_UPSERT , mdbx::update = MDBX_CURRENT }
 Key-value pairs put mode. More...
 

Functions

constexpr const version_infomdbx::get_version () noexcept
 Returns libmdbx version information. More...
 
constexpr const build_infomdbx::get_build () noexcept
 Returns libmdbx build information. More...
 
MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_usual (key_mode mode) noexcept
 
MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_ordinal (key_mode mode) noexcept
 
MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_samelength (key_mode mode) noexcept
 
MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_reverse (key_mode mode) noexcept
 
MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_msgpack (key_mode mode) noexcept
 
MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_usual (value_mode mode) noexcept
 
MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_multi (value_mode mode) noexcept
 
MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_ordinal (value_mode mode) noexcept
 
MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_samelength (value_mode mode) noexcept
 
MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_reverse (value_mode mode) noexcept
 
MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_msgpack (value_mode mode) noexcept
 
comparator mdbx::default_comparator (key_mode mode) noexcept
 
comparator mdbx::default_comparator (value_mode mode) noexcept
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const slice &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const pair &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const pair_result &)
 
template<class ALLOCATOR , typename CAPACITY_POLICY >
inline ::std::ostream & mdbx::operator<< (::std::ostream &out, const buffer< ALLOCATOR, CAPACITY_POLICY > &it)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const env::geometry::size &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const env::geometry &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const env::operate_parameters &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const env::mode &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const env::durability &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const env::reclaiming_options &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const env::operate_options &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const env_managed::create_parameters &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const MDBX_log_level_t &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const MDBX_debug_flags_t &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const error &)
 
inline ::std::ostream & mdbx::operator<< (::std::ostream &out, const MDBX_error_t &errcode)
 
constexpr bool mdbx::operator== (const error &a, const error &b) noexcept
 
constexpr bool mdbx::operator!= (const error &a, const error &b) noexcept
 
constexpr bool mdbx::operator== (const slice &a, const slice &b) noexcept
 
constexpr bool mdbx::operator< (const slice &a, const slice &b) noexcept
 
constexpr bool mdbx::operator> (const slice &a, const slice &b) noexcept
 
constexpr bool mdbx::operator<= (const slice &a, const slice &b) noexcept
 
constexpr bool mdbx::operator>= (const slice &a, const slice &b) noexcept
 
constexpr bool mdbx::operator!= (const slice &a, const slice &b) noexcept
 
constexpr bool mdbx::operator== (const pair &a, const pair &b) noexcept
 
constexpr bool mdbx::operator< (const pair &a, const pair &b) noexcept
 
constexpr bool mdbx::operator> (const pair &a, const pair &b) noexcept
 
constexpr bool mdbx::operator<= (const pair &a, const pair &b) noexcept
 
constexpr bool mdbx::operator>= (const pair &a, const pair &b) noexcept
 
constexpr bool mdbx::operator!= (const pair &a, const pair &b) noexcept
 
constexpr bool mdbx::operator== (const env &a, const env &b) noexcept
 
constexpr bool mdbx::operator!= (const env &a, const env &b) noexcept
 
constexpr bool mdbx::operator== (const txn &a, const txn &b) noexcept
 
constexpr bool mdbx::operator!= (const txn &a, const txn &b) noexcept
 
constexpr bool mdbx::operator== (const cursor &a, const cursor &b) noexcept
 
constexpr bool mdbx::operator!= (const cursor &a, const cursor &b) noexcept
 
int mdbx::compare_position_nothrow (const cursor &left, const cursor &right, bool ignore_nested=false) noexcept
 
int mdbx::compare_position (const cursor &left, const cursor &right, bool ignore_nested=false)
 
ptrdiff_t mdbx::estimate (const cursor &from, const cursor &to)
 
string std::to_string (const ::mdbx::slice &value)
 
template<class ALLOCATOR , typename CAPACITY_POLICY >
string std::to_string (const ::mdbx::buffer< ALLOCATOR, CAPACITY_POLICY > &buffer)
 
string std::to_string (const ::mdbx::pair &value)
 
string std::to_string (const ::mdbx::env::geometry &value)
 
string std::to_string (const ::mdbx::env::operate_parameters &value)
 
string std::to_string (const ::mdbx::env::mode &value)
 
string std::to_string (const ::mdbx::env::durability &value)
 
string std::to_string (const ::mdbx::env::reclaiming_options &value)
 
string std::to_string (const ::mdbx::env::operate_options &value)
 
string std::to_string (const ::mdbx::env_managed::create_parameters &value)
 
string std::to_string (const ::MDBX_log_level_t &value)
 
string std::to_string (const ::MDBX_debug_flags_t &value)
 
string std::to_string (const ::mdbx::error &value)
 
string std::to_string (const ::MDBX_error_t &errcode)
 
bool mdbx::exception_thunk::is_clean () const noexcept
 
void mdbx::exception_thunk::capture () noexcept
 
void mdbx::exception_thunk::rethrow_captured () const
 
constexpr mdbx::error::error (MDBX_error_t error_code) noexcept
 
constexpr bool mdbx::error::is_success () const noexcept
 
constexpr bool mdbx::error::is_result_true () const noexcept
 
constexpr bool mdbx::error::is_result_false () const noexcept
 
constexpr bool mdbx::error::is_failure () const noexcept
 
constexpr MDBX_error_t mdbx::error::code () const noexcept
 Returns error code. More...
 
constexpr bool mdbx::error::is_mdbx_error () const noexcept
 Returns true for MDBX's errors. More...
 
static void mdbx::error::throw_exception (int error_code)
 
void mdbx::error::throw_on_failure () const
 
void mdbx::error::success_or_throw () const
 
void mdbx::error::success_or_throw (const exception_thunk &) const
 
void mdbx::error::panic_on_failure (const char *context_where, const char *func_who) const noexcept
 
void mdbx::error::success_or_panic (const char *context_where, const char *func_who) const noexcept
 
static void mdbx::error::throw_on_nullptr (const void *ptr, MDBX_error_t error_code)
 
static void mdbx::error::throw_on_failure (int error_code)
 
static void mdbx::error::success_or_throw (MDBX_error_t error_code)
 
static bool mdbx::error::boolean_or_throw (int error_code)
 
static void mdbx::error::success_or_throw (int error_code, const exception_thunk &)
 
static void mdbx::error::panic_on_failure (int error_code, const char *context_where, const char *func_who) noexcept
 
static void mdbx::error::success_or_panic (int error_code, const char *context_where, const char *func_who) noexcept
 
static bool mdbx::error::boolean_or_throw (int error_code, const exception_thunk &)
 
constexpr mdbx::slice::slice () noexcept
 Create an empty slice. More...
 
constexpr mdbx::slice::slice (const void *ptr, size_t bytes)
 Create a slice that refers to [0,bytes-1] of memory bytes pointed by ptr. More...
 
constexpr mdbx::slice::slice (const void *begin, const void *end)
 Create a slice that refers to [begin,end] of memory bytes. More...
 
constexpr mdbx::slice::slice (const char *c_str)
 Create a slice that refers to c_str[0,strlen(c_str)-1]. More...
 
constexpr mdbx::slice::slice (const MDBX_val &src)
 
constexpr mdbx::slice::slice (MDBX_val &&src)
 
constexpr mdbx::slice::slice (slice &&src) noexcept
 
slicemdbx::slice::assign (const void *ptr, size_t bytes)
 
slicemdbx::slice::assign (const slice &src) noexcept
 
slicemdbx::slice::assign (const ::MDBX_val &src)
 
slicemdbx::slice::assign (slice &&src) noexcept
 
slicemdbx::slice::assign (::MDBX_val &&src)
 
slicemdbx::slice::assign (const void *begin, const void *end)
 
slicemdbx::slice::assign (const char *c_str)
 
slicemdbx::slice::operator= (slice &&src) noexcept
 
slicemdbx::slice::operator= (::MDBX_val &&src)
 
void mdbx::slice::swap (slice &other) noexcept
 
constexpr const bytemdbx::slice::byte_ptr () const noexcept
 Returns casted to pointer to byte an address of data. More...
 
constexpr const bytemdbx::slice::end_byte_ptr () const noexcept
 Returns casted to pointer to byte an end of data. More...
 
constexpr bytemdbx::slice::byte_ptr () noexcept
 
constexpr bytemdbx::slice::end_byte_ptr () noexcept
 
constexpr const char * mdbx::slice::char_ptr () const noexcept
 Returns casted to pointer to char an address of data. More...
 
constexpr const char * mdbx::slice::end_char_ptr () const noexcept
 Returns casted to pointer to char an end of data. More...
 
constexpr char * mdbx::slice::char_ptr () noexcept
 
constexpr char * mdbx::slice::end_char_ptr () noexcept
 
constexpr const void * mdbx::slice::data () const noexcept
 Return a pointer to the beginning of the referenced data. More...
 
constexpr const void * mdbx::slice::end () const noexcept
 Return a pointer to the ending of the referenced data. More...
 
constexpr void * mdbx::slice::data () noexcept
 
constexpr void * mdbx::slice::end () noexcept
 
constexpr size_t mdbx::slice::length () const noexcept
 Returns the number of bytes. More...
 
constexpr slicemdbx::slice::set_length (size_t bytes)
 Set slice length. More...
 
constexpr slicemdbx::slice::set_end (const void *ptr)
 Sets the length by specifying the end of the slice data. More...
 
constexpr bool mdbx::slice::empty () const noexcept
 Checks whether the slice is empty. More...
 
constexpr bool mdbx::slice::is_null () const noexcept
 Checks whether the slice data pointer is nullptr. More...
 
constexpr size_t mdbx::slice::size () const noexcept
 Returns the number of bytes. More...
 
constexpr void mdbx::slice::invalidate () noexcept
 Depletes content of slice and make it invalid. More...
 
constexpr void mdbx::slice::clear () noexcept
 Makes the slice empty and referencing to nothing. More...
 
void mdbx::slice::remove_prefix (size_t n) noexcept
 Drops the first "n" bytes from this slice. More...
 
void mdbx::slice::safe_remove_prefix (size_t n)
 Drops the first "n" bytes from this slice. More...
 
void mdbx::slice::remove_suffix (size_t n) noexcept
 Drops the last "n" bytes from this slice. More...
 
void mdbx::slice::safe_remove_suffix (size_t n)
 Drops the last "n" bytes from this slice. More...
 
constexpr bool mdbx::slice::starts_with (const slice &prefix) const noexcept
 Checks if the data starts with the given prefix. More...
 
constexpr bool mdbx::slice::ends_with (const slice &suffix) const noexcept
 Checks if the data ends with the given suffix. More...
 
constexpr size_t mdbx::slice::hash_value () const noexcept
 Returns the hash value of referenced data. More...
 
constexpr byte mdbx::slice::operator[] (size_t n) const noexcept
 Returns the nth byte in the referenced data. More...
 
constexpr byte mdbx::slice::at (size_t n) const
 Returns the nth byte in the referenced data with bounds checking. More...
 
constexpr slice mdbx::slice::head (size_t n) const noexcept
 Returns the first "n" bytes of the slice. More...
 
constexpr slice mdbx::slice::tail (size_t n) const noexcept
 Returns the last "n" bytes of the slice. More...
 
constexpr slice mdbx::slice::middle (size_t from, size_t n) const noexcept
 Returns the middle "n" bytes of the slice. More...
 
constexpr slice mdbx::slice::safe_head (size_t n) const
 Returns the first "n" bytes of the slice. More...
 
constexpr slice mdbx::slice::safe_tail (size_t n) const
 Returns the last "n" bytes of the slice. More...
 
constexpr slice mdbx::slice::safe_middle (size_t from, size_t n) const
 Returns the middle "n" bytes of the slice. More...
 
static constexpr intptr_t mdbx::slice::compare_fast (const slice &a, const slice &b) noexcept
 Three-way fast non-lexicographically length-based comparison. More...
 
static constexpr intptr_t mdbx::slice::compare_lexicographically (const slice &a, const slice &b) noexcept
 Three-way lexicographically comparison. More...
 
template<class ALLOCATOR = default_allocator>
string< ALLOCATOR > mdbx::slice::as_hex_string (bool uppercase=false, unsigned wrap_width=0, const ALLOCATOR &allocator=ALLOCATOR()) const
 Returns a string with a hexadecimal dump of the slice content. More...
 
template<class ALLOCATOR = default_allocator>
string< ALLOCATOR > mdbx::slice::as_base58_string (unsigned wrap_width=0, const ALLOCATOR &allocator=ALLOCATOR()) const
 Returns a string with a Base58 dump of the slice content. More...
 
template<class ALLOCATOR = default_allocator>
string< ALLOCATOR > mdbx::slice::as_base64_string (unsigned wrap_width=0, const ALLOCATOR &allocator=ALLOCATOR()) const
 Returns a string with a Base58 dump of the slice content. More...
 
template<class ALLOCATOR = default_allocator, class CAPACITY_POLICY = default_capacity_policy>
buffer< ALLOCATOR, CAPACITY_POLICY > mdbx::slice::encode_hex (bool uppercase=false, unsigned wrap_width=0, const ALLOCATOR &allocator=ALLOCATOR()) const
 Returns a buffer with a hexadecimal dump of the slice content. More...
 
template<class ALLOCATOR = default_allocator, class CAPACITY_POLICY = default_capacity_policy>
buffer< ALLOCATOR, CAPACITY_POLICY > mdbx::slice::encode_base58 (unsigned wrap_width=0, const ALLOCATOR &allocator=ALLOCATOR()) const
 Returns a buffer with a Base58 dump of the slice content. More...
 
template<class ALLOCATOR = default_allocator, class CAPACITY_POLICY = default_capacity_policy>
buffer< ALLOCATOR, CAPACITY_POLICY > mdbx::slice::encode_base64 (unsigned wrap_width=0, const ALLOCATOR &allocator=ALLOCATOR()) const
 Returns a buffer with a Base64 dump of the slice content. More...
 
template<class ALLOCATOR = default_allocator, class CAPACITY_POLICY = default_capacity_policy>
buffer< ALLOCATOR, CAPACITY_POLICY > mdbx::slice::hex_decode (bool ignore_spaces=false, const ALLOCATOR &allocator=ALLOCATOR()) const
 Decodes hexadecimal dump from the slice content to returned buffer. More...
 
template<class ALLOCATOR = default_allocator, class CAPACITY_POLICY = default_capacity_policy>
buffer< ALLOCATOR, CAPACITY_POLICY > mdbx::slice::base58_decode (bool ignore_spaces=false, const ALLOCATOR &allocator=ALLOCATOR()) const
 Decodes Base58 dump from the slice content to returned buffer. More...
 
template<class ALLOCATOR = default_allocator, class CAPACITY_POLICY = default_capacity_policy>
buffer< ALLOCATOR, CAPACITY_POLICY > mdbx::slice::base64_decode (bool ignore_spaces=false, const ALLOCATOR &allocator=ALLOCATOR()) const
 Decodes Base64 dump from the slice content to returned buffer. More...
 
bool mdbx::slice::is_hex (bool ignore_spaces=false) const noexcept
 Checks whether the content of the slice is a hexadecimal dump. More...
 
bool mdbx::slice::is_base58 (bool ignore_spaces=false) const noexcept
 Checks whether the content of the slice is a Base58 dump. More...
 
bool mdbx::slice::is_base64 (bool ignore_spaces=false) const noexcept
 Checks whether the content of the slice is a Base64 dump. More...
 
static constexpr intptr_t mdbx::pair::compare_fast (const pair &a, const pair &b) noexcept
 Three-way fast non-lexicographically length-based comparison. More...
 
static constexpr intptr_t mdbx::pair::compare_lexicographically (const pair &a, const pair &b) noexcept
 Three-way lexicographically comparison. More...
 
template<class ALLOCATOR , typename CAPACITY_POLICY >
 mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer (const txn &txn, const struct slice &src, const allocator_type &allocator)
 
constexpr mdbx::map_handle::info::info (map_handle::flags flags, map_handle::state state) noexcept
 
MDBX_CXX11_CONSTEXPR_ENUM mdbx::key_mode mdbx::map_handle::info::key_mode () const noexcept
 
MDBX_CXX11_CONSTEXPR_ENUM mdbx::value_mode mdbx::map_handle::info::value_mode () const noexcept
 
constexpr mdbx::env::env (MDBX_env *ptr) noexcept
 
envmdbx::env::operator= (env &&other) noexcept
 
 mdbx::env::env (env &&other) noexcept
 
 mdbx::env::~env () noexcept
 
constexpr mdbx::env::operator const MDBX_env * () const
 
constexpr mdbx::env::operator MDBX_env * ()
 
geometrymdbx::env::geometry::make_fixed (intptr_t size) noexcept
 
geometrymdbx::env::geometry::make_dynamic (intptr_t lower=minimal_value, intptr_t upper=maximal_value) noexcept
 
static env::reclaiming_options mdbx::env::operate_parameters::reclaiming_from_flags (MDBX_env_flags_t flags) noexcept
 
static env::operate_options mdbx::env::operate_parameters::options_from_flags (MDBX_env_flags_t flags) noexcept
 
static size_t mdbx::env::limits::pagesize_min () noexcept
 Returns the minimal database page size in bytes. More...
 
static size_t mdbx::env::limits::pagesize_max () noexcept
 Returns the maximal database page size in bytes. More...
 
static size_t mdbx::env::limits::dbsize_min (intptr_t pagesize)
 Returns the minimal database size in bytes for specified page size. More...
 
static size_t mdbx::env::limits::dbsize_max (intptr_t pagesize)
 Returns the maximal database size in bytes for specified page size. More...
 
static size_t mdbx::env::limits::key_min (MDBX_db_flags_t flags) noexcept
 Returns the minimal key size in bytes for specified database flags. More...
 
static size_t mdbx::env::limits::key_min (key_mode mode) noexcept
 Returns the minimal key size in bytes for specified keys mode. More...
 
static size_t mdbx::env::limits::key_max (intptr_t pagesize, MDBX_db_flags_t flags)
 Returns the maximal key size in bytes for specified page size and database flags. More...
 
static size_t mdbx::env::limits::key_max (intptr_t pagesize, key_mode mode)
 Returns the maximal key size in bytes for specified page size and keys mode. More...
 
static size_t mdbx::env::limits::key_max (const env &, MDBX_db_flags_t flags)
 Returns the maximal key size in bytes for given environment and database flags. More...
 
static size_t mdbx::env::limits::key_max (const env &, key_mode mode)
 Returns the maximal key size in bytes for given environment and keys mode. More...
 
static size_t mdbx::env::limits::value_min (MDBX_db_flags_t flags) noexcept
 Returns the minimal values size in bytes for specified database flags. More...
 
static size_t mdbx::env::limits::value_min (value_mode) noexcept
 Returns the minimal values size in bytes for specified values mode. More...
 
static size_t mdbx::env::limits::value_max (intptr_t pagesize, MDBX_db_flags_t flags)
 Returns the maximal value size in bytes for specified page size and database flags. More...
 
static size_t mdbx::env::limits::value_max (intptr_t pagesize, value_mode)
 Returns the maximal value size in bytes for specified page size and values mode. More...
 
static size_t mdbx::env::limits::value_max (const env &, MDBX_db_flags_t flags)
 Returns the maximal value size in bytes for given environment and database flags. More...
 
static size_t mdbx::env::limits::value_max (const env &, value_mode)
 Returns the maximal value size in bytes for specified page size and values mode. More...
 
static size_t mdbx::env::limits::pairsize4page_max (intptr_t pagesize, MDBX_db_flags_t flags)
 Returns maximal size of key-value pair to fit in a single page for specified size and database flags. More...
 
static size_t mdbx::env::limits::pairsize4page_max (intptr_t pagesize, value_mode)
 Returns maximal size of key-value pair to fit in a single page for specified page size and values mode. More...
 
static size_t mdbx::env::limits::pairsize4page_max (const env &, MDBX_db_flags_t flags)
 Returns maximal size of key-value pair to fit in a single page for given environment and database flags. More...
 
static size_t mdbx::env::limits::pairsize4page_max (const env &, value_mode)
 Returns maximal size of key-value pair to fit in a single page for specified page size and values mode. More...
 
static size_t mdbx::env::limits::valsize4page_max (intptr_t pagesize, MDBX_db_flags_t flags)
 Returns maximal data size in bytes to fit in a leaf-page or single overflow/large-page for specified size and database flags. More...
 
static size_t mdbx::env::limits::valsize4page_max (intptr_t pagesize, value_mode)
 Returns maximal data size in bytes to fit in a leaf-page or single overflow/large-page for specified page size and values mode. More...
 
static size_t mdbx::env::limits::valsize4page_max (const env &, MDBX_db_flags_t flags)
 Returns maximal data size in bytes to fit in a leaf-page or single overflow/large-page for given environment and database flags. More...
 
static size_t mdbx::env::limits::valsize4page_max (const env &, value_mode)
 Returns maximal data size in bytes to fit in a leaf-page or single overflow/large-page for specified page size and values mode. More...
 
static size_t mdbx::env::limits::transaction_size_max (intptr_t pagesize)
 Returns the maximal write transaction size (i.e. limit for summary volume of dirty pages) in bytes for specified page size. More...
 
env::operate_parameters mdbx::env::get_operation_parameters () const
 Returns current operation parameters. More...
 
env::mode mdbx::env::get_mode () const
 Returns current operation mode. More...
 
env::durability mdbx::env::get_durability () const
 Returns current durability mode. More...
 
env::reclaiming_options mdbx::env::get_reclaiming () const
 Returns current reclaiming options. More...
 
env::operate_options mdbx::env::get_options () const
 Returns current operate options. More...
 
stat mdbx::env::get_stat () const
 Returns snapshot statistics about the MDBX environment. More...
 
stat mdbx::env::get_stat (const txn &) const
 Return statistics about the MDBX environment accordingly to the specified transaction. More...
 
info mdbx::env::get_info () const
 Return snapshot information about the MDBX environment. More...
 
info mdbx::env::get_info (const txn &) const
 Return information about the MDBX environment accordingly to the specified transaction. More...
 
filehandle mdbx::env::get_filehandle () const
 Returns the file descriptor for the DXB file of MDBX environment. More...
 
MDBX_env_flags_t mdbx::env::get_flags () const
 Returns environment flags. More...
 
unsigned mdbx::env::max_readers () const
 Returns the maximum number of threads/reader slots for the environment. More...
 
unsigned mdbx::env::max_maps () const
 Returns the maximum number of named databases for the environment. More...
 
void * mdbx::env::get_context () const noexcept
 Returns the application context associated with the environment. More...
 
envmdbx::env::set_context (void *your_context)
 Sets the application context associated with the environment. More...
 
envmdbx::env::set_sync_threshold (size_t bytes)
 Sets threshold to force flush the data buffers to disk, for non-sync durability modes. More...
 
size_t mdbx::env::sync_threshold () const
 Gets threshold used to force flush the data buffers to disk, for non-sync durability modes. More...
 
envmdbx::env::set_sync_period__seconds_16dot16 (unsigned seconds_16dot16)
 Sets relative period since the last unsteady commit to force flush the data buffers to disk, for non-sync durability modes. More...
 
unsigned mdbx::env::sync_period__seconds_16dot16 () const
 Gets relative period since the last unsteady commit that used to force flush the data buffers to disk, for non-sync durability modes. More...
 
envmdbx::env::set_sync_period__seconds_double (double seconds)
 Sets relative period since the last unsteady commit to force flush the data buffers to disk, for non-sync durability modes. More...
 
double mdbx::env::sync_period__seconds_double () const
 Gets relative period since the last unsteady commit that used to force flush the data buffers to disk, for non-sync durability modes. More...
 
envmdbx::env::set_extra_option (extra_runtime_option option, uint64_t value)
 Sets the value of a extra runtime options for an environment. More...
 
uint64_t mdbx::env::extra_option (extra_runtime_option option) const
 Gets the value of extra runtime options from an environment. More...
 
envmdbx::env::alter_flags (MDBX_env_flags_t flags, bool on_off)
 Alter environment flags. More...
 
envmdbx::env::set_geometry (const geometry &size)
 Set all size-related parameters of environment. More...
 
bool mdbx::env::sync_to_disk (bool force=true, bool nonblock=false)
 Flush the environment data buffers. More...
 
void mdbx::env::close_map (const map_handle &)
 Close a key-value map (aka sub-database) handle. Normally unnecessary. More...
 
constexpr mdbx::env::reader_info::reader_info (int slot, mdbx_pid_t pid, mdbx_tid_t thread, uint64_t txnid, uint64_t lag, size_t used, size_t retained) noexcept
 
template<typename VISITOR >
int mdbx::env::enumerate_readers (VISITOR &visitor)
 Enumerate readers. More...
 
unsigned mdbx::env::check_readers ()
 Checks for stale readers in the lock table and return number of cleared slots. More...
 
envmdbx::env::set_HandleSlowReaders (MDBX_hsr_func *)
 Sets a Handle-Slow-Readers callback to resolve database full/overflow issue due to a reader(s) which prevents the old data from being recycled. More...
 
MDBX_hsr_funcmdbx::env::get_HandleSlowReaders () const noexcept
 Returns the current Handle-Slow-Readers callback used to resolve database full/overflow issue due to a reader(s) which prevents the old data from being recycled. More...
 
txn_managed mdbx::env::start_read () const
 Starts read (read-only) transaction. More...
 
txn_managed mdbx::env::prepare_read () const
 Creates but not start read transaction. More...
 
txn_managed mdbx::env::start_write (bool dont_wait=false)
 Starts write (read-write) transaction. More...
 
txn_managed mdbx::env::try_start_write ()
 Tries to start write (read-write) transaction without blocking. More...
 
constexpr mdbx::txn::txn (MDBX_txn *ptr) noexcept
 
txnmdbx::txn::operator= (txn &&other) noexcept
 
 mdbx::txn::txn (txn &&other) noexcept
 
 mdbx::txn::~txn () noexcept
 
constexpr mdbx::txn::operator const MDBX_txn * () const
 
constexpr mdbx::txn::operator MDBX_txn * ()
 
void * mdbx::txn::get_context () const noexcept
 Returns the application context associated with the transaction. More...
 
txnmdbx::txn::set_context (void *your_context)
 Sets the application context associated with the transaction. More...
 
bool mdbx::txn::is_dirty (const void *ptr) const
 Checks whether the given data is on a dirty page. More...
 
inline ::mdbx::env mdbx::txn::env () const noexcept
 Returns the transaction's environment. More...
 
MDBX_txn_flags_t mdbx::txn::flags () const
 Returns transaction's flags. More...
 
uint64_t mdbx::txn::id () const
 Return the transaction's ID. More...
 
void mdbx::txn::reset_reading ()
 Reset a read-only transaction. More...
 
void mdbx::txn::renew_reading ()
 Renew a read-only transaction. More...
 
info mdbx::txn::get_info (bool scan_reader_lock_table=false) const
 Returns information about the MDBX transaction. More...
 
cursor_managed mdbx::txn::open_cursor (map_handle map) const
 Opens cursor for specified key-value map handle. More...
 
size_t mdbx::txn::release_all_cursors (bool unbind) const
 Unbind or close all cursors. More...
 
map_handle mdbx::txn::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 mdbx::txn::open_map_accede (const char *name) const
 Open existing key-value map. More...
 
map_handle mdbx::txn::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...
 
void mdbx::txn::drop_map (map_handle map)
 Drops key-value map using handle. More...
 
void mdbx::txn::clear_map (map_handle map)
 Clear key-value map. More...
 
void mdbx::txn::rename_map (map_handle map, const char *new_name)
 Переименовывает таблицу ключ-значение. More...
 
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
 Open existing key-value map. More...
 
map_handle mdbx::txn::open_map_accede (const ::std::string_view &name) const
 Open existing key-value map. More...
 
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)
 Create new or open existing key-value map. More...
 
void mdbx::txn::rename_map (map_handle map, const ::std::string_view &new_name)
 Переименовывает таблицу ключ-значение. More...
 
map_handle mdbx::txn::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 mdbx::txn::open_map_accede (const ::std::string &name) const
 Open existing key-value map. More...
 
map_handle mdbx::txn::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...
 
bool mdbx::txn::drop_map (const ::std::string &name, bool throw_if_absent=false)
 Drop key-value map. More...
 
bool mdbx::txn::clear_map (const ::std::string &name, bool throw_if_absent=false)
 
void mdbx::txn::rename_map (map_handle map, const ::std::string &new_name)
 Переименовывает таблицу ключ-значение. More...
 
map_stat mdbx::txn::get_map_stat (map_handle map) const
 Returns statistics for a sub-database. More...
 
uint32_t mdbx::txn::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 mdbx::txn::get_handle_info (map_handle map) const
 Returns information about key-value map (aka sub-database) handle. More...
 
txnmdbx::txn::put_canary (const canary &)
 Set integers markers (aka "canary") associated with the environment. More...
 
canary mdbx::txn::get_canary () const
 Returns fours integers markers (aka "canary") associated with the environment. More...
 
uint64_t mdbx::txn::sequence (map_handle map) const
 
uint64_t mdbx::txn::sequence (map_handle map, uint64_t increment)
 Reads and increment sequence generator associated with a key-value map (aka sub-database). More...
 
int mdbx::txn::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 mdbx::txn::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 mdbx::txn::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 mdbx::txn::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 mdbx::txn::get (map_handle map, const slice &key) const
 Get value by key from a key-value map (aka sub-database). More...
 
slice mdbx::txn::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 mdbx::txn::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 mdbx::txn::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 mdbx::txn::get_equal_or_great (map_handle map, const slice &key) const
 Get value for equal or great key from a database. More...
 
pair_result mdbx::txn::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 mdbx::txn::put (map_handle map, const slice &key, slice *value, MDBX_put_flags_t flags) noexcept
 
void mdbx::txn::put (map_handle map, const slice &key, slice value, put_mode mode)
 
void mdbx::txn::insert (map_handle map, const slice &key, slice value)
 
value_result mdbx::txn::try_insert (map_handle map, const slice &key, slice value)
 
slice mdbx::txn::insert_reserve (map_handle map, const slice &key, size_t value_length)
 
value_result mdbx::txn::try_insert_reserve (map_handle map, const slice &key, size_t value_length)
 
void mdbx::txn::upsert (map_handle map, const slice &key, const slice &value)
 
slice mdbx::txn::upsert_reserve (map_handle map, const slice &key, size_t value_length)
 
void mdbx::txn::update (map_handle map, const slice &key, const slice &value)
 
bool mdbx::txn::try_update (map_handle map, const slice &key, const slice &value)
 
slice mdbx::txn::update_reserve (map_handle map, const slice &key, size_t value_length)
 
value_result mdbx::txn::try_update_reserve (map_handle map, const slice &key, size_t value_length)
 
bool mdbx::txn::erase (map_handle map, const slice &key)
 Removes all values for given key. More...
 
bool mdbx::txn::erase (map_handle map, const slice &key, const slice &value)
 Removes the particular multi-value entry of the key. More...
 
void mdbx::txn::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 > mdbx::txn::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 > mdbx::txn::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 > mdbx::txn::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 mdbx::txn::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 mdbx::txn::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)
 
ptrdiff_t mdbx::txn::estimate (map_handle map, const pair &from, const pair &to) const
 
ptrdiff_t mdbx::txn::estimate (map_handle map, const slice &from, const slice &to) const
 
ptrdiff_t mdbx::txn::estimate_from_first (map_handle map, const slice &to) const
 
ptrdiff_t mdbx::txn::estimate_to_last (map_handle map, const slice &from) const
 
constexpr mdbx::cursor::cursor (MDBX_cursor *ptr) noexcept
 
cursor_managed mdbx::cursor::clone (void *your_context=nullptr) const
 
void * mdbx::cursor::get_context () const noexcept
 Returns the application context associated with the cursor. More...
 
cursormdbx::cursor::set_context (void *your_context)
 Sets the application context associated with the cursor. More...
 
cursormdbx::cursor::operator= (cursor &&other) noexcept
 
 mdbx::cursor::cursor (cursor &&other) noexcept
 
 mdbx::cursor::~cursor () noexcept
 
constexpr mdbx::cursor::operator const MDBX_cursor * () const
 
constexpr mdbx::cursor::operator MDBX_cursor * ()
 
 mdbx::cursor::move_result::move_result (const cursor &cursor, bool throw_notfound)
 
 mdbx::cursor::move_result::move_result (cursor &cursor, move_operation operation, const slice &key, const slice &value, bool throw_notfound)
 
bool mdbx::cursor::move (move_operation operation, MDBX_val *key, MDBX_val *value, bool throw_notfound) const
 
 mdbx::cursor::estimate_result::estimate_result (const cursor &cursor, move_operation operation, const slice &key, const slice &value)
 
ptrdiff_t mdbx::cursor::estimate (move_operation operation, MDBX_val *key, MDBX_val *value) const
 
move_result mdbx::cursor::find (const slice &key, bool throw_notfound=true)
 
move_result mdbx::cursor::lower_bound (const slice &key, bool throw_notfound=false)
 
move_result mdbx::cursor::find_multivalue (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result mdbx::cursor::lower_bound_multivalue (const slice &key, const slice &value, bool throw_notfound=false)
 
bool mdbx::cursor::seek (const slice &key)
 
size_t mdbx::cursor::count_multivalue () const
 Return count of duplicates for current key. More...
 
bool mdbx::cursor::eof () const
 
bool mdbx::cursor::on_first () const
 
bool mdbx::cursor::on_last () const
 
bool mdbx::cursor::on_first_multival () const
 
bool mdbx::cursor::on_last_multival () const
 
estimate_result mdbx::cursor::estimate (const slice &key, const slice &value) const
 
estimate_result mdbx::cursor::estimate (const slice &key) const
 
estimate_result mdbx::cursor::estimate (move_operation operation) const
 
void mdbx::cursor::renew (const ::mdbx::txn &txn)
 Renew/bind a cursor with a new transaction and previously used key-value map handle. More...
 
void mdbx::cursor::bind (const ::mdbx::txn &txn, ::mdbx::map_handle map_handle)
 Bind/renew a cursor with a new transaction and specified key-value map handle. More...
 
void mdbx::cursor::unbind ()
 Unbind cursor from a transaction. More...
 
inline ::mdbx::txn mdbx::cursor::txn () const
 Returns the cursor's transaction. More...
 
map_handle mdbx::cursor::map () const
 
MDBX_error_t mdbx::cursor::put (const slice &key, slice *value, MDBX_put_flags_t flags) noexcept
 
void mdbx::cursor::insert (const slice &key, slice value)
 
value_result mdbx::cursor::try_insert (const slice &key, slice value)
 
slice mdbx::cursor::insert_reserve (const slice &key, size_t value_length)
 
value_result mdbx::cursor::try_insert_reserve (const slice &key, size_t value_length)
 
void mdbx::cursor::upsert (const slice &key, const slice &value)
 
slice mdbx::cursor::upsert_reserve (const slice &key, size_t value_length)
 
void mdbx::cursor::update (const slice &key, const slice &value)
 
bool mdbx::cursor::try_update (const slice &key, const slice &value)
 
slice mdbx::cursor::update_reserve (const slice &key, size_t value_length)
 
value_result mdbx::cursor::try_update_reserve (const slice &key, size_t value_length)
 
bool mdbx::cursor::erase (bool whole_multivalue=false)
 Removes single key-value pair or all multi-values at the current cursor position. More...
 
bool mdbx::cursor::erase (const slice &key, bool whole_multivalue=true)
 Seeks and removes first value or whole multi-value of the given key. More...
 
bool mdbx::cursor::erase (const slice &key, const slice &value)
 Seeks and removes the particular multi-value entry of the key. More...
 

Detailed Description


Class Documentation

◆ mdbx::buffer

class mdbx::buffer

template<class ALLOCATOR, typename CAPACITY_POLICY>
class mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >

The chunk of data stored inside the buffer or located outside it.

Public Types

enum  : size_t { max_length = MDBX_MAXDATASIZE , max_capacity = (max_length / 3u * 4u + 1023u) & ~size_t(1023) , extra_inplace_storage = reservation_policy::extra_inplace_storage , pettiness_threshold = reservation_policy::pettiness_threshold }
 
using allocator_type = typename ::std::allocator_traits< ALLOCATOR >::template rebind_alloc< uint64_t >
 
using allocator_traits = ::std::allocator_traits< allocator_type >
 
using reservation_policy = CAPACITY_POLICY
 
using move_assign_alloc = allocation_aware_details::move_assign_alloc< silo, allocator_type >
 
using copy_assign_alloc = allocation_aware_details::copy_assign_alloc< silo, allocator_type >
 

Public Member Functions

constexpr allocator_type get_allocator () const
 Returns the associated allocator. More...
 
constexpr bool is_freestanding () const noexcept
 Checks whether data chunk stored inside the buffer, otherwise buffer just refers to data located outside the buffer. More...
 
constexpr bool is_reference () const noexcept
 Checks whether the buffer just refers to data located outside the buffer, rather than stores it. More...
 
constexpr size_t capacity () const noexcept
 Returns the number of bytes that can be held in currently allocated storage. More...
 
constexpr size_t headroom () const noexcept
 Returns the number of bytes that available in currently allocated storage ahead the currently beginning of data. More...
 
constexpr size_t tailroom () const noexcept
 Returns the number of bytes that available in currently allocated storage after the currently data end. More...
 
constexpr const bytebyte_ptr () const noexcept
 Returns casted to const pointer to byte an address of data. More...
 
constexpr const byteend_byte_ptr () const noexcept
 Returns casted to const pointer to byte an end of data. More...
 
constexpr bytebyte_ptr () noexcept
 Returns casted to pointer to byte an address of data. More...
 
constexpr byteend_byte_ptr () noexcept
 Returns casted to pointer to byte an end of data. More...
 
constexpr const char * char_ptr () const noexcept
 Returns casted to const pointer to char an address of data. More...
 
constexpr const char * end_char_ptr () const noexcept
 Returns casted to const pointer to char an end of data. More...
 
constexpr char * char_ptr () noexcept
 Returns casted to pointer to char an address of data. More...
 
constexpr char * end_char_ptr () noexcept
 Returns casted to pointer to char an end of data. More...
 
constexpr const void * data () const noexcept
 Return a const pointer to the beginning of the referenced data. More...
 
constexpr const void * end () const noexcept
 Return a const pointer to the end of the referenced data. More...
 
constexpr void * data () noexcept
 Return a pointer to the beginning of the referenced data. More...
 
constexpr void * end () noexcept
 Return a pointer to the end of the referenced data. More...
 
constexpr size_t length () const noexcept
 Returns the number of bytes. More...
 
constexpr bufferset_length (size_t bytes)
 Set length of data. More...
 
constexpr bufferset_end (const void *ptr)
 Sets the length by specifying the end of the data. More...
 
void make_freestanding ()
 Makes buffer owning the data. More...
 
constexpr buffer () noexcept=default
 
constexpr buffer (const allocator_type &allocator) noexcept
 
 buffer (const struct slice &src, bool make_reference, const allocator_type &allocator=allocator_type())
 
 buffer (const buffer &src, bool make_reference, const allocator_type &allocator=allocator_type())
 
 buffer (const void *ptr, size_t bytes, bool make_reference, const allocator_type &allocator=allocator_type())
 
template<class CHAR , class T , class A >
 buffer (const ::std::basic_string< CHAR, T, A > &)=delete
 
template<class CHAR , class T , class A >
 buffer (const ::std::basic_string< CHAR, T, A > &&)=delete
 
 buffer (const char *c_str, bool make_reference, const allocator_type &allocator=allocator_type())
 
template<class CHAR , class T >
 buffer (const ::std::basic_string_view< CHAR, T > &view, bool make_reference, const allocator_type &allocator=allocator_type())
 
constexpr buffer (const struct slice &src, const allocator_type &allocator=allocator_type())
 
constexpr buffer (const buffer &src, const allocator_type &allocator=allocator_type())
 
constexpr buffer (const void *ptr, size_t bytes, const allocator_type &allocator=allocator_type())
 
template<class CHAR , class T , class A >
constexpr buffer (const ::std::basic_string< CHAR, T, A > &str, const allocator_type &allocator=allocator_type())
 
constexpr buffer (const char *c_str, const allocator_type &allocator=allocator_type())
 
template<class CHAR , class T >
constexpr buffer (const ::std::basic_string_view< CHAR, T > &view, const allocator_type &allocator=allocator_type())
 
 buffer (size_t head_room, size_t tail_room, const allocator_type &allocator=allocator_type())
 
 buffer (size_t capacity, const allocator_type &allocator=allocator_type())
 
 buffer (size_t head_room, const struct slice &src, size_t tail_room, const allocator_type &allocator=allocator_type())
 
 buffer (size_t head_room, const buffer &src, size_t tail_room, const allocator_type &allocator=allocator_type())
 
 buffer (const ::mdbx::txn &txn, const struct slice &src, const allocator_type &allocator=allocator_type())
 
 buffer (buffer &&src) noexcept(move_assign_alloc::is_nothrow())
 
constexpr const struct sliceslice () const noexcept
 
constexpr operator const struct slice & () const noexcept
 
template<typename POD >
constexpr buffer (const ::std::span< POD > &span)
 
template<typename POD >
constexpr ::std::span< const POD > as_span () const
 
template<typename POD >
constexpr ::std::span< POD > as_span ()
 
constexpr ::std::span< const bytebytes () const
 
constexpr ::std::span< bytebytes ()
 
constexpr ::std::span< const char > chars () const
 
constexpr ::std::span< char > chars ()
 
template<typename POD >
constexpr POD as_pod () const
 
constexpr uint128_t as_uint128 () const
 
constexpr uint64_t as_uint64 () const
 
constexpr uint32_t as_uint32 () const
 
constexpr uint16_t as_uint16 () const
 
constexpr uint8_t as_uint8 () const
 
constexpr int128_t as_int128 () const
 
constexpr int64_t as_int64 () const
 
constexpr int32_t as_int32 () const
 
constexpr int16_t as_int16 () const
 
constexpr int8_t as_int8 () const
 
uint128_t as_uint128_adapt () const
 
uint64_t as_uint64_adapt () const
 
uint32_t as_uint32_adapt () const
 
uint16_t as_uint16_adapt () const
 
uint8_t as_uint8_adapt () const
 
int128_t as_int128_adapt () const
 
int64_t as_int64_adapt () const
 
int32_t as_int32_adapt () const
 
int16_t as_int16_adapt () const
 
int8_t as_int8_adapt () const
 
buffer encode_hex (bool uppercase=false, unsigned wrap_width=0, const allocator_type &allocator=allocator_type()) const
 Returns a new buffer with a hexadecimal dump of the slice content. More...
 
buffer encode_base58 (unsigned wrap_width=0, const allocator_type &allocator=allocator_type()) const
 Returns a new buffer with a Base58 dump of the slice content. More...
 
buffer encode_base64 (unsigned wrap_width=0, const allocator_type &allocator=allocator_type()) const
 Returns a new buffer with a Base64 dump of the slice content. More...
 
buffer hex_decode (bool ignore_spaces=false, const allocator_type &allocator=allocator_type()) const
 Decodes hexadecimal dump from the buffer content to new returned buffer. More...
 
buffer base58_decode (bool ignore_spaces=false, const allocator_type &allocator=allocator_type()) const
 Decodes Base58 dump from the buffer content to new returned buffer. More...
 
buffer base64_decode (bool ignore_spaces=false, const allocator_type &allocator=allocator_type()) const
 Decodes Base64 dump from the buffer content to new returned buffer. More...
 
void reserve (size_t wanna_headroom, size_t wanna_tailroom)
 Reserves storage space. More...
 
void reserve_headroom (size_t wanna_headroom)
 Reserves space before the payload. More...
 
void reserve_tailroom (size_t wanna_tailroom)
 Reserves space after the payload. More...
 
bufferassign_reference (const void *ptr, size_t bytes)
 
bufferassign_freestanding (const void *ptr, size_t bytes)
 
constexpr void swap (buffer &other) noexcept(swap_alloc::is_nothrow())
 
bufferassign (const buffer &src, bool make_reference=false)
 
bufferassign (const void *ptr, size_t bytes, bool make_reference=false)
 
bufferassign (const struct slice &src, bool make_reference=false)
 
bufferassign (const ::MDBX_val &src, bool make_reference=false)
 
bufferassign (struct slice &&src, bool make_reference=false)
 
bufferassign (::MDBX_val &&src, bool make_reference=false)
 
bufferassign (const void *begin, const void *end, bool make_reference=false)
 
template<class CHAR , class T , class A >
bufferassign (const ::std::basic_string< CHAR, T, A > &str, bool make_reference=false)
 
bufferassign (const char *c_str, bool make_reference=false)
 
bufferoperator= (const buffer &src)
 
bufferoperator= (buffer &&src) noexcept(move_assign_alloc::is_nothrow())
 
bufferoperator= (const struct slice &src)
 
bufferoperator= (struct slice &&src)
 
template<class CHAR , class T >
bufferoperator= (const ::std::basic_string_view< CHAR, T > &view) noexcept
 
template<class CHAR = char, class T = ::std::char_traits<CHAR>>
::std::basic_string_view< CHAR, T > string_view () const noexcept
 Return a string_view that references the data of this buffer. More...
 
template<class CHAR , class T >
 operator::std::basic_string_view () const noexcept
 Return a string_view that references the data of this buffer. More...
 
constexpr bool empty () const noexcept
 Checks whether the string is empty. More...
 
constexpr bool is_null () const noexcept
 Checks whether the data pointer of the buffer is nullptr. More...
 
constexpr size_t size () const noexcept
 Returns the number of bytes. More...
 
constexpr size_t hash_value () const noexcept
 Returns the hash value of the data. More...
 
template<class CHAR = char, class T = ::std::char_traits<CHAR>, class A = legacy_allocator>
constexpr ::std::basic_string< CHAR, T, A > as_string (const A &allocator=A()) const
 
template<class CHAR , class T , class A >
constexpr operator::std::basic_string () const
 
bool starts_with (const struct slice &prefix) const noexcept
 Checks if the data starts with the given prefix. More...
 
bool ends_with (const struct slice &suffix) const noexcept
 Checks if the data ends with the given suffix. More...
 
void clear () noexcept
 Clears the contents and storage. More...
 
void clear_and_reserve (size_t whole_capacity, size_t headroom=0) noexcept
 Clears the contents and reserve storage. More...
 
void shrink_to_fit ()
 Reduces memory usage by freeing unused storage space. More...
 
void remove_prefix (size_t n) noexcept
 Drops the first "n" bytes from the data chunk. More...
 
void remove_suffix (size_t n) noexcept
 Drops the last "n" bytes from the data chunk. More...
 
void safe_remove_prefix (size_t n)
 Drops the first "n" bytes from the data chunk. More...
 
void safe_remove_suffix (size_t n)
 Drops the last "n" bytes from the data chunk. More...
 
constexpr byte operator[] (size_t n) const noexcept
 Accesses the specified byte of data chunk. More...
 
constexpr byteoperator[] (size_t n) noexcept
 Accesses the specified byte of data chunk. More...
 
constexpr byte at (size_t n) const
 Accesses the specified byte of data chunk with bounds checking. More...
 
constexpr byteat (size_t n)
 Accesses the specified byte of data chunk with bounds checking. More...
 
constexpr struct slice head (size_t n) const noexcept
 Returns the first "n" bytes of the data chunk. More...
 
constexpr struct slice tail (size_t n) const noexcept
 Returns the last "n" bytes of the data chunk. More...
 
constexpr struct slice middle (size_t from, size_t n) const noexcept
 Returns the middle "n" bytes of the data chunk. More...
 
constexpr struct slice safe_head (size_t n) const
 Returns the first "n" bytes of the data chunk. More...
 
constexpr struct slice safe_tail (size_t n) const
 Returns the last "n" bytes of the data chunk. More...
 
constexpr struct slice safe_middle (size_t from, size_t n) const
 Returns the middle "n" bytes of the data chunk. More...
 
bufferappend (const void *src, size_t bytes)
 
bufferappend (const struct slice &chunk)
 
bufferadd_header (const void *src, size_t bytes)
 
bufferadd_header (const struct slice &chunk)
 
template<MutableByteProducer PRODUCER>
bufferappend_producer (PRODUCER &producer)
 
template<ImmutableByteProducer PRODUCER>
bufferappend_producer (const PRODUCER &producer)
 
bufferappend_hex (const struct slice &data, bool uppercase=false, unsigned wrap_width=0)
 
bufferappend_base58 (const struct slice &data, unsigned wrap_width=0)
 
bufferappend_base64 (const struct slice &data, unsigned wrap_width=0)
 
bufferappend_decoded_hex (const struct slice &data, bool ignore_spaces=false)
 
bufferappend_decoded_base58 (const struct slice &data, bool ignore_spaces=false)
 
bufferappend_decoded_base64 (const struct slice &data, bool ignore_spaces=false)
 
bufferappend_u8 (uint_fast8_t u8)
 
bufferappend_byte (uint_fast8_t byte)
 
bufferappend_u16 (uint_fast16_t u16)
 
bufferappend_u24 (uint_fast32_t u24)
 
bufferappend_u32 (uint_fast32_t u32)
 
bufferappend_u48 (uint_fast64_t u48)
 
bufferappend_u64 (uint_fast64_t u64)
 
template<class ALLOCATOR , typename CAPACITY_POLICY >
 buffer (const txn &txn, const struct slice &src, const allocator_type &allocator)
 

Static Public Member Functions

template<typename POD >
static buffer wrap (const POD &pod, bool make_reference=false, const allocator_type &allocator=allocator_type())
 
static buffer hex (const ::mdbx::slice &source, bool uppercase=false, unsigned wrap_width=0, const allocator_type &allocator=allocator_type())
 Returns a new buffer with a hexadecimal dump of the slice content. More...
 
static buffer base58 (const ::mdbx::slice &source, unsigned wrap_width=0, const allocator_type &allocator=allocator_type())
 Returns a new buffer with a Base58 dump of the slice content. More...
 
static buffer base64 (const ::mdbx::slice &source, unsigned wrap_width=0, const allocator_type &allocator=allocator_type())
 Returns a new buffer with a Base64 dump of the slice content. More...
 
template<typename POD >
static buffer hex (const POD &pod, bool uppercase=false, unsigned wrap_width=0, const allocator_type &allocator=allocator_type())
 Returns a new buffer with a hexadecimal dump of the given pod. More...
 
template<typename POD >
static buffer base58 (const POD &pod, unsigned wrap_width=0, const allocator_type &allocator=allocator_type())
 Returns a new buffer with a Base58 dump of the given pod. More...
 
template<typename POD >
static buffer base64 (const POD &pod, unsigned wrap_width=0, const allocator_type &allocator=allocator_type())
 Returns a new buffer with a Base64 dump of the given pod. More...
 
static buffer hex_decode (const ::mdbx::slice &source, bool ignore_spaces=false, const allocator_type &allocator=allocator_type())
 Decodes hexadecimal dump from the slice content to returned buffer. More...
 
static buffer base58_decode (const ::mdbx::slice &source, bool ignore_spaces=false, const allocator_type &allocator=allocator_type())
 Decodes Base58 dump from the slice content to returned buffer. More...
 
static buffer base64_decode (const ::mdbx::slice &source, bool ignore_spaces=false, const allocator_type &allocator=allocator_type())
 Decodes Base64 dump from the slice content to returned buffer. More...
 
static buffer clone (const buffer &src, const allocator_type &allocator=allocator_type())
 
template<size_t SIZE>
static buffer key_from (const char(&text)[SIZE], bool make_reference=true)
 
template<class CHAR , class T >
static buffer key_from (const ::std::basic_string_view< CHAR, T > &src, bool make_reference=false)
 
static buffer key_from (const char *src, bool make_reference=false)
 
template<class CHAR , class T , class A >
static buffer key_from (const ::std::basic_string< CHAR, T, A > &src, bool make_reference=false)
 
static buffer key_from (silo &&src) noexcept
 
static buffer key_from_double (const double ieee754_64bit)
 
static buffer key_from (const double ieee754_64bit)
 
static buffer key_from (const double *ieee754_64bit)
 
static buffer key_from_u64 (const uint64_t unsigned_int64)
 
static buffer key_from (const uint64_t unsigned_int64)
 
static buffer key_from_i64 (const int64_t signed_int64)
 
static buffer key_from (const int64_t signed_int64)
 
static buffer key_from_jsonInteger (const int64_t json_integer)
 
static buffer key_from_float (const float ieee754_32bit)
 
static buffer key_from (const float ieee754_32bit)
 
static buffer key_from (const float *ieee754_32bit)
 
static buffer key_from_u32 (const uint32_t unsigned_int32)
 
static buffer key_from (const uint32_t unsigned_int32)
 
static buffer key_from_i32 (const int32_t signed_int32)
 
static buffer key_from (const int32_t signed_int32)
 

Friends

class txn
 

Member Typedef Documentation

◆ allocator_traits

template<class ALLOCATOR , typename CAPACITY_POLICY >
using mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::allocator_traits = ::std::allocator_traits<allocator_type>

◆ allocator_type

template<class ALLOCATOR , typename CAPACITY_POLICY >
using mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::allocator_type = typename ::std::allocator_traits< ALLOCATOR>::template rebind_alloc<uint64_t>

◆ copy_assign_alloc

template<class ALLOCATOR , typename CAPACITY_POLICY >
using mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::copy_assign_alloc = allocation_aware_details::copy_assign_alloc<silo, allocator_type>

◆ move_assign_alloc

template<class ALLOCATOR , typename CAPACITY_POLICY >
using mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::move_assign_alloc = allocation_aware_details::move_assign_alloc<silo, allocator_type>

◆ reservation_policy

template<class ALLOCATOR , typename CAPACITY_POLICY >
using mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::reservation_policy = CAPACITY_POLICY

Member Enumeration Documentation

◆ anonymous enum

template<class ALLOCATOR , typename CAPACITY_POLICY >
anonymous enum : size_t
Enumerator
max_length 
max_capacity 
extra_inplace_storage 
pettiness_threshold 

Constructor & Destructor Documentation

◆ buffer() [1/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( )
constexprdefaultnoexcept

◆ buffer() [2/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const allocator_type allocator)
inlineconstexprnoexcept

◆ buffer() [3/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const struct slice src,
bool  make_reference,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [4/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const buffer< ALLOCATOR, CAPACITY_POLICY > &  src,
bool  make_reference,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [5/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const void *  ptr,
size_t  bytes,
bool  make_reference,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [6/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T , class A >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const ::std::basic_string< CHAR, T, A > &  )
delete

◆ buffer() [7/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T , class A >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const ::std::basic_string< CHAR, T, A > &&  )
delete

◆ buffer() [8/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const char *  c_str,
bool  make_reference,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [9/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const ::std::basic_string_view< CHAR, T > &  view,
bool  make_reference,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [10/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const struct slice src,
const allocator_type allocator = allocator_type() 
)
inlineconstexpr

◆ buffer() [11/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const buffer< ALLOCATOR, CAPACITY_POLICY > &  src,
const allocator_type allocator = allocator_type() 
)
inlineconstexpr

◆ buffer() [12/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const void *  ptr,
size_t  bytes,
const allocator_type allocator = allocator_type() 
)
inlineconstexpr

◆ buffer() [13/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T , class A >
constexpr mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const ::std::basic_string< CHAR, T, A > &  str,
const allocator_type allocator = allocator_type() 
)
inlineconstexpr

◆ buffer() [14/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const char *  c_str,
const allocator_type allocator = allocator_type() 
)
inlineconstexpr

◆ buffer() [15/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T >
constexpr mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const ::std::basic_string_view< CHAR, T > &  view,
const allocator_type allocator = allocator_type() 
)
inlineconstexpr

◆ buffer() [16/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( size_t  head_room,
size_t  tail_room,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [17/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( size_t  capacity,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [18/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( size_t  head_room,
const struct slice src,
size_t  tail_room,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [19/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( size_t  head_room,
const buffer< ALLOCATOR, CAPACITY_POLICY > &  src,
size_t  tail_room,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [20/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const ::mdbx::txn txn,
const struct slice src,
const allocator_type allocator = allocator_type() 
)
inline

◆ buffer() [21/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( buffer< ALLOCATOR, CAPACITY_POLICY > &&  src)
inlinenoexcept

◆ buffer() [22/22]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<typename POD >
constexpr mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const ::std::span< POD > &  span)
inlineconstexpr

Member Function Documentation

◆ add_header() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::add_header ( const struct slice chunk)
inline

◆ add_header() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::add_header ( const void *  src,
size_t  bytes 
)
inline

◆ append() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append ( const struct slice chunk)
inline

◆ append() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append ( const void *  src,
size_t  bytes 
)
inline

◆ append_base58()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_base58 ( const struct slice data,
unsigned  wrap_width = 0 
)
inline

◆ append_base64()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_base64 ( const struct slice data,
unsigned  wrap_width = 0 
)
inline

◆ append_byte()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_byte ( uint_fast8_t  byte)
inline

◆ append_decoded_base58()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_decoded_base58 ( const struct slice data,
bool  ignore_spaces = false 
)
inline

◆ append_decoded_base64()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_decoded_base64 ( const struct slice data,
bool  ignore_spaces = false 
)
inline

◆ append_decoded_hex()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_decoded_hex ( const struct slice data,
bool  ignore_spaces = false 
)
inline

◆ append_hex()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_hex ( const struct slice data,
bool  uppercase = false,
unsigned  wrap_width = 0 
)
inline

◆ append_producer() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<ImmutableByteProducer PRODUCER>
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_producer ( const PRODUCER &  producer)
inline

◆ append_producer() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<MutableByteProducer PRODUCER>
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_producer ( PRODUCER &  producer)
inline

◆ append_u16()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_u16 ( uint_fast16_t  u16)
inline

◆ append_u24()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_u24 ( uint_fast32_t  u24)
inline

◆ append_u32()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_u32 ( uint_fast32_t  u32)
inline

◆ append_u48()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_u48 ( uint_fast64_t  u48)
inline

◆ append_u64()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_u64 ( uint_fast64_t  u64)
inline

◆ append_u8()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::append_u8 ( uint_fast8_t  u8)
inline

◆ as_int128()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr int128_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_int128 ( ) const
inlineconstexpr

◆ as_int128_adapt()

template<class ALLOCATOR , typename CAPACITY_POLICY >
int128_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_int128_adapt ( ) const
inline

◆ as_int16()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr int16_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_int16 ( ) const
inlineconstexpr

◆ as_int16_adapt()

template<class ALLOCATOR , typename CAPACITY_POLICY >
int16_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_int16_adapt ( ) const
inline

◆ as_int32()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr int32_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_int32 ( ) const
inlineconstexpr

◆ as_int32_adapt()

template<class ALLOCATOR , typename CAPACITY_POLICY >
int32_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_int32_adapt ( ) const
inline

◆ as_int64()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr int64_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_int64 ( ) const
inlineconstexpr

◆ as_int64_adapt()

template<class ALLOCATOR , typename CAPACITY_POLICY >
int64_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_int64_adapt ( ) const
inline

◆ as_int8()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr int8_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_int8 ( ) const
inlineconstexpr

◆ as_int8_adapt()

template<class ALLOCATOR , typename CAPACITY_POLICY >
int8_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_int8_adapt ( ) const
inline

◆ as_pod()

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<typename POD >
constexpr POD mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_pod ( ) const
inlineconstexpr

◆ as_span() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<typename POD >
constexpr ::std::span<POD> mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_span ( )
inlineconstexpr

◆ as_span() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<typename POD >
constexpr ::std::span<const POD> mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_span ( ) const
inline

◆ as_string()

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR = char, class T = ::std::char_traits<CHAR>, class A = legacy_allocator>
constexpr ::std::basic_string<CHAR, T, A> mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_string ( const A &  allocator = A()) const
inline

◆ as_uint128()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr uint128_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_uint128 ( ) const
inlineconstexpr

◆ as_uint128_adapt()

template<class ALLOCATOR , typename CAPACITY_POLICY >
uint128_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_uint128_adapt ( ) const
inline

◆ as_uint16()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr uint16_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_uint16 ( ) const
inlineconstexpr

◆ as_uint16_adapt()

template<class ALLOCATOR , typename CAPACITY_POLICY >
uint16_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_uint16_adapt ( ) const
inline

◆ as_uint32()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr uint32_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_uint32 ( ) const
inlineconstexpr

◆ as_uint32_adapt()

template<class ALLOCATOR , typename CAPACITY_POLICY >
uint32_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_uint32_adapt ( ) const
inline

◆ as_uint64()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr uint64_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_uint64 ( ) const
inlineconstexpr

◆ as_uint64_adapt()

template<class ALLOCATOR , typename CAPACITY_POLICY >
uint64_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_uint64_adapt ( ) const
inline

◆ as_uint8()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr uint8_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_uint8 ( ) const
inlineconstexpr

◆ as_uint8_adapt()

template<class ALLOCATOR , typename CAPACITY_POLICY >
uint8_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::as_uint8_adapt ( ) const
inline

◆ assign() [1/9]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign ( ::MDBX_val &&  src,
bool  make_reference = false 
)
inline

◆ assign() [2/9]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign ( const ::MDBX_val src,
bool  make_reference = false 
)
inline

◆ assign() [3/9]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T , class A >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign ( const ::std::basic_string< CHAR, T, A > &  str,
bool  make_reference = false 
)
inline

◆ assign() [4/9]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign ( const buffer< ALLOCATOR, CAPACITY_POLICY > &  src,
bool  make_reference = false 
)
inline

◆ assign() [5/9]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign ( const char *  c_str,
bool  make_reference = false 
)
inline

◆ assign() [6/9]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign ( const struct slice src,
bool  make_reference = false 
)
inline

◆ assign() [7/9]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign ( const void *  begin,
const void *  end,
bool  make_reference = false 
)
inline

◆ assign() [8/9]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign ( const void *  ptr,
size_t  bytes,
bool  make_reference = false 
)
inline

◆ assign() [9/9]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign ( struct slice &&  src,
bool  make_reference = false 
)
inline

◆ assign_freestanding()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign_freestanding ( const void *  ptr,
size_t  bytes 
)
inline

◆ assign_reference()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::assign_reference ( const void *  ptr,
size_t  bytes 
)
inline

◆ at() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr byte& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::at ( size_t  n)
inlineconstexpr

Accesses the specified byte of data chunk with bounds checking.

Exceptions
std::out_of_rangeif n >= size()

◆ at() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr byte mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::at ( size_t  n) const
inlineconstexpr

Accesses the specified byte of data chunk with bounds checking.

Exceptions
std::out_of_rangeif n >= size()

◆ base58() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::base58 ( const ::mdbx::slice source,
unsigned  wrap_width = 0,
const allocator_type allocator = allocator_type() 
)
inlinestatic

Returns a new buffer with a Base58 dump of the slice content.

◆ base58() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<typename POD >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::base58 ( const POD &  pod,
unsigned  wrap_width = 0,
const allocator_type allocator = allocator_type() 
)
inlinestatic

Returns a new buffer with a Base58 dump of the given pod.

◆ base58_decode() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::base58_decode ( bool  ignore_spaces = false,
const allocator_type allocator = allocator_type() 
) const
inline

Decodes Base58 dump from the buffer content to new returned buffer.

◆ base58_decode() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::base58_decode ( const ::mdbx::slice source,
bool  ignore_spaces = false,
const allocator_type allocator = allocator_type() 
)
inlinestatic

Decodes Base58 dump from the slice content to returned buffer.

◆ base64() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::base64 ( const ::mdbx::slice source,
unsigned  wrap_width = 0,
const allocator_type allocator = allocator_type() 
)
inlinestatic

Returns a new buffer with a Base64 dump of the slice content.

◆ base64() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<typename POD >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::base64 ( const POD &  pod,
unsigned  wrap_width = 0,
const allocator_type allocator = allocator_type() 
)
inlinestatic

Returns a new buffer with a Base64 dump of the given pod.

◆ base64_decode() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::base64_decode ( bool  ignore_spaces = false,
const allocator_type allocator = allocator_type() 
) const
inline

Decodes Base64 dump from the buffer content to new returned buffer.

◆ base64_decode() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::base64_decode ( const ::mdbx::slice source,
bool  ignore_spaces = false,
const allocator_type allocator = allocator_type() 
)
inlinestatic

Decodes Base64 dump from the slice content to returned buffer.

◆ byte_ptr() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr const byte* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::byte_ptr ( ) const
inlineconstexprnoexcept

Returns casted to const pointer to byte an address of data.

◆ byte_ptr() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr byte* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::byte_ptr ( )
inlineconstexprnoexcept

Returns casted to pointer to byte an address of data.

Precondition
REQUIRES: The buffer should store data chunk, but not referenced to an external one.

◆ bytes() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr ::std::span<byte> mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::bytes ( )
inline

◆ bytes() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr ::std::span<const byte> mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::bytes ( ) const
inline

◆ capacity()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr size_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::capacity ( ) const
inlineconstexprnoexcept

Returns the number of bytes that can be held in currently allocated storage.

◆ char_ptr() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr const char* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::char_ptr ( ) const
inlineconstexprnoexcept

Returns casted to const pointer to char an address of data.

◆ char_ptr() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr char* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::char_ptr ( )
inlineconstexprnoexcept

Returns casted to pointer to char an address of data.

Precondition
REQUIRES: The buffer should store data chunk, but not referenced to an external one.

◆ chars() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr ::std::span<char> mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::chars ( )
inline

◆ chars() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr ::std::span<const char> mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::chars ( ) const
inline

◆ clear()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::clear ( )
inlinenoexcept

Clears the contents and storage.

◆ clear_and_reserve()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::clear_and_reserve ( size_t  whole_capacity,
size_t  headroom = 0 
)
inlinenoexcept

Clears the contents and reserve storage.

◆ clone()

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::clone ( const buffer< ALLOCATOR, CAPACITY_POLICY > &  src,
const allocator_type allocator = allocator_type() 
)
inlinestatic

◆ data() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr const void* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::data ( ) const
inlineconstexprnoexcept

Return a const pointer to the beginning of the referenced data.

◆ data() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr void* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::data ( )
inlineconstexprnoexcept

Return a pointer to the beginning of the referenced data.

Precondition
REQUIRES: The buffer should store data chunk, but not referenced to an external one.

◆ empty()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr bool mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::empty ( ) const
inlineconstexprnoexcept

Checks whether the string is empty.

◆ encode_base58()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::encode_base58 ( unsigned  wrap_width = 0,
const allocator_type allocator = allocator_type() 
) const
inline

Returns a new buffer with a Base58 dump of the slice content.

◆ encode_base64()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::encode_base64 ( unsigned  wrap_width = 0,
const allocator_type allocator = allocator_type() 
) const
inline

Returns a new buffer with a Base64 dump of the slice content.

◆ encode_hex()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::encode_hex ( bool  uppercase = false,
unsigned  wrap_width = 0,
const allocator_type allocator = allocator_type() 
) const
inline

Returns a new buffer with a hexadecimal dump of the slice content.

◆ end() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr const void* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::end ( ) const
inlineconstexprnoexcept

Return a const pointer to the end of the referenced data.

◆ end() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr void* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::end ( )
inlineconstexprnoexcept

Return a pointer to the end of the referenced data.

Precondition
REQUIRES: The buffer should store data chunk, but not referenced to an external one.

◆ end_byte_ptr() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr const byte* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::end_byte_ptr ( ) const
inlineconstexprnoexcept

Returns casted to const pointer to byte an end of data.

◆ end_byte_ptr() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr byte* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::end_byte_ptr ( )
inlineconstexprnoexcept

Returns casted to pointer to byte an end of data.

Precondition
REQUIRES: The buffer should store data chunk, but not referenced to an external one.

◆ end_char_ptr() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr const char* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::end_char_ptr ( ) const
inlineconstexprnoexcept

Returns casted to const pointer to char an end of data.

◆ end_char_ptr() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr char* mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::end_char_ptr ( )
inlineconstexprnoexcept

Returns casted to pointer to char an end of data.

Precondition
REQUIRES: The buffer should store data chunk, but not referenced to an external one.

◆ ends_with()

template<class ALLOCATOR , typename CAPACITY_POLICY >
bool mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::ends_with ( const struct slice suffix) const
inlinenoexcept

Checks if the data ends with the given suffix.

◆ get_allocator()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr allocator_type mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::get_allocator ( ) const
inlineconstexpr

Returns the associated allocator.

◆ hash_value()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr size_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::hash_value ( ) const
inlineconstexprnoexcept

Returns the hash value of the data.

Attention
Function implementation and returned hash values may changed version to version, and in future the t1ha3 will be used here. Therefore values obtained from this function shouldn't be persisted anywhere.

◆ head()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr struct slice mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::head ( size_t  n) const
inlinenoexcept

Returns the first "n" bytes of the data chunk.

Precondition
REQUIRES: n <= size()

◆ headroom()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr size_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::headroom ( ) const
inlineconstexprnoexcept

Returns the number of bytes that available in currently allocated storage ahead the currently beginning of data.

◆ hex() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::hex ( const ::mdbx::slice source,
bool  uppercase = false,
unsigned  wrap_width = 0,
const allocator_type allocator = allocator_type() 
)
inlinestatic

Returns a new buffer with a hexadecimal dump of the slice content.

◆ hex() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<typename POD >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::hex ( const POD &  pod,
bool  uppercase = false,
unsigned  wrap_width = 0,
const allocator_type allocator = allocator_type() 
)
inlinestatic

Returns a new buffer with a hexadecimal dump of the given pod.

◆ hex_decode() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::hex_decode ( bool  ignore_spaces = false,
const allocator_type allocator = allocator_type() 
) const
inline

Decodes hexadecimal dump from the buffer content to new returned buffer.

◆ hex_decode() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::hex_decode ( const ::mdbx::slice source,
bool  ignore_spaces = false,
const allocator_type allocator = allocator_type() 
)
inlinestatic

Decodes hexadecimal dump from the slice content to returned buffer.

◆ is_freestanding()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr bool mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::is_freestanding ( ) const
inlineconstexprnoexcept

Checks whether data chunk stored inside the buffer, otherwise buffer just refers to data located outside the buffer.

◆ is_null()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr bool mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::is_null ( ) const
inlineconstexprnoexcept

Checks whether the data pointer of the buffer is nullptr.

◆ is_reference()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr bool mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::is_reference ( ) const
inlineconstexprnoexcept

Checks whether the buffer just refers to data located outside the buffer, rather than stores it.

◆ key_from() [1/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T , class A >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const ::std::basic_string< CHAR, T, A > &  src,
bool  make_reference = false 
)
inlinestatic

◆ key_from() [2/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const ::std::basic_string_view< CHAR, T > &  src,
bool  make_reference = false 
)
inlinestatic

◆ key_from() [3/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const char *  src,
bool  make_reference = false 
)
inlinestatic

◆ key_from() [4/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<size_t SIZE>
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const char(&)  text[SIZE],
bool  make_reference = true 
)
inlinestatic

◆ key_from() [5/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const double *  ieee754_64bit)
inlinestatic

◆ key_from() [6/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const double  ieee754_64bit)
inlinestatic

◆ key_from() [7/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const float *  ieee754_32bit)
inlinestatic

◆ key_from() [8/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const float  ieee754_32bit)
inlinestatic

◆ key_from() [9/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const int32_t  signed_int32)
inlinestatic

◆ key_from() [10/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const int64_t  signed_int64)
inlinestatic

◆ key_from() [11/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const uint32_t  unsigned_int32)
inlinestatic

◆ key_from() [12/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( const uint64_t  unsigned_int64)
inlinestatic

◆ key_from() [13/13]

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from ( silo &&  src)
inlinestaticnoexcept

◆ key_from_double()

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from_double ( const double  ieee754_64bit)
inlinestatic

◆ key_from_float()

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from_float ( const float  ieee754_32bit)
inlinestatic

◆ key_from_i32()

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from_i32 ( const int32_t  signed_int32)
inlinestatic

◆ key_from_i64()

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from_i64 ( const int64_t  signed_int64)
inlinestatic

◆ key_from_jsonInteger()

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from_jsonInteger ( const int64_t  json_integer)
inlinestatic

◆ key_from_u32()

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from_u32 ( const uint32_t  unsigned_int32)
inlinestatic

◆ key_from_u64()

template<class ALLOCATOR , typename CAPACITY_POLICY >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::key_from_u64 ( const uint64_t  unsigned_int64)
inlinestatic

◆ length()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr size_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::length ( ) const
inlineconstexprnoexcept

Returns the number of bytes.

◆ make_freestanding()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::make_freestanding ( )
inline

Makes buffer owning the data.

If buffer refers to an external data, then makes it the owner of clone by allocating storage and copying the data.

◆ middle()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr struct slice mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::middle ( size_t  from,
size_t  n 
) const
inlinenoexcept

Returns the middle "n" bytes of the data chunk.

Precondition
REQUIRES: from + n <= size()

◆ operator const struct slice &()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::operator const struct slice & ( ) const
inlineconstexprnoexcept

◆ operator::std::basic_string()

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T , class A >
constexpr mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::operator::std::basic_string ( ) const
inlineexplicitconstexpr

◆ operator::std::basic_string_view()

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::operator::std::basic_string_view ( ) const
inlinenoexcept

Return a string_view that references the data of this buffer.

◆ operator=() [1/5]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::operator= ( buffer< ALLOCATOR, CAPACITY_POLICY > &&  src)
inlinenoexcept

◆ operator=() [2/5]

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR , class T >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::operator= ( const ::std::basic_string_view< CHAR, T > &  view)
inlinenoexcept

◆ operator=() [3/5]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::operator= ( const buffer< ALLOCATOR, CAPACITY_POLICY > &  src)
inline

◆ operator=() [4/5]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::operator= ( const struct slice src)
inline

◆ operator=() [5/5]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::operator= ( struct slice &&  src)
inline

◆ operator[]() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr byte mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::operator[] ( size_t  n) const
inlineconstexprnoexcept

Accesses the specified byte of data chunk.

Precondition
REQUIRES: n < size()

◆ operator[]() [2/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr byte& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::operator[] ( size_t  n)
inlineconstexprnoexcept

Accesses the specified byte of data chunk.

Precondition
REQUIRES: n < size()

◆ remove_prefix()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::remove_prefix ( size_t  n)
inlinenoexcept

Drops the first "n" bytes from the data chunk.

Precondition
REQUIRES: n <= size()

◆ remove_suffix()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::remove_suffix ( size_t  n)
inlinenoexcept

Drops the last "n" bytes from the data chunk.

Precondition
REQUIRES: n <= size()

◆ reserve()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::reserve ( size_t  wanna_headroom,
size_t  wanna_tailroom 
)
inline

Reserves storage space.

◆ reserve_headroom()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::reserve_headroom ( size_t  wanna_headroom)
inline

Reserves space before the payload.

◆ reserve_tailroom()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::reserve_tailroom ( size_t  wanna_tailroom)
inline

Reserves space after the payload.

◆ safe_head()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr struct slice mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::safe_head ( size_t  n) const
inline

Returns the first "n" bytes of the data chunk.

Exceptions
std::out_of_rangeif n >= size()

◆ safe_middle()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr struct slice mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::safe_middle ( size_t  from,
size_t  n 
) const
inline

Returns the middle "n" bytes of the data chunk.

Exceptions
std::out_of_rangeif from + n >= size()

◆ safe_remove_prefix()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::safe_remove_prefix ( size_t  n)
inline

Drops the first "n" bytes from the data chunk.

Exceptions
std::out_of_rangeif n > size()

◆ safe_remove_suffix()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::safe_remove_suffix ( size_t  n)
inline

Drops the last "n" bytes from the data chunk.

Exceptions
std::out_of_rangeif n > size()

◆ safe_tail()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr struct slice mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::safe_tail ( size_t  n) const
inline

Returns the last "n" bytes of the data chunk.

Exceptions
std::out_of_rangeif n >= size()

◆ set_end()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::set_end ( const void *  ptr)
inlineconstexpr

Sets the length by specifying the end of the data.

◆ set_length()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr buffer& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::set_length ( size_t  bytes)
inlineconstexpr

Set length of data.

◆ shrink_to_fit()

template<class ALLOCATOR , typename CAPACITY_POLICY >
void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::shrink_to_fit ( )
inline

Reduces memory usage by freeing unused storage space.

◆ size()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr size_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::size ( ) const
inlineconstexprnoexcept

Returns the number of bytes.

◆ slice()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr const struct slice& mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::slice ( ) const
inlinenoexcept

◆ starts_with()

template<class ALLOCATOR , typename CAPACITY_POLICY >
bool mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::starts_with ( const struct slice prefix) const
inlinenoexcept

Checks if the data starts with the given prefix.

◆ string_view()

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class CHAR = char, class T = ::std::char_traits<CHAR>>
::std::basic_string_view<CHAR, T> mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::string_view ( ) const
inlinenoexcept

Return a string_view that references the data of this buffer.

◆ swap()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr void mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::swap ( buffer< ALLOCATOR, CAPACITY_POLICY > &  other)
inlineconstexprnoexcept

◆ tail()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr struct slice mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::tail ( size_t  n) const
inlinenoexcept

Returns the last "n" bytes of the data chunk.

Precondition
REQUIRES: n <= size()

◆ tailroom()

template<class ALLOCATOR , typename CAPACITY_POLICY >
constexpr size_t mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::tailroom ( ) const
inlineconstexprnoexcept

Returns the number of bytes that available in currently allocated storage after the currently data end.

◆ wrap()

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<typename POD >
static buffer mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::wrap ( const POD &  pod,
bool  make_reference = false,
const allocator_type allocator = allocator_type() 
)
inlinestatic

Friends And Related Function Documentation

◆ txn

template<class ALLOCATOR , typename CAPACITY_POLICY >
friend class txn
friend

◆ mdbx::map_handle

struct mdbx::map_handle

A handle for an individual database (key-value spaces) in the environment.

See also
txn::open_map()
txn::create_map()
txn::clear_map()
txn::drop_map()
txn::get_handle_info()
txn::get_map_stat()
env::close_map()
cursor::map()

Public Types

using flags = ::MDBX_db_flags_t
 
using state = ::MDBX_dbi_state_t
 

Public Member Functions

constexpr map_handle () noexcept
 
constexpr map_handle (MDBX_dbi dbi) noexcept
 
 map_handle (const map_handle &) noexcept=default
 
map_handleoperator= (const map_handle &) noexcept=default
 
 operator MDBX_dbi () const
 

Public Attributes

MDBX_dbi dbi {0}
 

Member Typedef Documentation

◆ flags

◆ state

Constructor & Destructor Documentation

◆ map_handle() [1/3]

constexpr mdbx::map_handle::map_handle ( )
inlineconstexprnoexcept

◆ map_handle() [2/3]

constexpr mdbx::map_handle::map_handle ( MDBX_dbi  dbi)
inlineconstexprnoexcept

◆ map_handle() [3/3]

mdbx::map_handle::map_handle ( const map_handle )
defaultnoexcept

Member Function Documentation

◆ operator MDBX_dbi()

mdbx::map_handle::operator MDBX_dbi ( ) const
inline

◆ operator=()

map_handle& mdbx::map_handle::operator= ( const map_handle )
defaultnoexcept

Member Data Documentation

◆ dbi

MDBX_dbi mdbx::map_handle::dbi {0}

◆ mdbx::env

class mdbx::env

Unmanaged database environment.

Like other unmanaged classes, env allows copying and assignment for instances, but does not destroys the represented underlying object from the own class destructor.

An environment supports multiple key-value sub-databases (aka key-value spaces or tables), all residing in the same shared-memory map.

Inheritance diagram for mdbx::env:
mdbx::env_managed

Public Types

enum  mode { readonly , write_file_io , write_mapped_io }
 Operation mode. More...
 
enum  durability { robust_synchronous , half_synchronous_weak_last , lazy_weak_tail , whole_fragile }
 Durability level. More...
 
enum  remove_mode { just_remove = MDBX_ENV_JUST_DELETE , ensure_unused = MDBX_ENV_ENSURE_UNUSED , wait_for_unused = MDBX_ENV_WAIT_FOR_UNUSED }
 Deletion modes for remove(). More...
 
enum class  extra_runtime_option {
  max_maps = MDBX_opt_max_db , max_readers = MDBX_opt_max_readers , sync_bytes = MDBX_opt_sync_bytes , sync_period = MDBX_opt_sync_period ,
  rp_augment_limit = MDBX_opt_rp_augment_limit , loose_limit = MDBX_opt_loose_limit , dp_reserve_limit = MDBX_opt_dp_reserve_limit , dp_limit = MDBX_opt_txn_dp_limit ,
  dp_initial = MDBX_opt_txn_dp_initial , spill_max_denominator = MDBX_opt_spill_max_denominator , spill_min_denominator = MDBX_opt_spill_min_denominator , spill_parent4child_denominator = MDBX_opt_spill_parent4child_denominator ,
  merge_threshold_16dot16_percent = MDBX_opt_merge_threshold_16dot16_percent , writethrough_threshold = MDBX_opt_writethrough_threshold , prefault_write_enable = MDBX_opt_prefault_write_enable
}
 
using stat = ::MDBX_stat
 Statistics for a database in the MDBX environment. More...
 
using info = ::MDBX_envinfo
 Information about the environment. More...
 

Public Member Functions

constexpr env () noexcept=default
 
 env (const env &) noexcept=default
 
envoperator= (env &&other) noexcept
 
 env (env &&other) noexcept
 
 ~env () noexcept
 
constexpr operator const MDBX_env * () const
 
constexpr operator MDBX_env * ()
 
env::operate_parameters get_operation_parameters () const
 Returns current operation parameters. More...
 
env::mode get_mode () const
 Returns current operation mode. More...
 
env::durability get_durability () const
 Returns current durability mode. More...
 
env::reclaiming_options get_reclaiming () const
 Returns current reclaiming options. More...
 
env::operate_options get_options () const
 Returns current operate options. More...
 
bool is_pristine () const
 Returns true for a freshly created database, but false if at least one transaction was committed. More...
 
bool is_empty () const
 Checks whether the database is empty. More...
 
size_t dbsize_min () const
 Returns the minimal database size in bytes for the environment. More...
 
size_t dbsize_max () const
 Returns the maximal database size in bytes for the environment. More...
 
size_t key_min (key_mode mode) const noexcept
 Returns the minimal key size in bytes for specified keys mode. More...
 
size_t key_max (key_mode mode) const
 Returns the maximal key size in bytes for specified keys mode. More...
 
size_t value_min (value_mode mode) const noexcept
 Returns the minimal value size in bytes for specified values mode. More...
 
size_t value_max (value_mode mode) const
 Returns the maximal value size in bytes for specified values mode. More...
 
size_t transaction_size_max () const
 Returns the maximal write transaction size (i.e. limit for summary volume of dirty pages) in bytes. More...
 
envcopy (const ::mdbx::filesystem::path &destination, bool compactify, bool force_dynamic_size=false)
 Make a copy (backup) of an existing environment to the specified path. More...
 
envcopy (const ::std::wstring &destination, bool compactify, bool force_dynamic_size=false)
 
envcopy (const wchar_t *destination, bool compactify, bool force_dynamic_size=false)
 
envcopy (const ::std::string &destination, bool compactify, bool force_dynamic_size=false)
 
envcopy (const char *destination, bool compactify, bool force_dynamic_size=false)
 
envcopy (filehandle fd, bool compactify, bool force_dynamic_size=false)
 Copy an environment to the specified file descriptor. More...
 
stat get_stat () const
 Returns snapshot statistics about the MDBX environment. More...
 
size_t get_pagesize () const
 Returns pagesize of this MDBX environment. More...
 
info get_info () const
 Return snapshot information about the MDBX environment. More...
 
stat get_stat (const txn &) const
 Return statistics about the MDBX environment accordingly to the specified transaction. More...
 
info get_info (const txn &) const
 Return information about the MDBX environment accordingly to the specified transaction. More...
 
filehandle get_filehandle () const
 Returns the file descriptor for the DXB file of MDBX environment. More...
 
path get_path () const
 Return the path that was used for opening the environment. More...
 
MDBX_env_flags_t get_flags () const
 Returns environment flags. More...
 
unsigned max_readers () const
 Returns the maximum number of threads/reader slots for the environment. More...
 
unsigned max_maps () const
 Returns the maximum number of named databases for the environment. More...
 
void * get_context () const noexcept
 Returns the application context associated with the environment. More...
 
envset_context (void *your_context)
 Sets the application context associated with the environment. More...
 
envset_sync_threshold (size_t bytes)
 Sets threshold to force flush the data buffers to disk, for non-sync durability modes. More...
 
size_t sync_threshold () const
 Gets threshold used to force flush the data buffers to disk, for non-sync durability modes. More...
 
envset_sync_period (const duration &period)
 Sets relative period since the last unsteady commit to force flush the data buffers to disk, for non-sync durability modes. More...
 
duration sync_period () const
 Gets relative period since the last unsteady commit that used to force flush the data buffers to disk, for non-sync durability modes. More...
 
envset_sync_period__seconds_16dot16 (unsigned seconds_16dot16)
 Sets relative period since the last unsteady commit to force flush the data buffers to disk, for non-sync durability modes. More...
 
unsigned sync_period__seconds_16dot16 () const
 Gets relative period since the last unsteady commit that used to force flush the data buffers to disk, for non-sync durability modes. More...
 
envset_sync_period__seconds_double (double seconds)
 Sets relative period since the last unsteady commit to force flush the data buffers to disk, for non-sync durability modes. More...
 
double sync_period__seconds_double () const
 Gets relative period since the last unsteady commit that used to force flush the data buffers to disk, for non-sync durability modes. More...
 
envset_extra_option (extra_runtime_option option, uint64_t value)
 Sets the value of a extra runtime options for an environment. More...
 
uint64_t extra_option (extra_runtime_option option) const
 Gets the value of extra runtime options from an environment. More...
 
envalter_flags (MDBX_env_flags_t flags, bool on_off)
 Alter environment flags. More...
 
envset_geometry (const geometry &size)
 Set all size-related parameters of environment. More...
 
bool sync_to_disk (bool force=true, bool nonblock=false)
 Flush the environment data buffers. More...
 
bool poll_sync_to_disk ()
 Performs non-blocking polling of sync-to-disk thresholds. More...
 
void close_map (const map_handle &)
 Close a key-value map (aka sub-database) handle. Normally unnecessary. More...
 
template<typename VISITOR >
int enumerate_readers (VISITOR &visitor)
 Enumerate readers. More...
 
unsigned check_readers ()
 Checks for stale readers in the lock table and return number of cleared slots. More...
 
envset_HandleSlowReaders (MDBX_hsr_func *)
 Sets a Handle-Slow-Readers callback to resolve database full/overflow issue due to a reader(s) which prevents the old data from being recycled. More...
 
MDBX_hsr_funcget_HandleSlowReaders () const noexcept
 Returns the current Handle-Slow-Readers callback used to resolve database full/overflow issue due to a reader(s) which prevents the old data from being recycled. More...
 
txn_managed start_read () const
 Starts read (read-only) transaction. More...
 
txn_managed prepare_read () const
 Creates but not start read transaction. More...
 
txn_managed start_write (bool dont_wait=false)
 Starts write (read-write) transaction. More...
 
txn_managed try_start_write ()
 Tries to start write (read-write) transaction without blocking. More...
 

Static Public Member Functions

static size_t default_pagesize () noexcept
 Returns default page size for current system/platform. More...
 
static bool remove (const ::mdbx::filesystem::path &pathname, const remove_mode mode=just_remove)
 Removes the environment's files in a proper and multiprocess-safe way. More...
 
static bool remove (const ::std::wstring &pathname, const remove_mode mode=just_remove)
 
static bool remove (const wchar_t *pathname, const remove_mode mode=just_remove)
 
static bool remove (const ::std::string &pathname, const remove_mode mode=just_remove)
 
static bool remove (const char *pathname, const remove_mode mode=just_remove)
 

Protected Member Functions

constexpr env (MDBX_env *ptr) noexcept
 

Protected Attributes

MDBX_envhandle_ {nullptr}
 

Friends

class txn
 
constexpr friend bool operator== (const env &a, const env &b) noexcept
 
constexpr friend bool operator!= (const env &a, const env &b) noexcept
 

Member Typedef Documentation

◆ info

Information about the environment.

◆ stat

Statistics for a database in the MDBX environment.

Member Enumeration Documentation

◆ durability

Durability level.

Enumerator
robust_synchronous 

Default robust and durable sync mode.

Metadata is written and flushed to disk after a data is written and flushed, which guarantees the integrity of the database in the event of a crash at any time.

Attention
Please do not use other modes until you have studied all the details and are sure. Otherwise, you may lose your users' data, as happens in Miranda NG messenger.
half_synchronous_weak_last 

Don't sync the meta-page after commit.

Flush system buffers to disk only once per transaction commit, omit the metadata flush. Defer that until the system flushes files to disk, or next non-MDBX_RDONLY commit or mdbx_env_sync(). Depending on the platform and hardware, with MDBX_NOMETASYNC you may get a doubling of write performance.

This trade-off maintains database integrity, but a system crash may undo the last committed transaction. I.e. it preserves the ACI (atomicity, consistency, isolation) but not D (durability) database property.

MDBX_NOMETASYNC flag may be changed at any time using mdbx_env_set_flags() or by passing to mdbx_txn_begin() for particular write transaction.

See also
SYNC MODES
lazy_weak_tail 

Don't sync anything but keep previous steady commits.

Like MDBX_UTTERLY_NOSYNC the MDBX_SAFE_NOSYNC flag disable similarly flush system buffers to disk when committing a transaction. But there is a huge difference in how are recycled the MVCC snapshots corresponding to previous "steady" transactions (see below).

With MDBX_WRITEMAP the MDBX_SAFE_NOSYNC instructs MDBX to use asynchronous mmap-flushes to disk. Asynchronous mmap-flushes means that actually all writes will scheduled and performed by operation system on it own manner, i.e. unordered. MDBX itself just notify operating system that it would be nice to write data to disk, but no more.

Depending on the platform and hardware, with MDBX_SAFE_NOSYNC you may get a multiple increase of write performance, even 10 times or more.

In contrast to MDBX_UTTERLY_NOSYNC mode, with MDBX_SAFE_NOSYNC flag MDBX will keeps untouched pages within B-tree of the last transaction "steady" which was synced to disk completely. This has big implications for both data durability and (unfortunately) performance:

  • a system crash can't corrupt the database, but you will lose the last transactions; because MDBX will rollback to last steady commit since it kept explicitly.
  • the last steady transaction makes an effect similar to "long-lived" read transaction (see above in the Restrictions & Caveats section) since prevents reuse of pages freed by newer write transactions, thus the any data changes will be placed in newly allocated pages.
  • to avoid rapid database growth, the system will sync data and issue a steady commit-point to resume reuse pages, each time there is insufficient space and before increasing the size of the file on disk.

In other words, with MDBX_SAFE_NOSYNC flag MDBX insures you from the whole database corruption, at the cost increasing database size and/or number of disk IOPs. So, MDBX_SAFE_NOSYNC flag could be used with mdbx_env_sync() as alternatively for batch committing or nested transaction (in some cases). As well, auto-sync feature exposed by mdbx_env_set_syncbytes() and mdbx_env_set_syncperiod() functions could be very useful with MDBX_SAFE_NOSYNC flag.

The number and volume of of disk IOPs with MDBX_SAFE_NOSYNC flag will exactly the as without any no-sync flags. However, you should expect a larger process's work set and significantly worse a locality of reference, due to the more intensive allocation of previously unused pages and increase the size of the database.

MDBX_SAFE_NOSYNC flag may be changed at any time using mdbx_env_set_flags() or by passing to mdbx_txn_begin() for particular write transaction.

whole_fragile 

Don't sync anything and wipe previous steady commits.

Don't flush system buffers to disk when committing a transaction. This optimization means a system crash can corrupt the database, if buffers are not yet flushed to disk. Depending on the platform and hardware, with MDBX_UTTERLY_NOSYNC you may get a multiple increase of write performance, even 100 times or more.

If the filesystem preserves write order (which is rare and never provided unless explicitly noted) and the MDBX_WRITEMAP and MDBX_LIFORECLAIM flags are not used, then a system crash can't corrupt the database, but you can lose the last transactions, if at least one buffer is not yet flushed to disk. The risk is governed by how often the system flushes dirty buffers to disk and how often mdbx_env_sync() is called. So, transactions exhibit ACI (atomicity, consistency, isolation) properties and only lose D (durability). I.e. database integrity is maintained, but a system crash may undo the final transactions.

Otherwise, if the filesystem not preserves write order (which is typically) or MDBX_WRITEMAP or MDBX_LIFORECLAIM flags are used, you should expect the corrupted database after a system crash.

So, most important thing about MDBX_UTTERLY_NOSYNC:

  • a system crash immediately after commit the write transaction high likely lead to database corruption.
  • successful completion of mdbx_env_sync(force = true) after one or more committed transactions guarantees consistency and durability.
  • BUT by committing two or more transactions you back database into a weak state, in which a system crash may lead to database corruption! In case single transaction after mdbx_env_sync, you may lose transaction itself, but not a whole database.

Nevertheless, MDBX_UTTERLY_NOSYNC provides "weak" durability in case of an application crash (but no durability on system failure), and therefore may be very useful in scenarios where data durability is not required over a system failure (e.g for short-lived data), or if you can take such risk.

MDBX_UTTERLY_NOSYNC flag may be changed at any time using mdbx_env_set_flags(), but don't has effect if passed to mdbx_txn_begin() for particular write transaction.

See also
SYNC MODES

◆ extra_runtime_option

Enumerator
max_maps 

Controls the maximum number of named databases for the environment.

By default only unnamed key-value database could used and appropriate value should set by MDBX_opt_max_db to using any more named subDB(s). To reduce overhead, use the minimum sufficient value. This option may only set after mdbx_env_create() and before mdbx_env_open().

See also
mdbx_env_set_maxdbs()
mdbx_env_get_maxdbs()
max_maps()
env::operate_parameters::max_maps
max_readers 

Defines the maximum number of threads/reader slots for all processes interacting with the database.

This defines the number of slots in the lock table that is used to track readers in the the environment. The default is about 100 for 4K system page size. Starting a read-only transaction normally ties a lock table slot to the current thread until the environment closes or the thread exits. If MDBX_NOSTICKYTHREADS is in use, mdbx_txn_begin() instead ties the slot to the MDBX_txn object until it or the MDBX_env object is destroyed. This option may only set after mdbx_env_create() and before mdbx_env_open(), and has an effect only when the database is opened by the first process interacts with the database.

See also
mdbx_env_set_maxreaders()
mdbx_env_get_maxreaders()
max_readers()
env::operate_parameters::max_readers
sync_bytes 

Controls interprocess/shared threshold to force flush the data buffers to disk, if MDBX_SAFE_NOSYNC is used.

See also
mdbx_env_set_syncbytes()
mdbx_env_get_syncbytes()
sync_threshold()
set_sync_threshold()
sync_period 

Controls interprocess/shared relative period since the last unsteady commit to force flush the data buffers to disk, if MDBX_SAFE_NOSYNC is used.

See also
mdbx_env_set_syncperiod()
mdbx_env_get_syncperiod()
sync_period()
set_sync_period()
rp_augment_limit 

Controls the in-process limit to grow a list of reclaimed/recycled page's numbers for finding a sequence of contiguous pages for large data items.

See also
MDBX_opt_gc_time_limit

A long values requires allocation of contiguous database pages. To find such sequences, it may be necessary to accumulate very large lists, especially when placing very long values (more than a megabyte) in a large databases (several tens of gigabytes), which is much expensive in extreme cases. This threshold allows you to avoid such costs by allocating new pages at the end of the database (with its possible growth on disk), instead of further accumulating/reclaiming Garbage Collection records.

On the other hand, too small threshold will lead to unreasonable database growth, or/and to the inability of put long values.

The MDBX_opt_rp_augment_limit controls described limit for the current process. By default this limit adjusted dynamically to 1/3 of current quantity of DB pages, which is usually enough for most cases.

loose_limit 

Controls the in-process limit to grow a cache of dirty pages for reuse in the current transaction.

A 'dirty page' refers to a page that has been updated in memory only, the changes to a dirty page are not yet stored on disk. To reduce overhead, it is reasonable to release not all such pages immediately, but to leave some ones in cache for reuse in the current transaction.

The MDBX_opt_loose_limit allows you to set a limit for such cache inside the current process. Should be in the range 0..255, default is 64.

dp_reserve_limit 

Controls the in-process limit of a pre-allocated memory items for dirty pages.

A 'dirty page' refers to a page that has been updated in memory only, the changes to a dirty page are not yet stored on disk. Without MDBX_WRITEMAP dirty pages are allocated from memory and released when a transaction is committed. To reduce overhead, it is reasonable to release not all ones, but to leave some allocations in reserve for reuse in the next transaction(s).

The MDBX_opt_dp_reserve_limit allows you to set a limit for such reserve inside the current process. Default is 1024.

dp_limit 

Controls the in-process limit of dirty pages for a write transaction.

A 'dirty page' refers to a page that has been updated in memory only, the changes to a dirty page are not yet stored on disk. Without MDBX_WRITEMAP dirty pages are allocated from memory and will be busy until are written to disk. Therefore for a large transactions is reasonable to limit dirty pages collecting above an some threshold but spill to disk instead.

The MDBX_opt_txn_dp_limit controls described threshold for the current process. Default is 65536, it is usually enough for most cases.

dp_initial 

Controls the in-process initial allocation size for dirty pages list of a write transaction. Default is 1024.

spill_max_denominator 

Controls the in-process how maximal part of the dirty pages may be spilled when necessary.

The MDBX_opt_spill_max_denominator defines the denominator for limiting from the top for part of the current dirty pages may be spilled when the free room for a new dirty pages (i.e. distance to the MDBX_opt_txn_dp_limit threshold) is not enough to perform requested operation. Exactly max_pages_to_spill = dirty_pages - dirty_pages / N, where N is the value set by MDBX_opt_spill_max_denominator.

Should be in the range 0..255, where zero means no limit, i.e. all dirty pages could be spilled. Default is 8, i.e. no more than 7/8 of the current dirty pages may be spilled when reached the condition described above.

spill_min_denominator 

Controls the in-process how minimal part of the dirty pages should be spilled when necessary.

The MDBX_opt_spill_min_denominator defines the denominator for limiting from the bottom for part of the current dirty pages should be spilled when the free room for a new dirty pages (i.e. distance to the MDBX_opt_txn_dp_limit threshold) is not enough to perform requested operation. Exactly min_pages_to_spill = dirty_pages / N, where N is the value set by MDBX_opt_spill_min_denominator.

Should be in the range 0..255, where zero means no restriction at the bottom. Default is 8, i.e. at least the 1/8 of the current dirty pages should be spilled when reached the condition described above.

spill_parent4child_denominator 

Controls the in-process how much of the parent transaction dirty pages will be spilled while start each child transaction.

The MDBX_opt_spill_parent4child_denominator defines the denominator to determine how much of parent transaction dirty pages will be spilled explicitly while start each child transaction. Exactly pages_to_spill = dirty_pages / N, where N is the value set by MDBX_opt_spill_parent4child_denominator.

For a stack of nested transactions each dirty page could be spilled only once, and parent's dirty pages couldn't be spilled while child transaction(s) are running. Therefore a child transaction could reach MDBX_TXN_FULL when parent(s) transaction has spilled too less (and child reach the limit of dirty pages), either when parent(s) has spilled too more (since child can't spill already spilled pages). So there is no universal golden ratio.

Should be in the range 0..255, where zero means no explicit spilling will be performed during starting nested transactions. Default is 0, i.e. by default no spilling performed during starting nested transactions, that correspond historically behaviour.

merge_threshold_16dot16_percent 

Controls the in-process threshold of semi-empty pages merge.

Warning
This is experimental option and subject for change or removal.

This option controls the in-process threshold of minimum page fill, as used space of percentage of a page. Neighbour pages emptier than this value are candidates for merging. The threshold value is specified in 1/65536 of percent, which is equivalent to the 16-dot-16 fixed point format. The specified value must be in the range from 12.5% (almost empty) to 50% (half empty) which corresponds to the range from 8192 and to 32768 in units respectively.

writethrough_threshold 

Controls the choosing between use write-through disk writes and usual ones with followed flush by the fdatasync() syscall.

Depending on the operating system, storage subsystem characteristics and the use case, higher performance can be achieved by either using write-through or a serie of usual/lazy writes followed by the flush-to-disk.

Basically for N chunks the latency/cost of write-through is: latency = N * (emit + round-trip-to-storage + storage-execution); And for serie of lazy writes with flush is: latency = N * (emit + storage-execution) + flush + round-trip-to-storage.

So, for large N and/or noteable round-trip-to-storage the write+flush approach is win. But for small N and/or near-zero NVMe-like latency the write-through is better.

To solve this issue libmdbx provide MDBX_opt_writethrough_threshold:

  • when N described above less or equal specified threshold, a write-through approach will be used;
  • otherwise, when N great than specified threshold, a write-and-flush approach will be used.
Note
MDBX_opt_writethrough_threshold affects only MDBX_SYNC_DURABLE mode without MDBX_WRITEMAP, and not supported on Windows. On Windows a write-through is used always but MDBX_NOMETASYNC could be used for switching to write-and-flush.
prefault_write_enable 

Controls prevention of page-faults of reclaimed and allocated pages in the MDBX_WRITEMAP mode by clearing ones through file handle before touching.

◆ mode

Operation mode.

Enumerator
readonly 

Read only mode.

Open the environment in read-only mode. No write operations will be allowed. MDBX will still modify the lock file - except on read-only filesystems, where MDBX does not use locks.

  • with MDBX_RDONLY = open environment in read-only mode. MDBX supports pure read-only mode (i.e. without opening LCK-file) only when environment directory and/or both files are not writable (and the LCK-file may be missing). In such case allowing file(s) to be placed on a network read-only share.
  • without MDBX_RDONLY = open environment in read-write mode.

This flag affects only at environment opening but can't be changed after.

write_file_io 
write_mapped_io 

Map data into memory with write permission.

Use a writeable memory map unless MDBX_RDONLY is set. This uses fewer mallocs and requires much less work for tracking database pages, but loses protection from application bugs like wild pointer writes and other bad updates into the database. This may be slightly faster for DBs that fit entirely in RAM, but is slower for DBs larger than RAM. Also adds the possibility for stray application writes thru pointers to silently corrupt the database.

  • with MDBX_WRITEMAP = all data will be mapped into memory in the read-write mode. This offers a significant performance benefit, since the data will be modified directly in mapped memory and then flushed to disk by single system call, without any memory management nor copying.
  • without MDBX_WRITEMAP = data will be mapped into memory in the read-only mode. This requires stocking all modified database pages in memory and then writing them to disk through file operations.
Warning
On the other hand, MDBX_WRITEMAP adds the possibility for stray application writes thru pointers to silently corrupt the database.
Note
The MDBX_WRITEMAP mode is incompatible with nested transactions, since this is unreasonable. I.e. nested transactions requires mallocation of database pages and more work for tracking ones, which neuters a performance boost caused by the MDBX_WRITEMAP mode.

This flag affects only at environment opening but can't be changed after.

◆ remove_mode

Deletion modes for remove().

Enumerator
just_remove 

Just delete the environment's files and directory if any.

Note
On POSIX systems, processes already working with the database will continue to work without interference until it close the environment.
On Windows, the behavior of just_remove is different because the system does not support deleting files that are currently memory mapped.
ensure_unused 

Make sure that the environment is not being used by other processes, or return an error otherwise.

wait_for_unused 

Wait until other processes closes the environment before deletion.

Constructor & Destructor Documentation

◆ env() [1/2]

constexpr mdbx::env::env ( )
constexprdefaultnoexcept

◆ env() [2/2]

mdbx::env::env ( const env )
defaultnoexcept

Member Function Documentation

◆ copy() [1/6]

env& mdbx::env::copy ( const ::mdbx::filesystem::path &  destination,
bool  compactify,
bool  force_dynamic_size = false 
)

Make a copy (backup) of an existing environment to the specified path.

◆ copy() [2/6]

env& mdbx::env::copy ( const ::std::string &  destination,
bool  compactify,
bool  force_dynamic_size = false 
)

◆ copy() [3/6]

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

◆ copy() [4/6]

env& mdbx::env::copy ( const char *  destination,
bool  compactify,
bool  force_dynamic_size = false 
)

◆ copy() [5/6]

env& mdbx::env::copy ( const wchar_t *  destination,
bool  compactify,
bool  force_dynamic_size = false 
)

◆ copy() [6/6]

env& mdbx::env::copy ( filehandle  fd,
bool  compactify,
bool  force_dynamic_size = false 
)

Copy an environment to the specified file descriptor.

◆ dbsize_max()

size_t mdbx::env::dbsize_max ( ) const
inline

Returns the maximal database size in bytes for the environment.

◆ dbsize_min()

size_t mdbx::env::dbsize_min ( ) const
inline

Returns the minimal database size in bytes for the environment.

◆ default_pagesize()

static size_t mdbx::env::default_pagesize ( )
inlinestaticnoexcept

Returns default page size for current system/platform.

◆ get_pagesize()

size_t mdbx::env::get_pagesize ( ) const
inline

Returns pagesize of this MDBX environment.

◆ get_path()

path mdbx::env::get_path ( ) const

Return the path that was used for opening the environment.

◆ is_empty()

bool mdbx::env::is_empty ( ) const

Checks whether the database is empty.

◆ is_pristine()

bool mdbx::env::is_pristine ( ) const

Returns true for a freshly created database, but false if at least one transaction was committed.

◆ key_max()

size_t mdbx::env::key_max ( key_mode  mode) const
inline

Returns the maximal key size in bytes for specified keys mode.

◆ key_min()

size_t mdbx::env::key_min ( key_mode  mode) const
inlinenoexcept

Returns the minimal key size in bytes for specified keys mode.

◆ poll_sync_to_disk()

bool mdbx::env::poll_sync_to_disk ( )
inline

Performs non-blocking polling of sync-to-disk thresholds.

Returns
True if sync done or no data to sync, or false if the environment is busy by other thread or none of the thresholds are reached.

◆ remove() [1/5]

static bool mdbx::env::remove ( const ::mdbx::filesystem::path &  pathname,
const remove_mode  mode = just_remove 
)
static

Removes the environment's files in a proper and multiprocess-safe way.

◆ remove() [2/5]

static bool mdbx::env::remove ( const ::std::string &  pathname,
const remove_mode  mode = just_remove 
)
static

◆ remove() [3/5]

static bool mdbx::env::remove ( const ::std::wstring &  pathname,
const remove_mode  mode = just_remove 
)
static

◆ remove() [4/5]

static bool mdbx::env::remove ( const char *  pathname,
const remove_mode  mode = just_remove 
)
static

◆ remove() [5/5]

static bool mdbx::env::remove ( const wchar_t *  pathname,
const remove_mode  mode = just_remove 
)
static

◆ set_sync_period()

env& mdbx::env::set_sync_period ( const duration period)
inline

Sets relative period since the last unsteady commit to force flush the data buffers to disk, for non-sync durability modes.

The relative period value affects all processes which operates with given environment until the last process close environment or a new value will be settled. Data is always written to disk when txn_managed::commit() is called, but the operating system may keep it buffered. MDBX always flushes the OS buffers upon commit as well, unless the environment was opened with whole_fragile, lazy_weak_tail or in part half_synchronous_weak_last. Settled period don't checked asynchronously, but only by the txn_managed::commit() and env::sync_to_disk() functions. Therefore, in cases where transactions are committed infrequently and/or irregularly, polling by env::poll_sync_to_disk() may be a reasonable solution to timeout enforcement.

The default is 0, than mean no any timeout checked, and no additional flush will be made.

See also
extra_runtime_option::sync_period

◆ sync_period()

duration mdbx::env::sync_period ( ) const
inline

Gets relative period since the last unsteady commit that used to force flush the data buffers to disk, for non-sync durability modes.

The relative period value affects all processes which operates with given environment until the last process close environment or a new value will be settled. Data is always written to disk when txn_managed::commit() is called, but the operating system may keep it buffered. MDBX always flushes the OS buffers upon commit as well, unless the environment was opened with whole_fragile, lazy_weak_tail or in part half_synchronous_weak_last. Settled period don't checked asynchronously, but only by the txn_managed::commit() and env::sync_to_disk() functions. Therefore, in cases where transactions are committed infrequently and/or irregularly, polling by env::poll_sync_to_disk() may be a reasonable solution to timeout enforcement.

The default is 0, than mean no any timeout checked, and no additional flush will be made.

See also
extra_runtime_option::sync_period
set_sync_period(const duration&)
extra_runtime_option::sync_period

◆ transaction_size_max()

size_t mdbx::env::transaction_size_max ( ) const
inline

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

◆ value_max()

size_t mdbx::env::value_max ( value_mode  mode) const
inline

Returns the maximal value size in bytes for specified values mode.

◆ value_min()

size_t mdbx::env::value_min ( value_mode  mode) const
inlinenoexcept

Returns the minimal value size in bytes for specified values mode.

Friends And Related Function Documentation

◆ operator!=

constexpr friend bool operator!= ( const env a,
const env b 
)
friend

◆ operator==

constexpr friend bool operator== ( const env a,
const env b 
)
friend

◆ txn

friend class txn
friend

Member Data Documentation

◆ handle_

MDBX_env* mdbx::env::handle_ {nullptr}
protected

◆ mdbx::env_managed

class mdbx::env_managed

Managed database environment.

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

An environment supports multiple key-value databases (aka key-value spaces or tables), all residing in the same shared-memory map.

Inheritance diagram for mdbx::env_managed:
mdbx::env

Public Member Functions

constexpr env_managed () noexcept=default
 
 env_managed (const ::mdbx::filesystem::path &pathname, const operate_parameters &, bool accede=true)
 Open existing database. More...
 
 env_managed (const ::std::wstring &pathname, const operate_parameters &, bool accede=true)
 
 env_managed (const wchar_t *pathname, const operate_parameters &, bool accede=true)
 
 env_managed (const ::std::string &pathname, const operate_parameters &, bool accede=true)
 
 env_managed (const char *pathname, const operate_parameters &, bool accede=true)
 
 env_managed (const ::mdbx::filesystem::path &pathname, const create_parameters &, const operate_parameters &, bool accede=true)
 Create new or open existing database. More...
 
 env_managed (const ::std::wstring &pathname, const create_parameters &, const operate_parameters &, bool accede=true)
 
 env_managed (const wchar_t *pathname, const create_parameters &, const operate_parameters &, bool accede=true)
 
 env_managed (const ::std::string &pathname, const create_parameters &, const operate_parameters &, bool accede=true)
 
 env_managed (const char *pathname, const create_parameters &, const operate_parameters &, bool accede=true)
 
void close (bool dont_sync=false)
 Explicitly closes the environment and release the memory map. More...
 
 env_managed (env_managed &&)=default
 
env_managedoperator= (env_managed &&other) noexcept
 
 env_managed (const env_managed &)=delete
 
env_managedoperator= (const env_managed &)=delete
 
virtual ~env_managed () noexcept
 
- Public Member Functions inherited from mdbx::env
constexpr env () noexcept=default
 
 env (const env &) noexcept=default
 
envoperator= (env &&other) noexcept
 
 env (env &&other) noexcept
 
 ~env () noexcept
 
constexpr operator const MDBX_env * () const
 
constexpr operator MDBX_env * ()
 
env::operate_parameters get_operation_parameters () const
 Returns current operation parameters. More...
 
env::mode get_mode () const
 Returns current operation mode. More...
 
env::durability get_durability () const
 Returns current durability mode. More...
 
env::reclaiming_options get_reclaiming () const
 Returns current reclaiming options. More...
 
env::operate_options get_options () const
 Returns current operate options. More...
 
bool is_pristine () const
 Returns true for a freshly created database, but false if at least one transaction was committed. More...
 
bool is_empty () const
 Checks whether the database is empty. More...
 
size_t dbsize_min () const
 Returns the minimal database size in bytes for the environment. More...
 
size_t dbsize_max () const
 Returns the maximal database size in bytes for the environment. More...
 
size_t key_min (key_mode mode) const noexcept
 Returns the minimal key size in bytes for specified keys mode. More...
 
size_t key_max (key_mode mode) const
 Returns the maximal key size in bytes for specified keys mode. More...
 
size_t value_min (value_mode mode) const noexcept
 Returns the minimal value size in bytes for specified values mode. More...
 
size_t value_max (value_mode mode) const
 Returns the maximal value size in bytes for specified values mode. More...
 
size_t transaction_size_max () const
 Returns the maximal write transaction size (i.e. limit for summary volume of dirty pages) in bytes. More...
 
envcopy (const ::mdbx::filesystem::path &destination, bool compactify, bool force_dynamic_size=false)
 Make a copy (backup) of an existing environment to the specified path. More...
 
envcopy (const ::std::wstring &destination, bool compactify, bool force_dynamic_size=false)
 
envcopy (const wchar_t *destination, bool compactify, bool force_dynamic_size=false)
 
envcopy (const ::std::string &destination, bool compactify, bool force_dynamic_size=false)
 
envcopy (const char *destination, bool compactify, bool force_dynamic_size=false)
 
envcopy (filehandle fd, bool compactify, bool force_dynamic_size=false)
 Copy an environment to the specified file descriptor. More...
 
stat get_stat () const
 Returns snapshot statistics about the MDBX environment. More...
 
size_t get_pagesize () const
 Returns pagesize of this MDBX environment. More...
 
info get_info () const
 Return snapshot information about the MDBX environment. More...
 
stat get_stat (const txn &) const
 Return statistics about the MDBX environment accordingly to the specified transaction. More...
 
info get_info (const txn &) const
 Return information about the MDBX environment accordingly to the specified transaction. More...
 
filehandle get_filehandle () const
 Returns the file descriptor for the DXB file of MDBX environment. More...
 
path get_path () const
 Return the path that was used for opening the environment. More...
 
MDBX_env_flags_t get_flags () const
 Returns environment flags. More...
 
unsigned max_readers () const
 Returns the maximum number of threads/reader slots for the environment. More...
 
unsigned max_maps () const
 Returns the maximum number of named databases for the environment. More...
 
void * get_context () const noexcept
 Returns the application context associated with the environment. More...
 
envset_context (void *your_context)
 Sets the application context associated with the environment. More...
 
envset_sync_threshold (size_t bytes)
 Sets threshold to force flush the data buffers to disk, for non-sync durability modes. More...
 
size_t sync_threshold () const
 Gets threshold used to force flush the data buffers to disk, for non-sync durability modes. More...
 
envset_sync_period (const duration &period)
 Sets relative period since the last unsteady commit to force flush the data buffers to disk, for non-sync durability modes. More...
 
duration sync_period () const
 Gets relative period since the last unsteady commit that used to force flush the data buffers to disk, for non-sync durability modes. More...
 
envset_sync_period__seconds_16dot16 (unsigned seconds_16dot16)
 Sets relative period since the last unsteady commit to force flush the data buffers to disk, for non-sync durability modes. More...
 
unsigned sync_period__seconds_16dot16 () const
 Gets relative period since the last unsteady commit that used to force flush the data buffers to disk, for non-sync durability modes. More...
 
envset_sync_period__seconds_double (double seconds)
 Sets relative period since the last unsteady commit to force flush the data buffers to disk, for non-sync durability modes. More...
 
double sync_period__seconds_double () const
 Gets relative period since the last unsteady commit that used to force flush the data buffers to disk, for non-sync durability modes. More...
 
envset_extra_option (extra_runtime_option option, uint64_t value)
 Sets the value of a extra runtime options for an environment. More...
 
uint64_t extra_option (extra_runtime_option option) const
 Gets the value of extra runtime options from an environment. More...
 
envalter_flags (MDBX_env_flags_t flags, bool on_off)
 Alter environment flags. More...
 
envset_geometry (const geometry &size)
 Set all size-related parameters of environment. More...
 
bool sync_to_disk (bool force=true, bool nonblock=false)
 Flush the environment data buffers. More...
 
bool poll_sync_to_disk ()
 Performs non-blocking polling of sync-to-disk thresholds. More...
 
void close_map (const map_handle &)
 Close a key-value map (aka sub-database) handle. Normally unnecessary. More...
 
template<typename VISITOR >
int enumerate_readers (VISITOR &visitor)
 Enumerate readers. More...
 
unsigned check_readers ()
 Checks for stale readers in the lock table and return number of cleared slots. More...
 
envset_HandleSlowReaders (MDBX_hsr_func *)
 Sets a Handle-Slow-Readers callback to resolve database full/overflow issue due to a reader(s) which prevents the old data from being recycled. More...
 
MDBX_hsr_funcget_HandleSlowReaders () const noexcept
 Returns the current Handle-Slow-Readers callback used to resolve database full/overflow issue due to a reader(s) which prevents the old data from being recycled. More...
 
txn_managed start_read () const
 Starts read (read-only) transaction. More...
 
txn_managed prepare_read () const
 Creates but not start read transaction. More...
 
txn_managed start_write (bool dont_wait=false)
 Starts write (read-write) transaction. More...
 
txn_managed try_start_write ()
 Tries to start write (read-write) transaction without blocking. More...
 

Additional Inherited Members

- Public Types inherited from mdbx::env
enum  mode { readonly , write_file_io , write_mapped_io }
 Operation mode. More...
 
enum  durability { robust_synchronous , half_synchronous_weak_last , lazy_weak_tail , whole_fragile }
 Durability level. More...
 
enum  remove_mode { just_remove = MDBX_ENV_JUST_DELETE , ensure_unused = MDBX_ENV_ENSURE_UNUSED , wait_for_unused = MDBX_ENV_WAIT_FOR_UNUSED }
 Deletion modes for remove(). More...
 
enum class  extra_runtime_option {
  max_maps = MDBX_opt_max_db , max_readers = MDBX_opt_max_readers , sync_bytes = MDBX_opt_sync_bytes , sync_period = MDBX_opt_sync_period ,
  rp_augment_limit = MDBX_opt_rp_augment_limit , loose_limit = MDBX_opt_loose_limit , dp_reserve_limit = MDBX_opt_dp_reserve_limit , dp_limit = MDBX_opt_txn_dp_limit ,
  dp_initial = MDBX_opt_txn_dp_initial , spill_max_denominator = MDBX_opt_spill_max_denominator , spill_min_denominator = MDBX_opt_spill_min_denominator , spill_parent4child_denominator = MDBX_opt_spill_parent4child_denominator ,
  merge_threshold_16dot16_percent = MDBX_opt_merge_threshold_16dot16_percent , writethrough_threshold = MDBX_opt_writethrough_threshold , prefault_write_enable = MDBX_opt_prefault_write_enable
}
 
using stat = ::MDBX_stat
 Statistics for a database in the MDBX environment. More...
 
using info = ::MDBX_envinfo
 Information about the environment. More...
 
- Static Public Member Functions inherited from mdbx::env
static size_t default_pagesize () noexcept
 Returns default page size for current system/platform. More...
 
static bool remove (const ::mdbx::filesystem::path &pathname, const remove_mode mode=just_remove)
 Removes the environment's files in a proper and multiprocess-safe way. More...
 
static bool remove (const ::std::wstring &pathname, const remove_mode mode=just_remove)
 
static bool remove (const wchar_t *pathname, const remove_mode mode=just_remove)
 
static bool remove (const ::std::string &pathname, const remove_mode mode=just_remove)
 
static bool remove (const char *pathname, const remove_mode mode=just_remove)
 
- Protected Member Functions inherited from mdbx::env
constexpr env (MDBX_env *ptr) noexcept
 
- Protected Attributes inherited from mdbx::env
MDBX_envhandle_ {nullptr}
 

Constructor & Destructor Documentation

◆ env_managed() [1/13]

constexpr mdbx::env_managed::env_managed ( )
constexprdefaultnoexcept

◆ env_managed() [2/13]

mdbx::env_managed::env_managed ( const ::mdbx::filesystem::path &  pathname,
const operate_parameters ,
bool  accede = true 
)

Open existing database.

◆ env_managed() [3/13]

mdbx::env_managed::env_managed ( const ::std::wstring &  pathname,
const operate_parameters ,
bool  accede = true 
)

◆ env_managed() [4/13]

mdbx::env_managed::env_managed ( const wchar_t *  pathname,
const operate_parameters ,
bool  accede = true 
)
explicit

◆ env_managed() [5/13]

mdbx::env_managed::env_managed ( const ::std::string &  pathname,
const operate_parameters ,
bool  accede = true 
)

◆ env_managed() [6/13]

mdbx::env_managed::env_managed ( const char *  pathname,
const operate_parameters ,
bool  accede = true 
)
explicit

◆ env_managed() [7/13]

mdbx::env_managed::env_managed ( const ::mdbx::filesystem::path &  pathname,
const create_parameters ,
const operate_parameters ,
bool  accede = true 
)

Create new or open existing database.

◆ env_managed() [8/13]

mdbx::env_managed::env_managed ( const ::std::wstring &  pathname,
const create_parameters ,
const operate_parameters ,
bool  accede = true 
)

◆ env_managed() [9/13]

mdbx::env_managed::env_managed ( const wchar_t *  pathname,
const create_parameters ,
const operate_parameters ,
bool  accede = true 
)
explicit

◆ env_managed() [10/13]

mdbx::env_managed::env_managed ( const ::std::string &  pathname,
const create_parameters ,
const operate_parameters ,
bool  accede = true 
)

◆ env_managed() [11/13]

mdbx::env_managed::env_managed ( const char *  pathname,
const create_parameters ,
const operate_parameters ,
bool  accede = true 
)
explicit

◆ env_managed() [12/13]

mdbx::env_managed::env_managed ( env_managed &&  )
default

◆ env_managed() [13/13]

mdbx::env_managed::env_managed ( const env_managed )
delete

◆ ~env_managed()

virtual mdbx::env_managed::~env_managed ( )
virtualnoexcept

Member Function Documentation

◆ close()

void mdbx::env_managed::close ( bool  dont_sync = false)

Explicitly closes the environment and release the memory map.

Only a single thread may call this function. All transactions, databases, and cursors must already be closed before calling this function. Attempts to use any such handles after calling this function will cause a SIGSEGV. The environment handle will be freed and must not be used again after this call.

Parameters
[in]dont_syncA dont'sync flag, if non-zero the last checkpoint will be kept "as is" and may be still "weak" in the lazy_weak_tail or whole_fragile modes. Such "weak" checkpoint will be ignored on opening next time, and transactions since the last non-weak checkpoint (meta-page update) will rolledback for consistency guarantee.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

env_managed& mdbx::env_managed::operator= ( env_managed &&  other)
inlinenoexcept

◆ mdbx::txn

class mdbx::txn

Unmanaged database transaction.

Like other unmanaged classes, txn allows copying and assignment for instances, but does not 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.

Inheritance diagram for mdbx::txn:
mdbx::txn_managed

Public Types

using info = ::MDBX_txn_info
 
using map_stat = ::MDBX_stat
 
using canary = ::MDBX_canary
 

Public Member Functions

constexpr txn () noexcept=default
 
 txn (const txn &) noexcept=default
 
txnoperator= (txn &&other) noexcept
 
 txn (txn &&other) noexcept
 
 ~txn () noexcept
 
constexpr operator const MDBX_txn * () const
 
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...
 
void * get_context () const noexcept
 Returns the application context associated with the transaction. More...
 
txnset_context (void *your_context)
 Sets the application context associated with the transaction. 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) const
 Opens cursor for specified key-value map handle. More...
 
size_t release_all_cursors (bool unbind) const
 Unbind or close all cursors. More...
 
size_t close_all_cursors () const
 Close all cursors. More...
 
size_t unbind_all_cursors () const
 Unbind all cursors. 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 open_map_accede (const char *name) const
 Open existing key-value map. More...
 
map_handle open_map_accede (const ::std::string &name) 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)
 
void rename_map (map_handle map, const char *new_name)
 Переименовывает таблицу ключ-значение. More...
 
void rename_map (map_handle map, const ::std::string &new_name)
 Переименовывает таблицу ключ-значение. More...
 
bool rename_map (const char *old_name, const char *new_name, bool throw_if_absent=false)
 Переименовывает таблицу ключ-значение. More...
 
bool rename_map (const ::std::string &old_name, const ::std::string &new_name, bool throw_if_absent=false)
 Переименовывает таблицу ключ-значение. More...
 
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. More...
 
map_handle open_map_accede (const ::std::string_view &name) const
 Open existing key-value map. More...
 
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. More...
 
bool drop_map (const ::std::string_view &name, bool throw_if_absent=false)
 Drop key-value map. More...
 
bool clear_map (const ::std::string_view &name, bool throw_if_absent=false)
 
void rename_map (map_handle map, const ::std::string_view &new_name)
 Переименовывает таблицу ключ-значение. More...
 
bool rename_map (const ::std::string_view &old_name, const ::std::string_view &new_name, bool throw_if_absent=false)
 Переименовывает таблицу ключ-значение. More...
 
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 >
size_t put_multiple (map_handle map, const slice &key, const VALUE *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, const pair &from, const pair &to) const
 
ptrdiff_t estimate (map_handle map, const slice &from, const slice &to) const
 
ptrdiff_t estimate_from_first (map_handle map, const slice &to) const
 
ptrdiff_t estimate_to_last (map_handle map, const slice &from) const
 

Protected Member Functions

constexpr txn (MDBX_txn *ptr) noexcept
 

Protected Attributes

MDBX_txnhandle_ {nullptr}
 

Friends

class cursor
 
constexpr friend bool operator== (const txn &a, const txn &b) noexcept
 
constexpr friend bool operator!= (const txn &a, const txn &b) noexcept
 

Member Typedef Documentation

◆ canary

◆ info

◆ map_stat

Constructor & Destructor Documentation

◆ txn() [1/2]

constexpr mdbx::txn::txn ( )
constexprdefaultnoexcept

◆ txn() [2/2]

mdbx::txn::txn ( const txn )
defaultnoexcept

Member Function Documentation

◆ clear_map() [1/2]

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.

◆ clear_map() [2/2]

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.

◆ close_all_cursors()

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

Close all cursors.

◆ drop_map() [1/2]

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

Drop key-value map.

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.

◆ drop_map() [2/2]

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

Drops key-value map using name.

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.

◆ is_readonly()

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

Checks whether the transaction is read-only.

◆ is_readwrite()

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

Checks whether the transaction is read-write.

◆ put_multiple() [1/2]

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

◆ put_multiple() [2/2]

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

◆ rename_map() [1/3]

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

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

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

◆ rename_map() [2/3]

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 в случае отсутствия исходной таблицы.

◆ rename_map() [3/3]

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

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

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

◆ size_current()

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

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

◆ size_max()

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

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

◆ start_nested()

txn_managed mdbx::txn::start_nested ( )

Start nested write transaction.

◆ unbind_all_cursors()

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

Unbind all cursors.

Friends And Related Function Documentation

◆ cursor

friend class cursor
friend

◆ operator!=

constexpr friend bool operator!= ( const txn a,
const txn b 
)
friend

◆ operator==

constexpr friend bool operator== ( const txn a,
const txn b 
)
friend

Member Data Documentation

◆ handle_

MDBX_txn* mdbx::txn::handle_ {nullptr}
protected

◆ mdbx::txn_managed

class mdbx::txn_managed

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.

Inheritance diagram for mdbx::txn_managed:
mdbx::txn

Public Types

using commit_latency = MDBX_commit_latency
 
- Public Types inherited from mdbx::txn
using info = ::MDBX_txn_info
 
using map_stat = ::MDBX_stat
 
using canary = ::MDBX_canary
 

Public Member Functions

constexpr txn_managed () noexcept=default
 
 txn_managed (txn_managed &&)=default
 
txn_managedoperator= (txn_managed &&other) noexcept
 
 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 ones. More...
 
void commit ()
 Commit all the operations of a transaction into the database. More...
 
void commit_embark_read ()
 Commit all the operations of a transaction into the database and then start read transaction. More...
 
void commit (commit_latency *)
 Commit all the operations of a transaction into the database and collect latency information. More...
 
void commit (commit_latency &latency)
 Commit all the operations of a transaction into the database and collect latency information. More...
 
commit_latency commit_get_latency ()
 Commit all the operations of a transaction into the database and return latency information. More...
 
- Public Member Functions inherited from mdbx::txn
constexpr txn () noexcept=default
 
 txn (const txn &) noexcept=default
 
txnoperator= (txn &&other) noexcept
 
 txn (txn &&other) noexcept
 
 ~txn () noexcept
 
constexpr operator const MDBX_txn * () const
 
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...
 
void * get_context () const noexcept
 Returns the application context associated with the transaction. More...
 
txnset_context (void *your_context)
 Sets the application context associated with the transaction. 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) const
 Opens cursor for specified key-value map handle. More...
 
size_t release_all_cursors (bool unbind) const
 Unbind or close all cursors. More...
 
size_t close_all_cursors () const
 Close all cursors. More...
 
size_t unbind_all_cursors () const
 Unbind all cursors. 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 open_map_accede (const char *name) const
 Open existing key-value map. More...
 
map_handle open_map_accede (const ::std::string &name) 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)
 
void rename_map (map_handle map, const char *new_name)
 Переименовывает таблицу ключ-значение. More...
 
void rename_map (map_handle map, const ::std::string &new_name)
 Переименовывает таблицу ключ-значение. More...
 
bool rename_map (const char *old_name, const char *new_name, bool throw_if_absent=false)
 Переименовывает таблицу ключ-значение. More...
 
bool rename_map (const ::std::string &old_name, const ::std::string &new_name, bool throw_if_absent=false)
 Переименовывает таблицу ключ-значение. More...
 
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. More...
 
map_handle open_map_accede (const ::std::string_view &name) const
 Open existing key-value map. More...
 
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. More...
 
bool drop_map (const ::std::string_view &name, bool throw_if_absent=false)
 Drop key-value map. More...
 
bool clear_map (const ::std::string_view &name, bool throw_if_absent=false)
 
void rename_map (map_handle map, const ::std::string_view &new_name)
 Переименовывает таблицу ключ-значение. More...
 
bool rename_map (const ::std::string_view &old_name, const ::std::string_view &new_name, bool throw_if_absent=false)
 Переименовывает таблицу ключ-значение. More...
 
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 >
size_t put_multiple (map_handle map, const slice &key, const VALUE *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, const pair &from, const pair &to) const
 
ptrdiff_t estimate (map_handle map, const slice &from, const slice &to) const
 
ptrdiff_t estimate_from_first (map_handle map, const slice &to) const
 
ptrdiff_t estimate_to_last (map_handle map, const slice &from) const
 

Friends

class env
 
class txn
 

Additional Inherited Members

- Protected Member Functions inherited from mdbx::txn
constexpr txn (MDBX_txn *ptr) noexcept
 
- Protected Attributes inherited from mdbx::txn
MDBX_txnhandle_ {nullptr}
 

Member Typedef Documentation

◆ commit_latency

Constructor & Destructor Documentation

◆ txn_managed() [1/3]

constexpr mdbx::txn_managed::txn_managed ( )
constexprdefaultnoexcept

◆ 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 ones.

◆ commit() [1/3]

void mdbx::txn_managed::commit ( )

Commit all the operations of a transaction into the database.

◆ commit() [2/3]

void mdbx::txn_managed::commit ( commit_latency latency)
inline

Commit all the operations of a transaction into the database and collect latency information.

◆ commit() [3/3]

void mdbx::txn_managed::commit ( commit_latency )

Commit all the operations of a transaction into the database and collect latency information.

◆ commit_embark_read()

void mdbx::txn_managed::commit_embark_read ( )

Commit all the operations of a transaction into the database and then start read transaction.

◆ commit_get_latency()

commit_latency mdbx::txn_managed::commit_get_latency ( )
inline

Commit all the operations of a transaction into the database and return latency information.

Returns
latency information of commit stages.

◆ 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)
inlinenoexcept

Friends And Related Function Documentation

◆ env

friend class env
friend

◆ txn

friend class txn
friend

◆ mdbx::cursor

class mdbx::cursor

Unmanaged cursor.

Like other unmanaged classes, cursor allows copying and assignment for instances, but does not destroys the represented underlying object from the own class destructor.

See also
mdbx_cursor_create()
mdbx_cursor_bind()
mdbx_cursor_close()
Inheritance diagram for mdbx::cursor:
mdbx::cursor_managed

Public Types

enum  move_operation {
  first = MDBX_FIRST , last = MDBX_LAST , next = MDBX_NEXT , previous = MDBX_PREV ,
  get_current = MDBX_GET_CURRENT , multi_prevkey_lastvalue = MDBX_PREV_NODUP , multi_currentkey_firstvalue = MDBX_FIRST_DUP , multi_currentkey_prevvalue = MDBX_PREV_DUP ,
  multi_currentkey_nextvalue = MDBX_NEXT_DUP , multi_currentkey_lastvalue = MDBX_LAST_DUP , multi_nextkey_firstvalue = MDBX_NEXT_NODUP , multi_find_pair = MDBX_GET_BOTH ,
  multi_exactkey_lowerboundvalue = MDBX_GET_BOTH_RANGE , seek_key = MDBX_SET , key_exact = MDBX_SET_KEY , key_lowerbound = MDBX_SET_RANGE ,
  key_lesser_than = MDBX_TO_KEY_LESSER_THAN , key_lesser_or_equal = MDBX_TO_KEY_LESSER_OR_EQUAL , key_equal = MDBX_TO_KEY_EQUAL , key_greater_or_equal = MDBX_TO_KEY_GREATER_OR_EQUAL ,
  key_greater_than = MDBX_TO_KEY_GREATER_THAN , multi_exactkey_value_lesser_than = MDBX_TO_EXACT_KEY_VALUE_LESSER_THAN , multi_exactkey_value_lesser_or_equal , multi_exactkey_value_equal = MDBX_TO_EXACT_KEY_VALUE_EQUAL ,
  multi_exactkey_value_greater_or_equal , multi_exactkey_value_greater = MDBX_TO_EXACT_KEY_VALUE_GREATER_THAN , pair_lesser_than = MDBX_TO_PAIR_LESSER_THAN , pair_lesser_or_equal = MDBX_TO_PAIR_LESSER_OR_EQUAL ,
  pair_equal = MDBX_TO_PAIR_EQUAL , pair_exact = pair_equal , pair_greater_or_equal = MDBX_TO_PAIR_GREATER_OR_EQUAL , pair_greater_than = MDBX_TO_PAIR_GREATER_THAN
}
 

Public Member Functions

constexpr cursor () noexcept=default
 
 cursor (const cursor &) noexcept=default
 
cursoroperator= (cursor &&other) noexcept
 
 cursor (cursor &&other) noexcept
 
 ~cursor () noexcept
 
cursor_managed clone (void *your_context=nullptr) const
 
constexpr operator const MDBX_cursor * () const
 
constexpr operator MDBX_cursor * ()
 
bool is_before_than (const cursor &other, bool ignore_nested=false) const
 
bool is_same_or_before_than (const cursor &other, bool ignore_nested=false) const
 
bool is_same_position (const cursor &other, bool ignore_nested=false) const
 
bool is_after_than (const cursor &other, bool ignore_nested=false) const
 
bool is_same_or_after_than (const cursor &other, bool ignore_nested=false) const
 
void * get_context () const noexcept
 Returns the application context associated with the cursor. More...
 
cursorset_context (void *your_context)
 Sets the application context associated with the cursor. More...
 
template<typename CALLABLE_PREDICATE >
bool scan (CALLABLE_PREDICATE predicate, move_operation start=first, move_operation turn=next)
 
template<typename CALLABLE_PREDICATE >
bool fullscan (CALLABLE_PREDICATE predicate, bool backward=false)
 
template<typename CALLABLE_PREDICATE >
bool scan_from (CALLABLE_PREDICATE predicate, slice &from, move_operation start=key_greater_or_equal, move_operation turn=next)
 
template<typename CALLABLE_PREDICATE >
bool scan_from (CALLABLE_PREDICATE predicate, pair &from, move_operation start=pair_greater_or_equal, move_operation turn=next)
 
move_result move (move_operation operation, bool throw_notfound)
 
move_result move (move_operation operation, const slice &key, bool throw_notfound)
 
move_result move (move_operation operation, const slice &key, const slice &value, bool throw_notfound)
 
bool move (move_operation operation, slice &key, slice &value, bool throw_notfound)
 
move_result to_first (bool throw_notfound=true)
 
move_result to_previous (bool throw_notfound=true)
 
move_result to_previous_last_multi (bool throw_notfound=true)
 
move_result to_current_first_multi (bool throw_notfound=true)
 
move_result to_current_prev_multi (bool throw_notfound=true)
 
move_result current (bool throw_notfound=true) const
 
move_result to_current_next_multi (bool throw_notfound=true)
 
move_result to_current_last_multi (bool throw_notfound=true)
 
move_result to_next_first_multi (bool throw_notfound=true)
 
move_result to_next (bool throw_notfound=true)
 
move_result to_last (bool throw_notfound=true)
 
move_result to_key_lesser_than (const slice &key, bool throw_notfound=true)
 
move_result to_key_lesser_or_equal (const slice &key, bool throw_notfound=true)
 
move_result to_key_equal (const slice &key, bool throw_notfound=true)
 
move_result to_key_exact (const slice &key, bool throw_notfound=true)
 
move_result to_key_greater_or_equal (const slice &key, bool throw_notfound=true)
 
move_result to_key_greater_than (const slice &key, bool throw_notfound=true)
 
move_result to_exact_key_value_lesser_than (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result to_exact_key_value_lesser_or_equal (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result to_exact_key_value_equal (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result to_exact_key_value_greater_or_equal (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result to_exact_key_value_greater_than (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result to_pair_lesser_than (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result to_pair_lesser_or_equal (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result to_pair_equal (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result to_pair_exact (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result to_pair_greater_or_equal (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result to_pair_greater_than (const slice &key, const slice &value, bool throw_notfound=true)
 
bool seek (const slice &key)
 
move_result find (const slice &key, bool throw_notfound=true)
 
move_result lower_bound (const slice &key, bool throw_notfound=false)
 
move_result upper_bound (const slice &key, bool throw_notfound=false)
 
size_t count_multivalue () const
 Return count of duplicates for current key. More...
 
move_result find_multivalue (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result lower_bound_multivalue (const slice &key, const slice &value, bool throw_notfound=false)
 
move_result upper_bound_multivalue (const slice &key, const slice &value, bool throw_notfound=false)
 
bool eof () const
 
bool on_first () const
 
bool on_last () const
 
bool on_first_multival () const
 
bool on_last_multival () const
 
estimate_result estimate (const slice &key, const slice &value) const
 
estimate_result estimate (const slice &key) const
 
estimate_result estimate (move_operation operation) const
 
estimate_result estimate (move_operation operation, slice &key) const
 
void renew (const ::mdbx::txn &txn)
 Renew/bind a cursor with a new transaction and previously used key-value map handle. More...
 
void bind (const ::mdbx::txn &txn, ::mdbx::map_handle map_handle)
 Bind/renew a cursor with a new transaction and specified key-value map handle. More...
 
void unbind ()
 Unbind cursor from a transaction. More...
 
inline ::mdbx::txn txn () const
 Returns the cursor's transaction. More...
 
map_handle map () const
 
 operator::mdbx::txn () const
 
 operator::mdbx::map_handle () const
 
MDBX_error_t put (const slice &key, slice *value, MDBX_put_flags_t flags) noexcept
 
void insert (const slice &key, slice value)
 
value_result try_insert (const slice &key, slice value)
 
slice insert_reserve (const slice &key, size_t value_length)
 
value_result try_insert_reserve (const slice &key, size_t value_length)
 
void upsert (const slice &key, const slice &value)
 
slice upsert_reserve (const slice &key, size_t value_length)
 
void update (const slice &key, const slice &value)
 
bool try_update (const slice &key, const slice &value)
 
slice update_reserve (const slice &key, size_t value_length)
 
value_result try_update_reserve (const slice &key, size_t value_length)
 
bool erase (bool whole_multivalue=false)
 Removes single key-value pair or all multi-values at the current cursor position. More...
 
bool erase (const slice &key, bool whole_multivalue=true)
 Seeks and removes first value or whole multi-value of the given key. More...
 
bool erase (const slice &key, const slice &value)
 Seeks and removes the particular multi-value entry of the key. More...
 

Protected Member Functions

constexpr cursor (MDBX_cursor *ptr) noexcept
 
bool move (move_operation operation, MDBX_val *key, MDBX_val *value, bool throw_notfound) const
 
ptrdiff_t estimate (move_operation operation, MDBX_val *key, MDBX_val *value) const
 

Protected Attributes

MDBX_cursorhandle_ {nullptr}
 

Friends

constexpr friend bool operator== (const cursor &a, const cursor &b) noexcept
 
constexpr friend bool operator!= (const cursor &a, const cursor &b) noexcept
 
int compare_position_nothrow (const cursor &left, const cursor &right, bool ignore_nested) noexcept
 
int compare_position (const cursor &left, const cursor &right, bool ignore_nested)
 

Member Enumeration Documentation

◆ move_operation

Enumerator
first 
last 
next 
previous 
get_current 
multi_prevkey_lastvalue 
multi_currentkey_firstvalue 
multi_currentkey_prevvalue 
multi_currentkey_nextvalue 
multi_currentkey_lastvalue 
multi_nextkey_firstvalue 
multi_find_pair 
multi_exactkey_lowerboundvalue 
seek_key 
key_exact 
key_lowerbound 
key_lesser_than 
key_lesser_or_equal 
key_equal 
key_greater_or_equal 
key_greater_than 
multi_exactkey_value_lesser_than 
multi_exactkey_value_lesser_or_equal 
multi_exactkey_value_equal 
multi_exactkey_value_greater_or_equal 
multi_exactkey_value_greater 
pair_lesser_than 
pair_lesser_or_equal 
pair_equal 
pair_exact 
pair_greater_or_equal 
pair_greater_than 

Constructor & Destructor Documentation

◆ cursor() [1/2]

constexpr mdbx::cursor::cursor ( )
constexprdefaultnoexcept

◆ cursor() [2/2]

mdbx::cursor::cursor ( const cursor )
defaultnoexcept

Member Function Documentation

◆ current()

move_result mdbx::cursor::current ( bool  throw_notfound = true) const
inline

◆ estimate()

estimate_result mdbx::cursor::estimate ( move_operation  operation,
slice key 
) const
inline

◆ fullscan()

template<typename CALLABLE_PREDICATE >
bool mdbx::cursor::fullscan ( CALLABLE_PREDICATE  predicate,
bool  backward = false 
)
inline

◆ is_after_than()

bool mdbx::cursor::is_after_than ( const cursor other,
bool  ignore_nested = false 
) const
inline

◆ is_before_than()

bool mdbx::cursor::is_before_than ( const cursor other,
bool  ignore_nested = false 
) const
inline

◆ is_same_or_after_than()

bool mdbx::cursor::is_same_or_after_than ( const cursor other,
bool  ignore_nested = false 
) const
inline

◆ is_same_or_before_than()

bool mdbx::cursor::is_same_or_before_than ( const cursor other,
bool  ignore_nested = false 
) const
inline

◆ is_same_position()

bool mdbx::cursor::is_same_position ( const cursor other,
bool  ignore_nested = false 
) const
inline

◆ move() [1/4]

move_result mdbx::cursor::move ( move_operation  operation,
bool  throw_notfound 
)
inline

◆ move() [2/4]

move_result mdbx::cursor::move ( move_operation  operation,
const slice key,
bool  throw_notfound 
)
inline

◆ move() [3/4]

move_result mdbx::cursor::move ( move_operation  operation,
const slice key,
const slice value,
bool  throw_notfound 
)
inline

◆ move() [4/4]

bool mdbx::cursor::move ( move_operation  operation,
slice key,
slice value,
bool  throw_notfound 
)
inline

◆ operator::mdbx::map_handle()

mdbx::cursor::operator::mdbx::map_handle ( ) const
inline

◆ operator::mdbx::txn()

mdbx::cursor::operator::mdbx::txn ( ) const
inline

◆ scan()

template<typename CALLABLE_PREDICATE >
bool mdbx::cursor::scan ( CALLABLE_PREDICATE  predicate,
move_operation  start = first,
move_operation  turn = next 
)
inline

◆ scan_from() [1/2]

template<typename CALLABLE_PREDICATE >
bool mdbx::cursor::scan_from ( CALLABLE_PREDICATE  predicate,
pair from,
move_operation  start = pair_greater_or_equal,
move_operation  turn = next 
)
inline

◆ scan_from() [2/2]

template<typename CALLABLE_PREDICATE >
bool mdbx::cursor::scan_from ( CALLABLE_PREDICATE  predicate,
slice from,
move_operation  start = key_greater_or_equal,
move_operation  turn = next 
)
inline

◆ to_current_first_multi()

move_result mdbx::cursor::to_current_first_multi ( bool  throw_notfound = true)
inline

◆ to_current_last_multi()

move_result mdbx::cursor::to_current_last_multi ( bool  throw_notfound = true)
inline

◆ to_current_next_multi()

move_result mdbx::cursor::to_current_next_multi ( bool  throw_notfound = true)
inline

◆ to_current_prev_multi()

move_result mdbx::cursor::to_current_prev_multi ( bool  throw_notfound = true)
inline

◆ to_exact_key_value_equal()

move_result mdbx::cursor::to_exact_key_value_equal ( const slice key,
const slice value,
bool  throw_notfound = true 
)
inline

◆ to_exact_key_value_greater_or_equal()

move_result mdbx::cursor::to_exact_key_value_greater_or_equal ( const slice key,
const slice value,
bool  throw_notfound = true 
)
inline

◆ to_exact_key_value_greater_than()

move_result mdbx::cursor::to_exact_key_value_greater_than ( const slice key,
const slice value,
bool  throw_notfound = true 
)
inline

◆ to_exact_key_value_lesser_or_equal()

move_result mdbx::cursor::to_exact_key_value_lesser_or_equal ( const slice key,
const slice value,
bool  throw_notfound = true 
)
inline

◆ to_exact_key_value_lesser_than()

move_result mdbx::cursor::to_exact_key_value_lesser_than ( const slice key,
const slice value,
bool  throw_notfound = true 
)
inline

◆ to_first()

move_result mdbx::cursor::to_first ( bool  throw_notfound = true)
inline

◆ to_key_equal()

move_result mdbx::cursor::to_key_equal ( const slice key,
bool  throw_notfound = true 
)
inline

◆ to_key_exact()

move_result mdbx::cursor::to_key_exact ( const slice key,
bool  throw_notfound = true 
)
inline

◆ to_key_greater_or_equal()

move_result mdbx::cursor::to_key_greater_or_equal ( const slice key,
bool  throw_notfound = true 
)
inline

◆ to_key_greater_than()

move_result mdbx::cursor::to_key_greater_than ( const slice key,
bool  throw_notfound = true 
)
inline

◆ to_key_lesser_or_equal()

move_result mdbx::cursor::to_key_lesser_or_equal ( const slice key,
bool  throw_notfound = true 
)
inline

◆ to_key_lesser_than()

move_result mdbx::cursor::to_key_lesser_than ( const slice key,
bool  throw_notfound = true 
)
inline

◆ to_last()

move_result mdbx::cursor::to_last ( bool  throw_notfound = true)
inline

◆ to_next()

move_result mdbx::cursor::to_next ( bool  throw_notfound = true)
inline

◆ to_next_first_multi()

move_result mdbx::cursor::to_next_first_multi ( bool  throw_notfound = true)
inline

◆ to_pair_equal()

move_result mdbx::cursor::to_pair_equal ( const slice key,
const slice value,
bool  throw_notfound = true 
)
inline

◆ to_pair_exact()

move_result mdbx::cursor::to_pair_exact ( const slice key,
const slice value,
bool  throw_notfound = true 
)
inline

◆ to_pair_greater_or_equal()

move_result mdbx::cursor::to_pair_greater_or_equal ( const slice key,
const slice value,
bool  throw_notfound = true 
)
inline

◆ to_pair_greater_than()

move_result mdbx::cursor::to_pair_greater_than ( const slice key,
const slice value,
bool  throw_notfound = true 
)
inline

◆ to_pair_lesser_or_equal()

move_result mdbx::cursor::to_pair_lesser_or_equal ( const slice key,
const slice value,
bool  throw_notfound = true 
)
inline

◆ to_pair_lesser_than()

move_result mdbx::cursor::to_pair_lesser_than ( const slice key,
const slice value,
bool  throw_notfound = true 
)
inline

◆ to_previous()

move_result mdbx::cursor::to_previous ( bool  throw_notfound = true)
inline

◆ to_previous_last_multi()

move_result mdbx::cursor::to_previous_last_multi ( bool  throw_notfound = true)
inline

◆ upper_bound()

move_result mdbx::cursor::upper_bound ( const slice key,
bool  throw_notfound = false 
)
inline

◆ upper_bound_multivalue()

move_result mdbx::cursor::upper_bound_multivalue ( const slice key,
const slice value,
bool  throw_notfound = false 
)
inline

Friends And Related Function Documentation

◆ compare_position

int compare_position ( const cursor left,
const cursor right,
bool  ignore_nested = false 
)
friend

◆ compare_position_nothrow

int compare_position_nothrow ( const cursor left,
const cursor right,
bool  ignore_nested = false 
)
friend

◆ operator!=

constexpr friend bool operator!= ( const cursor a,
const cursor b 
)
friend

◆ operator==

constexpr friend bool operator== ( const cursor a,
const cursor b 
)
friend

Member Data Documentation

◆ handle_

MDBX_cursor* mdbx::cursor::handle_ {nullptr}
protected

◆ mdbx::cursor_managed

class mdbx::cursor_managed

Managed cursor.

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

See also
mdbx_cursor_create()
mdbx_cursor_bind()
mdbx_cursor_close()
Inheritance diagram for mdbx::cursor_managed:
mdbx::cursor

Public Member Functions

 cursor_managed (void *your_context=nullptr)
 Creates a new managed cursor with underlying object. More...
 
void close ()
 Explicitly closes the cursor. More...
 
 cursor_managed (cursor_managed &&)=default
 
cursor_managedoperator= (cursor_managed &&other) noexcept
 
 cursor_managed (const cursor_managed &)=delete
 
cursor_managedoperator= (const cursor_managed &)=delete
 
 ~cursor_managed () noexcept
 
- Public Member Functions inherited from mdbx::cursor
constexpr cursor () noexcept=default
 
 cursor (const cursor &) noexcept=default
 
cursoroperator= (cursor &&other) noexcept
 
 cursor (cursor &&other) noexcept
 
 ~cursor () noexcept
 
cursor_managed clone (void *your_context=nullptr) const
 
constexpr operator const MDBX_cursor * () const
 
constexpr operator MDBX_cursor * ()
 
bool is_before_than (const cursor &other, bool ignore_nested=false) const
 
bool is_same_or_before_than (const cursor &other, bool ignore_nested=false) const
 
bool is_same_position (const cursor &other, bool ignore_nested=false) const
 
bool is_after_than (const cursor &other, bool ignore_nested=false) const
 
bool is_same_or_after_than (const cursor &other, bool ignore_nested=false) const
 
void * get_context () const noexcept
 Returns the application context associated with the cursor. More...
 
cursorset_context (void *your_context)
 Sets the application context associated with the cursor. More...
 
template<typename CALLABLE_PREDICATE >
bool scan (CALLABLE_PREDICATE predicate, move_operation start=first, move_operation turn=next)
 
template<typename CALLABLE_PREDICATE >
bool fullscan (CALLABLE_PREDICATE predicate, bool backward=false)
 
template<typename CALLABLE_PREDICATE >
bool scan_from (CALLABLE_PREDICATE predicate, slice &from, move_operation start=key_greater_or_equal, move_operation turn=next)
 
template<typename CALLABLE_PREDICATE >
bool scan_from (CALLABLE_PREDICATE predicate, pair &from, move_operation start=pair_greater_or_equal, move_operation turn=next)
 
move_result move (move_operation operation, bool throw_notfound)
 
move_result move (move_operation operation, const slice &key, bool throw_notfound)
 
move_result move (move_operation operation, const slice &key, const slice &value, bool throw_notfound)
 
bool move (move_operation operation, slice &key, slice &value, bool throw_notfound)
 
move_result to_first (bool throw_notfound=true)
 
move_result to_previous (bool throw_notfound=true)
 
move_result to_previous_last_multi (bool throw_notfound=true)
 
move_result to_current_first_multi (bool throw_notfound=true)
 
move_result to_current_prev_multi (bool throw_notfound=true)
 
move_result current (bool throw_notfound=true) const
 
move_result to_current_next_multi (bool throw_notfound=true)
 
move_result to_current_last_multi (bool throw_notfound=true)
 
move_result to_next_first_multi (bool throw_notfound=true)
 
move_result to_next (bool throw_notfound=true)
 
move_result to_last (bool throw_notfound=true)
 
move_result to_key_lesser_than (const slice &key, bool throw_notfound=true)
 
move_result to_key_lesser_or_equal (const slice &key, bool throw_notfound=true)
 
move_result to_key_equal (const slice &key, bool throw_notfound=true)
 
move_result to_key_exact (const slice &key, bool throw_notfound=true)
 
move_result to_key_greater_or_equal (const slice &key, bool throw_notfound=true)
 
move_result to_key_greater_than (const slice &key, bool throw_notfound=true)
 
move_result to_exact_key_value_lesser_than (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result to_exact_key_value_lesser_or_equal (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result to_exact_key_value_equal (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result to_exact_key_value_greater_or_equal (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result to_exact_key_value_greater_than (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result to_pair_lesser_than (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result to_pair_lesser_or_equal (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result to_pair_equal (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result to_pair_exact (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result to_pair_greater_or_equal (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result to_pair_greater_than (const slice &key, const slice &value, bool throw_notfound=true)
 
bool seek (const slice &key)
 
move_result find (const slice &key, bool throw_notfound=true)
 
move_result lower_bound (const slice &key, bool throw_notfound=false)
 
move_result upper_bound (const slice &key, bool throw_notfound=false)
 
size_t count_multivalue () const
 Return count of duplicates for current key. More...
 
move_result find_multivalue (const slice &key, const slice &value, bool throw_notfound=true)
 
move_result lower_bound_multivalue (const slice &key, const slice &value, bool throw_notfound=false)
 
move_result upper_bound_multivalue (const slice &key, const slice &value, bool throw_notfound=false)
 
bool eof () const
 
bool on_first () const
 
bool on_last () const
 
bool on_first_multival () const
 
bool on_last_multival () const
 
estimate_result estimate (const slice &key, const slice &value) const
 
estimate_result estimate (const slice &key) const
 
estimate_result estimate (move_operation operation) const
 
estimate_result estimate (move_operation operation, slice &key) const
 
void renew (const ::mdbx::txn &txn)
 Renew/bind a cursor with a new transaction and previously used key-value map handle. More...
 
void bind (const ::mdbx::txn &txn, ::mdbx::map_handle map_handle)
 Bind/renew a cursor with a new transaction and specified key-value map handle. More...
 
void unbind ()
 Unbind cursor from a transaction. More...
 
inline ::mdbx::txn txn () const
 Returns the cursor's transaction. More...
 
map_handle map () const
 
 operator::mdbx::txn () const
 
 operator::mdbx::map_handle () const
 
MDBX_error_t put (const slice &key, slice *value, MDBX_put_flags_t flags) noexcept
 
void insert (const slice &key, slice value)
 
value_result try_insert (const slice &key, slice value)
 
slice insert_reserve (const slice &key, size_t value_length)
 
value_result try_insert_reserve (const slice &key, size_t value_length)
 
void upsert (const slice &key, const slice &value)
 
slice upsert_reserve (const slice &key, size_t value_length)
 
void update (const slice &key, const slice &value)
 
bool try_update (const slice &key, const slice &value)
 
slice update_reserve (const slice &key, size_t value_length)
 
value_result try_update_reserve (const slice &key, size_t value_length)
 
bool erase (bool whole_multivalue=false)
 Removes single key-value pair or all multi-values at the current cursor position. More...
 
bool erase (const slice &key, bool whole_multivalue=true)
 Seeks and removes first value or whole multi-value of the given key. More...
 
bool erase (const slice &key, const slice &value)
 Seeks and removes the particular multi-value entry of the key. More...
 

Friends

class txn
 

Additional Inherited Members

- Public Types inherited from mdbx::cursor
enum  move_operation {
  first = MDBX_FIRST , last = MDBX_LAST , next = MDBX_NEXT , previous = MDBX_PREV ,
  get_current = MDBX_GET_CURRENT , multi_prevkey_lastvalue = MDBX_PREV_NODUP , multi_currentkey_firstvalue = MDBX_FIRST_DUP , multi_currentkey_prevvalue = MDBX_PREV_DUP ,
  multi_currentkey_nextvalue = MDBX_NEXT_DUP , multi_currentkey_lastvalue = MDBX_LAST_DUP , multi_nextkey_firstvalue = MDBX_NEXT_NODUP , multi_find_pair = MDBX_GET_BOTH ,
  multi_exactkey_lowerboundvalue = MDBX_GET_BOTH_RANGE , seek_key = MDBX_SET , key_exact = MDBX_SET_KEY , key_lowerbound = MDBX_SET_RANGE ,
  key_lesser_than = MDBX_TO_KEY_LESSER_THAN , key_lesser_or_equal = MDBX_TO_KEY_LESSER_OR_EQUAL , key_equal = MDBX_TO_KEY_EQUAL , key_greater_or_equal = MDBX_TO_KEY_GREATER_OR_EQUAL ,
  key_greater_than = MDBX_TO_KEY_GREATER_THAN , multi_exactkey_value_lesser_than = MDBX_TO_EXACT_KEY_VALUE_LESSER_THAN , multi_exactkey_value_lesser_or_equal , multi_exactkey_value_equal = MDBX_TO_EXACT_KEY_VALUE_EQUAL ,
  multi_exactkey_value_greater_or_equal , multi_exactkey_value_greater = MDBX_TO_EXACT_KEY_VALUE_GREATER_THAN , pair_lesser_than = MDBX_TO_PAIR_LESSER_THAN , pair_lesser_or_equal = MDBX_TO_PAIR_LESSER_OR_EQUAL ,
  pair_equal = MDBX_TO_PAIR_EQUAL , pair_exact = pair_equal , pair_greater_or_equal = MDBX_TO_PAIR_GREATER_OR_EQUAL , pair_greater_than = MDBX_TO_PAIR_GREATER_THAN
}
 
- Protected Member Functions inherited from mdbx::cursor
constexpr cursor (MDBX_cursor *ptr) noexcept
 
bool move (move_operation operation, MDBX_val *key, MDBX_val *value, bool throw_notfound) const
 
ptrdiff_t estimate (move_operation operation, MDBX_val *key, MDBX_val *value) const
 
- Protected Attributes inherited from mdbx::cursor
MDBX_cursorhandle_ {nullptr}
 

Constructor & Destructor Documentation

◆ cursor_managed() [1/3]

mdbx::cursor_managed::cursor_managed ( void *  your_context = nullptr)
inline

Creates a new managed cursor with underlying object.

◆ cursor_managed() [2/3]

mdbx::cursor_managed::cursor_managed ( cursor_managed &&  )
default

◆ cursor_managed() [3/3]

mdbx::cursor_managed::cursor_managed ( const cursor_managed )
delete

◆ ~cursor_managed()

mdbx::cursor_managed::~cursor_managed ( )
inlinenoexcept

Member Function Documentation

◆ close()

void mdbx::cursor_managed::close ( )

Explicitly closes the cursor.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

cursor_managed& mdbx::cursor_managed::operator= ( cursor_managed &&  other)
inlinenoexcept

Friends And Related Function Documentation

◆ txn

friend class txn
friend

◆ std::hash<::mdbx::slice >

struct std::hash<::mdbx::slice >

Public Member Functions

constexpr size_t operator() (::mdbx::slice const &slice) const noexcept
 

Member Function Documentation

◆ operator()()

constexpr size_t std::hash<::mdbx::slice >::operator() ( ::mdbx::slice const &  slice) const
inlineconstexprnoexcept

Macro Definition Documentation

◆ MDBX_STD_FILESYSTEM_PATH

#define MDBX_STD_FILESYSTEM_PATH   ::mdbx::filesystem::path

Defined if mdbx::filesystem::path is available.

If defined, it is always mdbx::filesystem::path, which in turn can be refs to std::filesystem::path or std::experimental::filesystem::path. Nonetheless MDBX_STD_FILESYSTEM_PATH not defined if the mdbx::path is fallbacked to c std::string or std::wstring.

Typedef Documentation

◆ build_info

using mdbx::build_info = typedef ::MDBX_build_info

libmdbx build information

Attention
Some strings could be NULL in case no corresponding information was provided at build time (i.e. flags).

◆ byte

using mdbx::byte = typedef char8_t

◆ comparator

using mdbx::comparator = typedef ::MDBX_cmp_func *

◆ default_allocator

◆ default_buffer

◆ duration

using mdbx::duration = typedef ::std::chrono::duration<unsigned, ::std::ratio<1, 65536> >

Duration in 1/65536 units of second.

◆ filehandle

◆ legacy_allocator

using mdbx::legacy_allocator = typedef ::std::string::allocator_type

Legacy allocator but it is recommended to use polymorphic_allocator.

◆ path

using mdbx::path = typedef ::mdbx::filesystem::path

◆ polymorphic_allocator

using mdbx::polymorphic_allocator = typedef ::std::pmr::string::allocator_type

Default polymorphic allocator for modern code.

◆ string

template<class ALLOCATOR = default_allocator>
using mdbx::string = typedef ::std::basic_string<char, ::std::char_traits<char>, ALLOCATOR>

Default single-byte string.

◆ version_info

libmdbx version information

Enumeration Type Documentation

◆ key_mode

enum mdbx::key_mode
strong

Kinds of the keys and corresponding modes of comparing it.

Enumerator
usual 

Usual variable length keys with byte-by-byte lexicographic comparison like std::memcmp().

reverse 

Variable length keys with byte-by-byte lexicographic comparison in reverse order, from the end of the keys to the beginning.

ordinal 

Keys are binary integers in native byte order, either uint32_t or uint64_t, and will be sorted as such. The keys must all be of the same size and must be aligned while passing as arguments.

msgpack 

Keys are in MessagePack format with appropriate comparison.

Note
Not yet implemented and PRs are welcome.

◆ loop_control

Loop control constants for readers enumeration functor and other cases.

See also
env::enumerate_readers()
Enumerator
continue_loop 
exit_loop 

◆ put_mode

Key-value pairs put mode.

Enumerator
insert_unique 

Insert only unique keys.

upsert 

Insert or update.

update 

Update existing, don't insert new.

◆ value_mode

enum mdbx::value_mode
strong

Kind of the values and sorted multi-values with corresponding comparison.

Enumerator
single 

Usual single value for each key. In terms of keys, they are unique.

multi 

A more than one data value could be associated with each key. Internally each key is stored once, and the corresponding data values are sorted by byte-by-byte lexicographic comparison like std::memcmp(). In terms of keys, they are not unique, i.e. has duplicates which are sorted by associated data values.

multi_reverse 

A more than one data value could be associated with each key. Internally each key is stored once, and the corresponding data values are sorted by byte-by-byte lexicographic comparison in reverse order, from the end of the keys to the beginning. In terms of keys, they are not unique, i.e. has duplicates which are sorted by associated data values.

multi_samelength 

A more than one data value could be associated with each key, and all data values must be same length. Internally each key is stored once, and the corresponding data values are sorted by byte-by-byte lexicographic comparison like std::memcmp(). In terms of keys, they are not unique, i.e. has duplicates which are sorted by associated data values.

multi_ordinal 

A more than one data value could be associated with each key, and all data values are binary integers in native byte order, either uint32_t or uint64_t, and will be sorted as such. Internally each key is stored once, and the corresponding data values are sorted. In terms of keys, they are not unique, i.e. has duplicates which are sorted by associated data values.

multi_reverse_samelength 

A more than one data value could be associated with each key, and all data values must be same length. Internally each key is stored once, and the corresponding data values are sorted by byte-by-byte lexicographic comparison in reverse order, from the end of the keys to the beginning. In terms of keys, they are not unique, i.e. has duplicates which are sorted by associated data values.

msgpack 

A more than one data value could be associated with each key. Values are in MessagePack format with appropriate comparison. Internally each key is stored once, and the corresponding data values are sorted. In terms of keys, they are not unique, i.e. has duplicates which are sorted by associated data values.

Note
Not yet implemented and PRs are welcome.

Function Documentation

◆ buffer()

template<class ALLOCATOR , typename CAPACITY_POLICY >
template<class ALLOCATOR , typename CAPACITY_POLICY >
mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::buffer ( const txn txn,
const struct slice src,
const allocator_type allocator 
)
inline

◆ cursor() [1/2]

mdbx::cursor::cursor ( cursor &&  other)
inlinenoexcept

◆ cursor() [2/2]

constexpr mdbx::cursor::cursor ( MDBX_cursor ptr)
constexprprotectednoexcept

◆ env() [1/3]

mdbx::env::env ( env &&  other)
inlinenoexcept

◆ env() [2/3]

constexpr mdbx::env::env ( MDBX_env ptr)
constexprprotectednoexcept

◆ error()

constexpr mdbx::error::error ( MDBX_error_t  error_code)
constexprnoexcept

◆ estimate_result()

mdbx::cursor::estimate_result::estimate_result ( const cursor cursor,
move_operation  operation,
const slice key,
const slice value 
)
inline

◆ info()

constexpr mdbx::map_handle::info::info ( map_handle::flags  flags,
map_handle::state  state 
)
constexprnoexcept

◆ move_result() [1/2]

mdbx::cursor::move_result::move_result ( const cursor cursor,
bool  throw_notfound 
)
inline

◆ move_result() [2/2]

mdbx::cursor::move_result::move_result ( cursor cursor,
move_operation  operation,
const slice key,
const slice value,
bool  throw_notfound 
)
inline

◆ reader_info()

constexpr mdbx::env::reader_info::reader_info ( int  slot,
mdbx_pid_t  pid,
mdbx_tid_t  thread,
uint64_t  txnid,
uint64_t  lag,
size_t  used,
size_t  retained 
)
constexprnoexcept

◆ slice() [1/7]

constexpr mdbx::slice::slice ( )
constexprnoexcept

Create an empty slice.

◆ slice() [2/7]

constexpr mdbx::slice::slice ( const char *  c_str)
explicitconstexpr

Create a slice that refers to c_str[0,strlen(c_str)-1].

◆ slice() [3/7]

constexpr mdbx::slice::slice ( const MDBX_val src)
constexpr

◆ slice() [4/7]

constexpr mdbx::slice::slice ( const void *  begin,
const void *  end 
)
constexpr

Create a slice that refers to [begin,end] of memory bytes.

◆ slice() [5/7]

constexpr mdbx::slice::slice ( const void *  ptr,
size_t  bytes 
)
constexpr

Create a slice that refers to [0,bytes-1] of memory bytes pointed by ptr.

◆ slice() [6/7]

constexpr mdbx::slice::slice ( MDBX_val &&  src)
constexpr

◆ slice() [7/7]

constexpr mdbx::slice::slice ( slice &&  src)
constexprnoexcept

◆ txn() [1/3]

constexpr mdbx::txn::txn ( MDBX_txn ptr)
constexprprotectednoexcept

◆ txn() [2/3]

mdbx::txn::txn ( txn &&  other)
inlinenoexcept

◆ ~cursor()

mdbx::cursor::~cursor ( )
inlinenoexcept

◆ ~env()

mdbx::env::~env ( )
inlinenoexcept

◆ ~txn()

mdbx::txn::~txn ( )
inlinenoexcept

◆ alter_flags()

env & mdbx::env::alter_flags ( MDBX_env_flags_t  flags,
bool  on_off 
)
inline

Alter environment flags.

◆ append()

void mdbx::txn::append ( map_handle  map,
const slice key,
const slice value,
bool  multivalue_order_preserved = true 
)
inline

Adding a key-value pair, provided that ascending order of the keys and (optionally) values are preserved.

Instead of splitting the full b+tree pages, the data will be placed on new ones. Thus appending is about two times faster than insertion, and the pages will be filled in completely mostly but not half as after splitting ones. On the other hand, any subsequent insertion or update with an increase in the length of the value will be twice as slow, since it will require splitting already filled pages.

Parameters
[in]mapA map handle to append
[in]keyA key to be append
[in]valueA value to store with the key
[in]multivalue_order_preservedIf multivalue_order_preserved == true then the same rules applied for to pages of nested b+tree of multimap's values.

◆ as_base58_string()

template<class ALLOCATOR >
string< ALLOCATOR > mdbx::slice::as_base58_string ( unsigned  wrap_width = 0,
const ALLOCATOR &  allocator = ALLOCATOR() 
) const
inline

Returns a string with a Base58 dump of the slice content.

◆ as_base64_string()

template<class ALLOCATOR >
string< ALLOCATOR > mdbx::slice::as_base64_string ( unsigned  wrap_width = 0,
const ALLOCATOR &  allocator = ALLOCATOR() 
) const
inline

Returns a string with a Base58 dump of the slice content.

◆ as_hex_string()

template<class ALLOCATOR >
string< ALLOCATOR > mdbx::slice::as_hex_string ( bool  uppercase = false,
unsigned  wrap_width = 0,
const ALLOCATOR &  allocator = ALLOCATOR() 
) const
inline

Returns a string with a hexadecimal dump of the slice content.

◆ assign() [1/7]

slice & mdbx::slice::assign ( ::MDBX_val &&  src)
inline

◆ assign() [2/7]

slice & mdbx::slice::assign ( const ::MDBX_val src)
inline

◆ assign() [3/7]

slice & mdbx::slice::assign ( const char *  c_str)
inline

◆ assign() [4/7]

slice & mdbx::slice::assign ( const slice src)
inlinenoexcept

◆ assign() [5/7]

slice & mdbx::slice::assign ( const void *  begin,
const void *  end 
)
inline

◆ assign() [6/7]

slice & mdbx::slice::assign ( const void *  ptr,
size_t  bytes 
)
inline

◆ assign() [7/7]

slice & mdbx::slice::assign ( slice &&  src)
inlinenoexcept

◆ at()

constexpr byte mdbx::slice::at ( size_t  n) const
constexpr

Returns the nth byte in the referenced data with bounds checking.

Exceptions
std::out_of_rangeif n >= size()

◆ base58_decode()

template<class ALLOCATOR , class CAPACITY_POLICY >
buffer< ALLOCATOR, CAPACITY_POLICY > mdbx::slice::base58_decode ( bool  ignore_spaces = false,
const ALLOCATOR &  allocator = ALLOCATOR() 
) const
inline

Decodes Base58 dump from the slice content to returned buffer.

◆ base64_decode()

template<class ALLOCATOR , class CAPACITY_POLICY >
buffer< ALLOCATOR, CAPACITY_POLICY > mdbx::slice::base64_decode ( bool  ignore_spaces = false,
const ALLOCATOR &  allocator = ALLOCATOR() 
) const
inline

Decodes Base64 dump from the slice content to returned buffer.

◆ bind()

void mdbx::cursor::bind ( const ::mdbx::txn txn,
::mdbx::map_handle  map_handle 
)
inline

Bind/renew a cursor with a new transaction and specified key-value map handle.

◆ boolean_or_throw() [1/2]

bool mdbx::error::boolean_or_throw ( int  error_code)
inlinestatic

◆ boolean_or_throw() [2/2]

bool mdbx::error::boolean_or_throw ( int  error_code,
const exception_thunk thunk 
)
inlinestatic

◆ byte_ptr() [1/2]

constexpr const ::mdbx::byte * mdbx::slice::byte_ptr ( ) const
constexprnoexcept

Returns casted to pointer to byte an address of data.

◆ byte_ptr() [2/2]

constexpr::mdbx::byte * mdbx::slice::byte_ptr ( )
constexprnoexcept

◆ capture()

void mdbx::exception_thunk::capture ( )
inlinenoexcept

◆ char_ptr() [1/2]

constexpr const char * mdbx::slice::char_ptr ( ) const
constexprnoexcept

Returns casted to pointer to char an address of data.

◆ char_ptr() [2/2]

constexpr char * mdbx::slice::char_ptr ( )
constexprnoexcept

◆ check_readers()

unsigned mdbx::env::check_readers ( )
inline

Checks for stale readers in the lock table and return number of cleared slots.

◆ clear()

constexpr void mdbx::slice::clear ( )
constexprnoexcept

Makes the slice empty and referencing to nothing.

◆ clear_map() [1/2]

bool mdbx::txn::clear_map ( const ::std::string &  name,
bool  throw_if_absent = false 
)
inline
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.

◆ clear_map() [2/2]

void mdbx::txn::clear_map ( map_handle  map)
inline

Clear key-value map.

◆ clone()

cursor_managed mdbx::cursor::clone ( void *  your_context = nullptr) const
inline

◆ close_map()

void mdbx::env::close_map ( const map_handle handle)
inline

Close a key-value map (aka sub-database) handle. Normally unnecessary.

Closing a database handle is not necessary, but lets txn::open_map() reuse the handle value. Usually it's better to set a bigger env::operate_parameters::max_maps, unless that value would be large.

Note
Use with care. This call is synchronized via mutex with other calls close_map(), but NOT with other transactions running by other threads. The "next" version of libmdbx (MithrilDB and Future) will solve this issue.

Handles should only be closed if no other threads are going to reference the database handle or one of its cursors any further. Do not close a handle if an existing transaction has modified its database. Doing so can cause misbehavior from database corruption to errors like MDBX_BAD_DBI (since the DB name is gone).

◆ code()

constexpr MDBX_error_t mdbx::error::code ( ) const
constexprnoexcept

Returns error code.

◆ compare_fast() [1/2]

constexpr intptr_t mdbx::pair::compare_fast ( const pair a,
const pair b 
)
staticconstexprnoexcept

Three-way fast non-lexicographically length-based comparison.

◆ compare_fast() [2/2]

constexpr intptr_t mdbx::slice::compare_fast ( const slice a,
const slice b 
)
staticconstexprnoexcept

Three-way fast non-lexicographically length-based comparison.

Firstly compares length and if it equal then compare content lexicographically.

Returns
value: == 0 if a the same as b; < 0 if a shorter than b, or the same length and lexicographically less than b; > 0 if a longer than b, or the same length and lexicographically great than b.

◆ compare_keys() [1/2]

int mdbx::txn::compare_keys ( map_handle  map,
const pair a,
const pair b 
) const
inlinenoexcept

Compare keys of two pairs according to a particular key-value map (aka sub-database).

◆ compare_keys() [2/2]

int mdbx::txn::compare_keys ( map_handle  map,
const slice a,
const slice b 
) const
inlinenoexcept

Compare two keys according to a particular key-value map (aka sub-database).

◆ compare_lexicographically() [1/2]

constexpr intptr_t mdbx::pair::compare_lexicographically ( const pair a,
const pair b 
)
staticconstexprnoexcept

Three-way lexicographically comparison.

◆ compare_lexicographically() [2/2]

constexpr intptr_t mdbx::slice::compare_lexicographically ( const slice a,
const slice b 
)
staticconstexprnoexcept

Three-way lexicographically comparison.

Returns
value: == 0 if a lexicographically equal b; < 0 if a lexicographically less than b; > 0 if a lexicographically great than b.

◆ compare_position()

int mdbx::compare_position ( const cursor left,
const cursor right,
bool  ignore_nested = false 
)
inline

◆ compare_position_nothrow()

int mdbx::compare_position_nothrow ( const cursor left,
const cursor right,
bool  ignore_nested = false 
)
inlinenoexcept

◆ compare_values() [1/2]

int mdbx::txn::compare_values ( map_handle  map,
const pair a,
const pair b 
) const
inlinenoexcept

Compare values of two pairs according to a particular key-value map (aka sub-database).

◆ compare_values() [2/2]

int mdbx::txn::compare_values ( map_handle  map,
const slice a,
const slice b 
) const
inlinenoexcept

Compare two values according to a particular key-value map (aka sub-database).

◆ count_multivalue()

size_t mdbx::cursor::count_multivalue ( ) const
inline

Return count of duplicates for current key.

◆ create_map() [1/3]

mdbx::map_handle mdbx::txn::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 
)
inline

Create new or open existing key-value map.

◆ create_map() [2/3]

mdbx::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 
)
inline

Create new or open existing key-value map.

◆ create_map() [3/3]

mdbx::map_handle mdbx::txn::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 
)
inline

Create new or open existing key-value map.

◆ data() [1/2]

constexpr const void * mdbx::slice::data ( ) const
constexprnoexcept

Return a pointer to the beginning of the referenced data.

◆ data() [2/2]

constexpr void * mdbx::slice::data ( )
constexprnoexcept

◆ dbsize_max()

size_t mdbx::env::limits::dbsize_max ( intptr_t  pagesize)
inlinestatic

Returns the maximal database size in bytes for specified page size.

◆ dbsize_min()

size_t mdbx::env::limits::dbsize_min ( intptr_t  pagesize)
inlinestatic

Returns the minimal database size in bytes for specified page size.

◆ default_comparator() [1/2]

comparator mdbx::default_comparator ( key_mode  mode)
inlinenoexcept

◆ default_comparator() [2/2]

comparator mdbx::default_comparator ( value_mode  mode)
inlinenoexcept

◆ drop_map() [1/2]

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

Drop key-value map.

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.

◆ drop_map() [2/2]

void mdbx::txn::drop_map ( map_handle  map)
inline

Drops key-value map using handle.

◆ empty()

constexpr bool mdbx::slice::empty ( ) const
constexprnoexcept

Checks whether the slice is empty.

◆ encode_base58()

template<class ALLOCATOR , class CAPACITY_POLICY >
buffer< ALLOCATOR, CAPACITY_POLICY > mdbx::slice::encode_base58 ( unsigned  wrap_width = 0,
const ALLOCATOR &  allocator = ALLOCATOR() 
) const
inline

Returns a buffer with a Base58 dump of the slice content.

◆ encode_base64()

template<class ALLOCATOR , class CAPACITY_POLICY >
buffer< ALLOCATOR, CAPACITY_POLICY > mdbx::slice::encode_base64 ( unsigned  wrap_width = 0,
const ALLOCATOR &  allocator = ALLOCATOR() 
) const
inline

Returns a buffer with a Base64 dump of the slice content.

◆ encode_hex()

template<class ALLOCATOR , class CAPACITY_POLICY >
buffer< ALLOCATOR, CAPACITY_POLICY > mdbx::slice::encode_hex ( bool  uppercase = false,
unsigned  wrap_width = 0,
const ALLOCATOR &  allocator = ALLOCATOR() 
) const
inline

Returns a buffer with a hexadecimal dump of the slice content.

◆ end() [1/2]

constexpr const void * mdbx::slice::end ( ) const
constexprnoexcept

Return a pointer to the ending of the referenced data.

◆ end() [2/2]

constexpr void * mdbx::slice::end ( )
constexprnoexcept

◆ end_byte_ptr() [1/2]

constexpr const ::mdbx::byte * mdbx::slice::end_byte_ptr ( ) const
constexprnoexcept

Returns casted to pointer to byte an end of data.

◆ end_byte_ptr() [2/2]

constexpr::mdbx::byte * mdbx::slice::end_byte_ptr ( )
constexprnoexcept

◆ end_char_ptr() [1/2]

constexpr const char * mdbx::slice::end_char_ptr ( ) const
constexprnoexcept

Returns casted to pointer to char an end of data.

◆ end_char_ptr() [2/2]

constexpr char * mdbx::slice::end_char_ptr ( )
constexprnoexcept

◆ ends_with()

constexpr bool mdbx::slice::ends_with ( const slice suffix) const
constexprnoexcept

Checks if the data ends with the given suffix.

◆ enumerate_readers()

template<typename VISITOR >
int mdbx::env::enumerate_readers ( VISITOR &  visitor)
inline

Enumerate readers.

The VISITOR class must have int operator(const reader_info&, int serial) which should return continue_loop (zero) to continue enumeration, or any non-zero value to exit.

Returns
The last value returned from visitor' functor.

◆ env() [3/3]

mdbx::env mdbx::txn::env ( ) const
inlinenoexcept

Returns the transaction's environment.

◆ eof()

bool mdbx::cursor::eof ( ) const
inline

◆ erase() [1/5]

bool mdbx::cursor::erase ( bool  whole_multivalue = false)
inline

Removes single key-value pair or all multi-values at the current cursor position.

◆ erase() [2/5]

bool mdbx::cursor::erase ( const slice key,
bool  whole_multivalue = true 
)
inline

Seeks and removes first value or whole multi-value of the given key.

Returns
True if the key is found and a value(s) is removed.

◆ erase() [3/5]

bool mdbx::cursor::erase ( const slice key,
const slice value 
)
inline

Seeks and removes the particular multi-value entry of the key.

Returns
True if the given key-value pair is found and removed.

◆ erase() [4/5]

bool mdbx::txn::erase ( map_handle  map,
const slice key 
)
inline

Removes all values for given key.

◆ erase() [5/5]

bool mdbx::txn::erase ( map_handle  map,
const slice key,
const slice value 
)
inline

Removes the particular multi-value entry of the key.

◆ estimate() [1/7]

ptrdiff_t mdbx::estimate ( const cursor from,
const cursor to 
)
inline

◆ estimate() [2/7]

cursor::estimate_result mdbx::cursor::estimate ( const slice key) const
inline

◆ estimate() [3/7]

cursor::estimate_result mdbx::cursor::estimate ( const slice key,
const slice value 
) const
inline

◆ estimate() [4/7]

ptrdiff_t mdbx::txn::estimate ( map_handle  map,
const pair from,
const pair to 
) const
inline

◆ estimate() [5/7]

ptrdiff_t mdbx::txn::estimate ( map_handle  map,
const slice from,
const slice to 
) const
inline

◆ estimate() [6/7]

cursor::estimate_result mdbx::cursor::estimate ( move_operation  operation) const
inline

◆ estimate() [7/7]

ptrdiff_t mdbx::cursor::estimate ( move_operation  operation,
MDBX_val key,
MDBX_val value 
) const
inlineprotected

◆ estimate_from_first()

ptrdiff_t mdbx::txn::estimate_from_first ( map_handle  map,
const slice to 
) const
inline

◆ estimate_to_last()

ptrdiff_t mdbx::txn::estimate_to_last ( map_handle  map,
const slice from 
) const
inline

◆ extra_option()

uint64_t mdbx::env::extra_option ( enum env::extra_runtime_option  option) const
inline

Gets the value of extra runtime options from an environment.

◆ extract()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer< ALLOCATOR, CAPACITY_POLICY > mdbx::txn::extract ( map_handle  map,
const slice key,
const typename buffer< ALLOCATOR, CAPACITY_POLICY >::allocator_type &  allocator = buffer<ALLOCATOR, CAPACITY_POLICY>::allocator_type() 
)
inline

Removes and return a value of the key.

◆ find()

cursor::move_result mdbx::cursor::find ( const slice key,
bool  throw_notfound = true 
)
inline

◆ find_multivalue()

cursor::move_result mdbx::cursor::find_multivalue ( const slice key,
const slice value,
bool  throw_notfound = true 
)
inline

◆ flags()

MDBX_txn_flags_t mdbx::txn::flags ( ) const
inline

Returns transaction's flags.

◆ get() [1/4]

slice mdbx::txn::get ( map_handle  map,
const slice key 
) const
inline

Get value by key from a key-value map (aka sub-database).

◆ get() [2/4]

slice mdbx::txn::get ( map_handle  map,
const slice key,
const slice value_at_absence 
) const
inline

Get value by key from a key-value map (aka sub-database).

◆ get() [3/4]

slice mdbx::txn::get ( map_handle  map,
slice  key,
size_t &  values_count 
) const
inline

Get first of multi-value and values count by key from a key-value multimap (aka sub-database).

◆ get() [4/4]

slice mdbx::txn::get ( map_handle  map,
slice  key,
size_t &  values_count,
const slice value_at_absence 
) const
inline

Get first of multi-value and values count by key from a key-value multimap (aka sub-database).

◆ get_build()

constexpr const build_info & mdbx::get_build ( )
constexprnoexcept

Returns libmdbx build information.

◆ get_canary()

txn::canary mdbx::txn::get_canary ( ) const
inline

Returns fours integers markers (aka "canary") associated with the environment.

◆ get_context() [1/3]

void * mdbx::env::get_context ( ) const
inlinenoexcept

Returns the application context associated with the environment.

◆ get_context() [2/3]

void * mdbx::txn::get_context ( ) const
inlinenoexcept

Returns the application context associated with the transaction.

◆ get_context() [3/3]

void * mdbx::cursor::get_context ( ) const
inlinenoexcept

Returns the application context associated with the cursor.

◆ get_durability()

env::durability mdbx::env::get_durability ( ) const
inline

Returns current durability mode.

◆ get_equal_or_great() [1/2]

pair_result mdbx::txn::get_equal_or_great ( map_handle  map,
const slice key 
) const
inline

Get value for equal or great key from a database.

Returns
Bundle of key-value pair and boolean flag, which will be true if the exact key was found and false otherwise.

◆ get_equal_or_great() [2/2]

pair_result mdbx::txn::get_equal_or_great ( map_handle  map,
const slice key,
const slice value_at_absence 
) const
inline

Get value for equal or great key from a database.

Returns
Bundle of key-value pair and boolean flag, which will be true if the exact key was found and false otherwise.

◆ get_filehandle()

filehandle mdbx::env::get_filehandle ( ) const
inline

Returns the file descriptor for the DXB file of MDBX environment.

◆ get_flags()

MDBX_env_flags_t mdbx::env::get_flags ( ) const
inline

Returns environment flags.

◆ get_handle_info()

map_handle::info mdbx::txn::get_handle_info ( map_handle  map) const
inline

Returns information about key-value map (aka sub-database) handle.

◆ get_HandleSlowReaders()

MDBX_hsr_func * mdbx::env::get_HandleSlowReaders ( ) const
inlinenoexcept

Returns the current Handle-Slow-Readers callback used to resolve database full/overflow issue due to a reader(s) which prevents the old data from being recycled.

See also
set_HandleSlowReaders()

◆ get_info() [1/3]

env::info mdbx::env::get_info ( ) const
inline

Return snapshot information about the MDBX environment.

◆ get_info() [2/3]

txn::info mdbx::txn::get_info ( bool  scan_reader_lock_table = false) const
inline

Returns information about the MDBX transaction.

◆ get_info() [3/3]

env::info mdbx::env::get_info ( const txn txn) const
inline

Return information about the MDBX environment accordingly to the specified transaction.

◆ get_map_stat()

txn::map_stat mdbx::txn::get_map_stat ( map_handle  map) const
inline

Returns statistics for a sub-database.

◆ get_mode()

env::mode mdbx::env::get_mode ( ) const
inline

Returns current operation mode.

◆ get_operation_parameters()

env::operate_parameters mdbx::env::get_operation_parameters ( ) const
inline

Returns current operation parameters.

◆ get_options()

env::operate_options mdbx::env::get_options ( ) const
inline

Returns current operate options.

◆ get_reclaiming()

env::reclaiming_options mdbx::env::get_reclaiming ( ) const
inline

Returns current reclaiming options.

◆ get_stat() [1/2]

env::stat mdbx::env::get_stat ( ) const
inline

Returns snapshot statistics about the MDBX environment.

◆ get_stat() [2/2]

env::stat mdbx::env::get_stat ( const txn txn) const
inline

Return statistics about the MDBX environment accordingly to the specified transaction.

◆ get_tree_deepmask()

uint32_t mdbx::txn::get_tree_deepmask ( map_handle  map) const
inline

Returns depth (bitmask) information of nested dupsort (multi-value) B+trees for given database.

◆ get_version()

constexpr const version_info & mdbx::get_version ( )
constexprnoexcept

Returns libmdbx version information.

◆ hash_value()

constexpr size_t mdbx::slice::hash_value ( ) const
constexprnoexcept

Returns the hash value of referenced data.

Attention
Function implementation and returned hash values may changed version to version, and in future the t1ha3 will be used here. Therefore values obtained from this function shouldn't be persisted anywhere.

◆ head()

constexpr slice mdbx::slice::head ( size_t  n) const
constexprnoexcept

Returns the first "n" bytes of the slice.

Precondition
REQUIRES: n <= size()

◆ hex_decode()

template<class ALLOCATOR , class CAPACITY_POLICY >
buffer< ALLOCATOR, CAPACITY_POLICY > mdbx::slice::hex_decode ( bool  ignore_spaces = false,
const ALLOCATOR &  allocator = ALLOCATOR() 
) const
inline

Decodes hexadecimal dump from the slice content to returned buffer.

◆ id()

uint64_t mdbx::txn::id ( ) const
inline

Return the transaction's ID.

◆ insert() [1/2]

void mdbx::cursor::insert ( const slice key,
slice  value 
)
inline

◆ insert() [2/2]

void mdbx::txn::insert ( map_handle  map,
const slice key,
slice  value 
)
inline

◆ insert_reserve() [1/2]

slice mdbx::cursor::insert_reserve ( const slice key,
size_t  value_length 
)
inline

◆ insert_reserve() [2/2]

slice mdbx::txn::insert_reserve ( map_handle  map,
const slice key,
size_t  value_length 
)
inline

◆ invalidate()

constexpr void mdbx::slice::invalidate ( )
constexprnoexcept

Depletes content of slice and make it invalid.

◆ is_base58()

bool mdbx::slice::is_base58 ( bool  ignore_spaces = false) const
inlinenoexcept

Checks whether the content of the slice is a Base58 dump.

Parameters
[in]ignore_spacesIf true function will skips spaces surrounding (before, between and after) a encoded bytes. However, spaces should not break a code group of characters.

◆ is_base64()

bool mdbx::slice::is_base64 ( bool  ignore_spaces = false) const
inlinenoexcept

Checks whether the content of the slice is a Base64 dump.

Parameters
[in]ignore_spacesIf true function will skips spaces surrounding (before, between and after) a encoded bytes. However, spaces should not break a code group of characters.

◆ is_clean()

bool mdbx::exception_thunk::is_clean ( ) const
inlinenoexcept

◆ is_dirty()

bool mdbx::txn::is_dirty ( const void *  ptr) const
inline

Checks whether the given data is on a dirty page.

◆ is_failure()

constexpr bool mdbx::error::is_failure ( ) const
constexprnoexcept

◆ is_hex()

bool mdbx::slice::is_hex ( bool  ignore_spaces = false) const
inlinenoexcept

Checks whether the content of the slice is a hexadecimal dump.

Parameters
[in]ignore_spacesIf true function will skips spaces surrounding (before, between and after) a encoded bytes. However, spaces should not break a pair of characters encoding a single byte.

◆ is_mdbx_error()

constexpr bool mdbx::error::is_mdbx_error ( ) const
constexprnoexcept

Returns true for MDBX's errors.

◆ is_msgpack() [1/2]

MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_msgpack ( key_mode  mode)
noexcept

◆ is_msgpack() [2/2]

MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_msgpack ( value_mode  mode)
noexcept

◆ is_multi()

MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_multi ( value_mode  mode)
noexcept

◆ is_null()

constexpr bool mdbx::slice::is_null ( ) const
constexprnoexcept

Checks whether the slice data pointer is nullptr.

◆ is_ordinal() [1/2]

MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_ordinal ( key_mode  mode)
noexcept

◆ is_ordinal() [2/2]

MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_ordinal ( value_mode  mode)
noexcept

◆ is_result_false()

constexpr bool mdbx::error::is_result_false ( ) const
constexprnoexcept

◆ is_result_true()

constexpr bool mdbx::error::is_result_true ( ) const
constexprnoexcept

◆ is_reverse() [1/2]

MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_reverse ( key_mode  mode)
noexcept

◆ is_reverse() [2/2]

MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_reverse ( value_mode  mode)
noexcept

◆ is_samelength() [1/2]

MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_samelength ( key_mode  mode)
noexcept

◆ is_samelength() [2/2]

MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_samelength ( value_mode  mode)
noexcept

◆ is_success()

constexpr bool mdbx::error::is_success ( ) const
constexprnoexcept

◆ is_usual() [1/2]

MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_usual ( key_mode  mode)
noexcept

◆ is_usual() [2/2]

MDBX_CXX01_CONSTEXPR_ENUM bool mdbx::is_usual ( value_mode  mode)
noexcept

◆ key_max() [1/4]

size_t mdbx::env::limits::key_max ( const env env,
key_mode  mode 
)
inlinestatic

Returns the maximal key size in bytes for given environment and keys mode.

◆ key_max() [2/4]

size_t mdbx::env::limits::key_max ( const env env,
MDBX_db_flags_t  flags 
)
inlinestatic

Returns the maximal key size in bytes for given environment and database flags.

◆ key_max() [3/4]

size_t mdbx::env::limits::key_max ( intptr_t  pagesize,
key_mode  mode 
)
inlinestatic

Returns the maximal key size in bytes for specified page size and keys mode.

◆ key_max() [4/4]

size_t mdbx::env::limits::key_max ( intptr_t  pagesize,
MDBX_db_flags_t  flags 
)
inlinestatic

Returns the maximal key size in bytes for specified page size and database flags.

◆ key_min() [1/2]

size_t mdbx::env::limits::key_min ( key_mode  mode)
inlinestaticnoexcept

Returns the minimal key size in bytes for specified keys mode.

◆ key_min() [2/2]

size_t mdbx::env::limits::key_min ( MDBX_db_flags_t  flags)
inlinestaticnoexcept

Returns the minimal key size in bytes for specified database flags.

◆ key_mode()

MDBX_CXX11_CONSTEXPR_ENUM mdbx::key_mode mdbx::map_handle::info::key_mode ( ) const
noexcept

◆ length()

constexpr size_t mdbx::slice::length ( ) const
constexprnoexcept

Returns the number of bytes.

◆ lower_bound()

cursor::move_result mdbx::cursor::lower_bound ( const slice key,
bool  throw_notfound = false 
)
inline

◆ lower_bound_multivalue()

cursor::move_result mdbx::cursor::lower_bound_multivalue ( const slice key,
const slice value,
bool  throw_notfound = false 
)
inline

◆ make_dynamic()

env::geometry & mdbx::env::geometry::make_dynamic ( intptr_t  lower = minimal_value,
intptr_t  upper = maximal_value 
)
inlinenoexcept

◆ make_fixed()

env::geometry & mdbx::env::geometry::make_fixed ( intptr_t  size)
inlinenoexcept

◆ map()

map_handle mdbx::cursor::map ( ) const
inline

◆ max_maps()

unsigned mdbx::env::max_maps ( ) const
inline

Returns the maximum number of named databases for the environment.

See also
extra_runtime_option::max_maps

◆ max_readers()

unsigned mdbx::env::max_readers ( ) const
inline

Returns the maximum number of threads/reader slots for the environment.

See also
extra_runtime_option::max_readers

◆ middle()

constexpr slice mdbx::slice::middle ( size_t  from,
size_t  n 
) const
constexprnoexcept

Returns the middle "n" bytes of the slice.

Precondition
REQUIRES: from + n <= size()

◆ move()

bool mdbx::cursor::move ( move_operation  operation,
MDBX_val key,
MDBX_val value,
bool  throw_notfound 
) const
inlineprotected

◆ on_first()

bool mdbx::cursor::on_first ( ) const
inline

◆ on_first_multival()

bool mdbx::cursor::on_first_multival ( ) const
inline

◆ on_last()

bool mdbx::cursor::on_last ( ) const
inline

◆ on_last_multival()

bool mdbx::cursor::on_last_multival ( ) const
inline

◆ open_cursor()

cursor_managed mdbx::txn::open_cursor ( map_handle  map) const
inline

Opens cursor for specified key-value map handle.

◆ open_map() [1/3]

mdbx::map_handle mdbx::txn::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
inline

Open existing key-value map.

◆ open_map() [2/3]

mdbx::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
inline

Open existing key-value map.

◆ open_map() [3/3]

mdbx::map_handle mdbx::txn::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
inline

Open existing key-value map.

◆ open_map_accede() [1/3]

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

Open existing key-value map.

◆ open_map_accede() [2/3]

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

Open existing key-value map.

◆ open_map_accede() [3/3]

mdbx::map_handle mdbx::txn::open_map_accede ( const char *  name) const
inline

Open existing key-value map.

◆ operator const MDBX_cursor *()

constexpr mdbx::cursor::operator const MDBX_cursor * ( ) const
constexpr

◆ operator const MDBX_env *()

constexpr mdbx::env::operator const MDBX_env * ( ) const
constexpr

◆ operator const MDBX_txn *()

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

◆ operator MDBX_cursor *()

constexpr mdbx::cursor::operator MDBX_cursor * ( )
constexpr

◆ operator MDBX_env *()

constexpr mdbx::env::operator MDBX_env * ( )
constexpr

◆ operator MDBX_txn *()

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

◆ operator!=() [1/6]

constexpr bool mdbx::operator!= ( const cursor a,
const cursor b 
)
constexprnoexcept

◆ operator!=() [2/6]

constexpr bool mdbx::operator!= ( const env a,
const env b 
)
constexprnoexcept

◆ operator!=() [3/6]

constexpr bool mdbx::operator!= ( const error a,
const error b 
)
constexprnoexcept

◆ operator!=() [4/6]

constexpr bool mdbx::operator!= ( const pair a,
const pair b 
)
constexprnoexcept

◆ operator!=() [5/6]

constexpr bool mdbx::operator!= ( const slice a,
const slice b 
)
constexprnoexcept

◆ operator!=() [6/6]

constexpr bool mdbx::operator!= ( const txn a,
const txn b 
)
constexprnoexcept

◆ operator<() [1/2]

constexpr bool mdbx::operator< ( const pair a,
const pair b 
)
constexprnoexcept

◆ operator<() [2/2]

constexpr bool mdbx::operator< ( const slice a,
const slice b 
)
constexprnoexcept

◆ operator<<() [1/16]

LIBMDBX_API ::std::ostream& mdbx::operator<< ( ::std::ostream &  ,
const env::durability  
)

◆ operator<<() [2/16]

LIBMDBX_API ::std::ostream& mdbx::operator<< ( ::std::ostream &  ,
const env::geometry  
)

◆ operator<<() [3/16]

LIBMDBX_API ::std::ostream& mdbx::operator<< ( ::std::ostream &  ,
const env::geometry::size  
)

◆ operator<<() [4/16]

LIBMDBX_API ::std::ostream& mdbx::operator<< ( ::std::ostream &  ,
const env::mode  
)

◆ operator<<() [5/16]

LIBMDBX_API ::std::ostream& mdbx::operator<< ( ::std::ostream &  ,
const env::operate_options  
)

◆ operator<<() [6/16]

LIBMDBX_API ::std::ostream& mdbx::operator<< ( ::std::ostream &  ,
const env::operate_parameters  
)

◆ operator<<() [7/16]

LIBMDBX_API ::std::ostream& mdbx::operator<< ( ::std::ostream &  ,
const env::reclaiming_options  
)

◆ operator<<() [8/16]

LIBMDBX_API ::std::ostream& mdbx::operator<< ( ::std::ostream &  ,
const env_managed::create_parameters  
)

◆ operator<<() [9/16]

LIBMDBX_API ::std::ostream& mdbx::operator<< ( ::std::ostream &  ,
const error  
)

◆ operator<<() [10/16]

LIBMDBX_API ::std::ostream& mdbx::operator<< ( ::std::ostream &  ,
const MDBX_debug_flags_t  
)

◆ operator<<() [11/16]

LIBMDBX_API ::std::ostream& mdbx::operator<< ( ::std::ostream &  ,
const MDBX_log_level_t  
)

◆ operator<<() [12/16]

LIBMDBX_API ::std::ostream& mdbx::operator<< ( ::std::ostream &  ,
const pair  
)

◆ operator<<() [13/16]

LIBMDBX_API ::std::ostream& mdbx::operator<< ( ::std::ostream &  ,
const pair_result  
)

◆ operator<<() [14/16]

LIBMDBX_API ::std::ostream& mdbx::operator<< ( ::std::ostream &  ,
const slice  
)

◆ operator<<() [15/16]

template<class ALLOCATOR , typename CAPACITY_POLICY >
inline ::std::ostream& mdbx::operator<< ( ::std::ostream &  out,
const buffer< ALLOCATOR, CAPACITY_POLICY > &  it 
)

◆ operator<<() [16/16]

inline ::std::ostream& mdbx::operator<< ( ::std::ostream &  out,
const MDBX_error_t errcode 
)

◆ operator<=() [1/2]

constexpr bool mdbx::operator<= ( const pair a,
const pair b 
)
constexprnoexcept

◆ operator<=() [2/2]

constexpr bool mdbx::operator<= ( const slice a,
const slice b 
)
constexprnoexcept

◆ operator=() [1/5]

slice & mdbx::slice::operator= ( ::MDBX_val &&  src)
inline

◆ operator=() [2/5]

cursor & mdbx::cursor::operator= ( cursor &&  other)
inlinenoexcept

◆ operator=() [3/5]

env & mdbx::env::operator= ( env &&  other)
inlinenoexcept

◆ operator=() [4/5]

slice & mdbx::slice::operator= ( slice &&  src)
inlinenoexcept

◆ operator=() [5/5]

txn & mdbx::txn::operator= ( txn &&  other)
inlinenoexcept

◆ operator==() [1/6]

constexpr bool mdbx::operator== ( const cursor a,
const cursor b 
)
constexprnoexcept

◆ operator==() [2/6]

constexpr bool mdbx::operator== ( const env a,
const env b 
)
constexprnoexcept

◆ operator==() [3/6]

constexpr bool mdbx::operator== ( const error a,
const error b 
)
constexprnoexcept

◆ operator==() [4/6]

constexpr bool mdbx::operator== ( const pair a,
const pair b 
)
constexprnoexcept

◆ operator==() [5/6]

constexpr bool mdbx::operator== ( const slice a,
const slice b 
)
constexprnoexcept

◆ operator==() [6/6]

constexpr bool mdbx::operator== ( const txn a,
const txn b 
)
constexprnoexcept

◆ operator>() [1/2]

constexpr bool mdbx::operator> ( const pair a,
const pair b 
)
constexprnoexcept

◆ operator>() [2/2]

constexpr bool mdbx::operator> ( const slice a,
const slice b 
)
constexprnoexcept

◆ operator>=() [1/2]

constexpr bool mdbx::operator>= ( const pair a,
const pair b 
)
constexprnoexcept

◆ operator>=() [2/2]

constexpr bool mdbx::operator>= ( const slice a,
const slice b 
)
constexprnoexcept

◆ operator[]()

constexpr byte mdbx::slice::operator[] ( size_t  n) const
constexprnoexcept

Returns the nth byte in the referenced data.

Precondition
REQUIRES: n < size()

◆ options_from_flags()

env::operate_options mdbx::env::operate_parameters::options_from_flags ( MDBX_env_flags_t  flags)
inlinestaticnoexcept

◆ pagesize_max()

size_t mdbx::env::limits::pagesize_max ( )
inlinestaticnoexcept

Returns the maximal database page size in bytes.

◆ pagesize_min()

size_t mdbx::env::limits::pagesize_min ( )
inlinestaticnoexcept

Returns the minimal database page size in bytes.

◆ pairsize4page_max() [1/4]

size_t mdbx::env::limits::pairsize4page_max ( const env env,
MDBX_db_flags_t  flags 
)
inlinestatic

Returns maximal size of key-value pair to fit in a single page for given environment and database flags.

◆ pairsize4page_max() [2/4]

size_t mdbx::env::limits::pairsize4page_max ( const env env,
value_mode  mode 
)
inlinestatic

Returns maximal size of key-value pair to fit in a single page for specified page size and values mode.

◆ pairsize4page_max() [3/4]

size_t mdbx::env::limits::pairsize4page_max ( intptr_t  pagesize,
MDBX_db_flags_t  flags 
)
inlinestatic

Returns maximal size of key-value pair to fit in a single page for specified size and database flags.

◆ pairsize4page_max() [4/4]

size_t mdbx::env::limits::pairsize4page_max ( intptr_t  pagesize,
value_mode  mode 
)
inlinestatic

Returns maximal size of key-value pair to fit in a single page for specified page size and values mode.

◆ panic_on_failure() [1/2]

void mdbx::error::panic_on_failure ( const char *  context_where,
const char *  func_who 
) const
inlinenoexcept

◆ panic_on_failure() [2/2]

void mdbx::error::panic_on_failure ( int  error_code,
const char *  context_where,
const char *  func_who 
)
inlinestaticnoexcept

◆ prepare_read()

txn_managed mdbx::env::prepare_read ( ) const
inline

Creates but not start read transaction.

◆ put() [1/3]

MDBX_error_t mdbx::cursor::put ( const slice key,
slice value,
MDBX_put_flags_t  flags 
)
inlinenoexcept

◆ put() [2/3]

MDBX_error_t mdbx::txn::put ( map_handle  map,
const slice key,
slice value,
MDBX_put_flags_t  flags 
)
inlinenoexcept

◆ put() [3/3]

void mdbx::txn::put ( map_handle  map,
const slice key,
slice  value,
put_mode  mode 
)
inline

◆ put_canary()

txn & mdbx::txn::put_canary ( const canary canary)
inline

Set integers markers (aka "canary") associated with the environment.

◆ put_multiple()

size_t mdbx::txn::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 
)
inline

◆ reclaiming_from_flags()

env::reclaiming_options mdbx::env::operate_parameters::reclaiming_from_flags ( MDBX_env_flags_t  flags)
inlinestaticnoexcept

◆ release_all_cursors()

size_t mdbx::txn::release_all_cursors ( bool  unbind) const
inline

Unbind or close all cursors.

◆ remove_prefix()

void mdbx::slice::remove_prefix ( size_t  n)
inlinenoexcept

Drops the first "n" bytes from this slice.

Precondition
REQUIRES: n <= size()

◆ remove_suffix()

void mdbx::slice::remove_suffix ( size_t  n)
inlinenoexcept

Drops the last "n" bytes from this slice.

Precondition
REQUIRES: n <= size()

◆ rename_map() [1/3]

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

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

◆ rename_map() [2/3]

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

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

◆ rename_map() [3/3]

void mdbx::txn::rename_map ( map_handle  map,
const char *  new_name 
)
inline

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

◆ renew()

void mdbx::cursor::renew ( const ::mdbx::txn txn)
inline

Renew/bind a cursor with a new transaction and previously used key-value map handle.

◆ renew_reading()

void mdbx::txn::renew_reading ( )
inline

Renew a read-only transaction.

◆ replace() [1/2]

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer< ALLOCATOR, CAPACITY_POLICY > mdbx::txn::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() 
)
inline

Replaces and returns a value of the key with new one.

◆ replace() [2/2]

void mdbx::txn::replace ( map_handle  map,
const slice key,
slice  old_value,
const slice new_value 
)
inline

Replaces the particular multi-value of the key with a new value.

◆ replace_reserve()

template<class ALLOCATOR , typename CAPACITY_POLICY >
buffer< ALLOCATOR, CAPACITY_POLICY > mdbx::txn::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() 
)
inline

◆ reset_reading()

void mdbx::txn::reset_reading ( )
inline

Reset a read-only transaction.

◆ rethrow_captured()

void mdbx::exception_thunk::rethrow_captured ( ) const
inline

◆ safe_head()

constexpr slice mdbx::slice::safe_head ( size_t  n) const
constexpr

Returns the first "n" bytes of the slice.

Exceptions
std::out_of_rangeif n >= size()

◆ safe_middle()

constexpr slice mdbx::slice::safe_middle ( size_t  from,
size_t  n 
) const
constexpr

Returns the middle "n" bytes of the slice.

Exceptions
std::out_of_rangeif from + n >= size()

◆ safe_remove_prefix()

void mdbx::slice::safe_remove_prefix ( size_t  n)
inline

Drops the first "n" bytes from this slice.

Exceptions
std::out_of_rangeif n > size()

◆ safe_remove_suffix()

void mdbx::slice::safe_remove_suffix ( size_t  n)
inline

Drops the last "n" bytes from this slice.

Exceptions
std::out_of_rangeif n > size()

◆ safe_tail()

constexpr slice mdbx::slice::safe_tail ( size_t  n) const
constexpr

Returns the last "n" bytes of the slice.

Exceptions
std::out_of_rangeif n >= size()

◆ seek()

bool mdbx::cursor::seek ( const slice key)
inline

◆ sequence() [1/2]

uint64_t mdbx::txn::sequence ( map_handle  map) const
inline

Reads sequence generator associated with a key-value map (aka sub-database).

◆ sequence() [2/2]

uint64_t mdbx::txn::sequence ( map_handle  map,
uint64_t  increment 
)
inline

Reads and increment sequence generator associated with a key-value map (aka sub-database).

◆ set_context() [1/3]

env & mdbx::env::set_context ( void *  your_context)
inline

Sets the application context associated with the environment.

◆ set_context() [2/3]

txn & mdbx::txn::set_context ( void *  your_context)
inline

Sets the application context associated with the transaction.

◆ set_context() [3/3]

cursor & mdbx::cursor::set_context ( void *  your_context)
inline

Sets the application context associated with the cursor.

◆ set_end()

constexpr slice & mdbx::slice::set_end ( const void *  ptr)
constexpr

Sets the length by specifying the end of the slice data.

◆ set_extra_option()

env & mdbx::env::set_extra_option ( enum env::extra_runtime_option  option,
uint64_t  value 
)
inline

Sets the value of a extra runtime options for an environment.

◆ set_geometry()

env & mdbx::env::set_geometry ( const geometry size)
inline

Set all size-related parameters of environment.

◆ set_HandleSlowReaders()

env & mdbx::env::set_HandleSlowReaders ( MDBX_hsr_func cb)
inline

Sets a Handle-Slow-Readers callback to resolve database full/overflow issue due to a reader(s) which prevents the old data from being recycled.

Such callback will be triggered in a case where there is not enough free space in the database due to long read transaction(s) which impedes reusing the pages of an old MVCC snapshot(s).

Using this callback you can choose how to resolve the situation:

  • abort the write transaction with an error;
  • wait for the read transaction(s) to complete;
  • notify a thread performing a long-lived read transaction and wait for an effect;
  • kill the thread or whole process that performs the long-lived read transaction;
See also
long-lived-read

◆ set_length()

constexpr slice & mdbx::slice::set_length ( size_t  bytes)
constexpr

Set slice length.

◆ set_sync_period__seconds_16dot16()

env & mdbx::env::set_sync_period__seconds_16dot16 ( unsigned  seconds_16dot16)
inline

Sets relative period since the last unsteady commit to force flush the data buffers to disk, for non-sync durability modes.

The relative period value affects all processes which operates with given environment until the last process close environment or a new value will be settled. Data is always written to disk when txn_managed::commit() is called, but the operating system may keep it buffered. MDBX always flushes the OS buffers upon commit as well, unless the environment was opened with whole_fragile, lazy_weak_tail or in part half_synchronous_weak_last. Settled period don't checked asynchronously, but only by the txn_managed::commit() and env::sync_to_disk() functions. Therefore, in cases where transactions are committed infrequently and/or irregularly, polling by env::poll_sync_to_disk() may be a reasonable solution to timeout enforcement.

The default is 0, than mean no any timeout checked, and no additional flush will be made.

See also
extra_runtime_option::sync_period
Parameters
[in]seconds_16dot16The period in 1/65536 of second when a synchronous flush would be made since the last unsteady commit.

◆ set_sync_period__seconds_double()

env & mdbx::env::set_sync_period__seconds_double ( double  seconds)
inline

Sets relative period since the last unsteady commit to force flush the data buffers to disk, for non-sync durability modes.

The relative period value affects all processes which operates with given environment until the last process close environment or a new value will be settled. Data is always written to disk when txn_managed::commit() is called, but the operating system may keep it buffered. MDBX always flushes the OS buffers upon commit as well, unless the environment was opened with whole_fragile, lazy_weak_tail or in part half_synchronous_weak_last. Settled period don't checked asynchronously, but only by the txn_managed::commit() and env::sync_to_disk() functions. Therefore, in cases where transactions are committed infrequently and/or irregularly, polling by env::poll_sync_to_disk() may be a reasonable solution to timeout enforcement.

The default is 0, than mean no any timeout checked, and no additional flush will be made.

See also
extra_runtime_option::sync_period
Parameters
[in]secondsThe period in second when a synchronous flush would be made since the last unsteady commit.

◆ set_sync_threshold()

env & mdbx::env::set_sync_threshold ( size_t  bytes)
inline

Sets threshold to force flush the data buffers to disk, for non-sync durability modes.

The threshold value affects all processes which operates with given environment until the last process close environment or a new value will be settled. Data is always written to disk when txn_managed::commit() is called, but the operating system may keep it buffered. MDBX always flushes the OS buffers upon commit as well, unless the environment was opened with whole_fragile, lazy_weak_tail or in part half_synchronous_weak_last.

The default is 0, than mean no any threshold checked, and no additional flush will be made.

See also
extra_runtime_option::sync_bytes

◆ size()

constexpr size_t mdbx::slice::size ( ) const
constexprnoexcept

Returns the number of bytes.

◆ start_read()

txn_managed mdbx::env::start_read ( ) const
inline

Starts read (read-only) transaction.

◆ start_write()

txn_managed mdbx::env::start_write ( bool  dont_wait = false)
inline

Starts write (read-write) transaction.

◆ starts_with()

constexpr bool mdbx::slice::starts_with ( const slice prefix) const
constexprnoexcept

Checks if the data starts with the given prefix.

◆ success_or_panic() [1/2]

void mdbx::error::success_or_panic ( const char *  context_where,
const char *  func_who 
) const
inlinenoexcept

◆ success_or_panic() [2/2]

void mdbx::error::success_or_panic ( int  error_code,
const char *  context_where,
const char *  func_who 
)
inlinestaticnoexcept

◆ success_or_throw() [1/4]

void mdbx::error::success_or_throw ( ) const
inline

◆ success_or_throw() [2/4]

void mdbx::error::success_or_throw ( const exception_thunk thunk) const
inline

◆ success_or_throw() [3/4]

void mdbx::error::success_or_throw ( int  error_code,
const exception_thunk thunk 
)
inlinestatic

◆ success_or_throw() [4/4]

void mdbx::error::success_or_throw ( MDBX_error_t  error_code)
inlinestatic

◆ swap()

void mdbx::slice::swap ( slice other)
inlinenoexcept

◆ sync_period__seconds_16dot16()

unsigned mdbx::env::sync_period__seconds_16dot16 ( ) const
inline

Gets relative period since the last unsteady commit that used to force flush the data buffers to disk, for non-sync durability modes.

The relative period value affects all processes which operates with given environment until the last process close environment or a new value will be settled. Data is always written to disk when txn_managed::commit() is called, but the operating system may keep it buffered. MDBX always flushes the OS buffers upon commit as well, unless the environment was opened with whole_fragile, lazy_weak_tail or in part half_synchronous_weak_last. Settled period don't checked asynchronously, but only by the txn_managed::commit() and env::sync_to_disk() functions. Therefore, in cases where transactions are committed infrequently and/or irregularly, polling by env::poll_sync_to_disk() may be a reasonable solution to timeout enforcement.

The default is 0, than mean no any timeout checked, and no additional flush will be made.

See also
extra_runtime_option::sync_period
set_sync_period(const duration&)
extra_runtime_option::sync_period
sync_period__seconds_16dot16(unsigned)

◆ sync_period__seconds_double()

double mdbx::env::sync_period__seconds_double ( ) const
inline

Gets relative period since the last unsteady commit that used to force flush the data buffers to disk, for non-sync durability modes.

The relative period value affects all processes which operates with given environment until the last process close environment or a new value will be settled. Data is always written to disk when txn_managed::commit() is called, but the operating system may keep it buffered. MDBX always flushes the OS buffers upon commit as well, unless the environment was opened with whole_fragile, lazy_weak_tail or in part half_synchronous_weak_last. Settled period don't checked asynchronously, but only by the txn_managed::commit() and env::sync_to_disk() functions. Therefore, in cases where transactions are committed infrequently and/or irregularly, polling by env::poll_sync_to_disk() may be a reasonable solution to timeout enforcement.

The default is 0, than mean no any timeout checked, and no additional flush will be made.

See also
extra_runtime_option::sync_period
set_sync_period(const duration&)
extra_runtime_option::sync_period
set_sync_period__seconds_double(double)

◆ sync_threshold()

size_t mdbx::env::sync_threshold ( ) const
inline

Gets threshold used to force flush the data buffers to disk, for non-sync durability modes.

The threshold value affects all processes which operates with given environment until the last process close environment or a new value will be settled. Data is always written to disk when txn_managed::commit() is called, but the operating system may keep it buffered. MDBX always flushes the OS buffers upon commit as well, unless the environment was opened with whole_fragile, lazy_weak_tail or in part half_synchronous_weak_last.

The default is 0, than mean no any threshold checked, and no additional flush will be made.

See also
extra_runtime_option::sync_bytes
extra_runtime_option::sync_bytes

◆ sync_to_disk()

bool mdbx::env::sync_to_disk ( bool  force = true,
bool  nonblock = false 
)
inline

Flush the environment data buffers.

Returns
True if sync done or no data to sync, or false if the environment is busy by other thread or none of the thresholds are reached.

◆ tail()

constexpr slice mdbx::slice::tail ( size_t  n) const
constexprnoexcept

Returns the last "n" bytes of the slice.

Precondition
REQUIRES: n <= size()

◆ throw_exception()

void mdbx::error::throw_exception ( int  error_code)
inlinestatic

◆ throw_on_failure() [1/2]

void mdbx::error::throw_on_failure ( ) const
inline

◆ throw_on_failure() [2/2]

void mdbx::error::throw_on_failure ( int  error_code)
inlinestatic

◆ throw_on_nullptr()

void mdbx::error::throw_on_nullptr ( const void *  ptr,
MDBX_error_t  error_code 
)
inlinestatic

◆ to_string() [1/14]

template<class ALLOCATOR , typename CAPACITY_POLICY >
string std::to_string ( const ::mdbx::buffer< ALLOCATOR, CAPACITY_POLICY > &  buffer)
inline

◆ to_string() [2/14]

string std::to_string ( const ::mdbx::env::durability value)
inline

◆ to_string() [3/14]

string std::to_string ( const ::mdbx::env::geometry value)
inline

◆ to_string() [4/14]

string std::to_string ( const ::mdbx::env::mode value)
inline

◆ to_string() [5/14]

string std::to_string ( const ::mdbx::env::operate_options value)
inline

◆ to_string() [6/14]

string std::to_string ( const ::mdbx::env::operate_parameters value)
inline

◆ to_string() [7/14]

string std::to_string ( const ::mdbx::env::reclaiming_options value)
inline

◆ to_string() [8/14]

string std::to_string ( const ::mdbx::env_managed::create_parameters value)
inline

◆ to_string() [9/14]

string std::to_string ( const ::mdbx::error value)
inline

◆ to_string() [10/14]

string std::to_string ( const ::mdbx::pair value)
inline

◆ to_string() [11/14]

string std::to_string ( const ::mdbx::slice value)
inline

◆ to_string() [12/14]

string std::to_string ( const ::MDBX_debug_flags_t value)
inline

◆ to_string() [13/14]

string std::to_string ( const ::MDBX_error_t errcode)
inline

◆ to_string() [14/14]

string std::to_string ( const ::MDBX_log_level_t value)
inline

◆ transaction_size_max()

size_t mdbx::env::limits::transaction_size_max ( intptr_t  pagesize)
inlinestatic

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

◆ try_insert() [1/2]

value_result mdbx::cursor::try_insert ( const slice key,
slice  value 
)
inline

◆ try_insert() [2/2]

value_result mdbx::txn::try_insert ( map_handle  map,
const slice key,
slice  value 
)
inline

◆ try_insert_reserve() [1/2]

value_result mdbx::cursor::try_insert_reserve ( const slice key,
size_t  value_length 
)
inline

◆ try_insert_reserve() [2/2]

value_result mdbx::txn::try_insert_reserve ( map_handle  map,
const slice key,
size_t  value_length 
)
inline

◆ try_start_write()

txn_managed mdbx::env::try_start_write ( )
inline

Tries to start write (read-write) transaction without blocking.

◆ try_update() [1/2]

bool mdbx::cursor::try_update ( const slice key,
const slice value 
)
inline

◆ try_update() [2/2]

bool mdbx::txn::try_update ( map_handle  map,
const slice key,
const slice value 
)
inline

◆ try_update_reserve() [1/2]

value_result mdbx::cursor::try_update_reserve ( const slice key,
size_t  value_length 
)
inline

◆ try_update_reserve() [2/2]

value_result mdbx::txn::try_update_reserve ( map_handle  map,
const slice key,
size_t  value_length 
)
inline

◆ txn() [3/3]

txn mdbx::cursor::txn ( ) const
inline

Returns the cursor's transaction.

◆ unbind()

void mdbx::cursor::unbind ( )
inline

Unbind cursor from a transaction.

◆ update() [1/2]

void mdbx::cursor::update ( const slice key,
const slice value 
)
inline

◆ update() [2/2]

void mdbx::txn::update ( map_handle  map,
const slice key,
const slice value 
)
inline

◆ update_reserve() [1/2]

slice mdbx::cursor::update_reserve ( const slice key,
size_t  value_length 
)
inline

◆ update_reserve() [2/2]

slice mdbx::txn::update_reserve ( map_handle  map,
const slice key,
size_t  value_length 
)
inline

◆ upsert() [1/2]

void mdbx::cursor::upsert ( const slice key,
const slice value 
)
inline

◆ upsert() [2/2]

void mdbx::txn::upsert ( map_handle  map,
const slice key,
const slice value 
)
inline

◆ upsert_reserve() [1/2]

slice mdbx::cursor::upsert_reserve ( const slice key,
size_t  value_length 
)
inline

◆ upsert_reserve() [2/2]

slice mdbx::txn::upsert_reserve ( map_handle  map,
const slice key,
size_t  value_length 
)
inline

◆ valsize4page_max() [1/4]

size_t mdbx::env::limits::valsize4page_max ( const env env,
MDBX_db_flags_t  flags 
)
inlinestatic

Returns maximal data size in bytes to fit in a leaf-page or single overflow/large-page for given environment and database flags.

◆ valsize4page_max() [2/4]

size_t mdbx::env::limits::valsize4page_max ( const env env,
value_mode  mode 
)
inlinestatic

Returns maximal data size in bytes to fit in a leaf-page or single overflow/large-page for specified page size and values mode.

◆ valsize4page_max() [3/4]

size_t mdbx::env::limits::valsize4page_max ( intptr_t  pagesize,
MDBX_db_flags_t  flags 
)
inlinestatic

Returns maximal data size in bytes to fit in a leaf-page or single overflow/large-page for specified size and database flags.

◆ valsize4page_max() [4/4]

size_t mdbx::env::limits::valsize4page_max ( intptr_t  pagesize,
value_mode  mode 
)
inlinestatic

Returns maximal data size in bytes to fit in a leaf-page or single overflow/large-page for specified page size and values mode.

◆ value_max() [1/4]

size_t mdbx::env::limits::value_max ( const env env,
MDBX_db_flags_t  flags 
)
inlinestatic

Returns the maximal value size in bytes for given environment and database flags.

◆ value_max() [2/4]

size_t mdbx::env::limits::value_max ( const env env,
value_mode  mode 
)
inlinestatic

Returns the maximal value size in bytes for specified page size and values mode.

◆ value_max() [3/4]

size_t mdbx::env::limits::value_max ( intptr_t  pagesize,
MDBX_db_flags_t  flags 
)
inlinestatic

Returns the maximal value size in bytes for specified page size and database flags.

◆ value_max() [4/4]

size_t mdbx::env::limits::value_max ( intptr_t  pagesize,
value_mode  mode 
)
inlinestatic

Returns the maximal value size in bytes for specified page size and values mode.

◆ value_min() [1/2]

size_t mdbx::env::limits::value_min ( MDBX_db_flags_t  flags)
inlinestaticnoexcept

Returns the minimal values size in bytes for specified database flags.

◆ value_min() [2/2]

size_t mdbx::env::limits::value_min ( value_mode  mode)
inlinestaticnoexcept

Returns the minimal values size in bytes for specified values mode.

◆ value_mode()

MDBX_CXX11_CONSTEXPR_ENUM mdbx::value_mode mdbx::map_handle::info::value_mode ( ) const
noexcept