Group cxx_api
Modules
| Type | Name |
|---|---|
| module | Environment, Transactions, Cursors, Key-value tables and map handles |
| module | Slices and Buffers |
| module | Exceptions and Errors |
Namespaces
| Type | Name |
|---|---|
| namespace | mdbx The libmdbx C++ API namespace. |
| namespace | std STL namespace. |
Public Types
| Type | Name |
|---|---|
| typedef buffer_pair_spec< typename BUFFER::allocator_type, typename BUFFER::reservation_policy > | buffer_pair Combines pair of buffers for key and value to hold an operands for certain operations. |
| typedef ::MDBX_build_info | build_info libmdbx build information |
| typedef char8_t | byte The byte-like type that don't presumes aliases for pointers as does the char . |
| typedef polymorphic_allocator | default_allocator |
| typedef buffer< default_allocator, default_capacity_policy > | default_buffer Default buffer. |
| typedef buffer_pair< default_buffer > | default_buffer_pair Default pair of buffers. |
| typedef ::std::chrono::duration< unsigned, ::std::ratio< 1, 65536 > > | duration Duration in 1/65536 units of second. |
| typedef ::mdbx_filehandle_t | filehandle |
| typedef ::std::string::allocator_type | legacy_allocator Legacy allocator but it is recommended to use polymorphic_allocator . |
| typedef ::mdbx::filesystem::path | path |
| typedef path_string::value_type | path_char |
| typedef ::mdbx::filesystem::path::string_type | path_string |
| typedef ::std::pmr::string::allocator_type | polymorphic_allocator Default polymorphic allocator for modern code. |
| typedef ::std::basic_string< char, ::std::char_traits< char >, ALLOCATOR > | string Default single-byte string. |
| typedef uint64_t | txnid Transaction ID and MVCC-snapshot number. |
| typedef ::MDBX_version_info | version_info libmdbx version information, |
Public Attributes
| Type | Name |
|---|---|
| class MDBX_MSVC_DECLSPEC_EMPTY_BASES | buffer |
Public Static Attributes
| Type | Name |
|---|---|
| const MDBX_chk_callbacks_t | silent_chk_callbacks = {} |
Public Functions
| Type | Name |
|---|---|
| MDBX_EXTERN_API_TEMPLATE (LIBMDBX_API_TYPE, buffer< legacy_allocator, default_capacity_policy >) |
|
| MDBX_EXTERN_API_TEMPLATE (LIBMDBX_API_TYPE, buffer< polymorphic_allocator, default_capacity_policy >) |
|
| env & | alter_flags (MDBX_env_flags_t flags, bool on_off) Alter environment flags. |
| 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. |
| string< ALLOCATOR > | as_base58_string (unsigned wrap_width=0, const ALLOCATOR & alloc=ALLOCATOR()) const Returns a string with a Base58 dump of the slice content. |
| string< ALLOCATOR > | as_base64_string (unsigned wrap_width=0, const ALLOCATOR & alloc=ALLOCATOR()) const Returns a string with a Base64 dump of the slice content. |
| buffer< ALLOCATOR, CAPACITY_POLICY > | as_buffer (const ALLOCATOR & alloc=ALLOCATOR()) const Returns a buffer with a hexadecimal dump of a passed slice. |
| buffer< ALLOCATOR, CAPACITY_POLICY > | as_buffer (const ALLOCATOR & alloc=ALLOCATOR()) const Returns a buffer with a Base58 dump of a passed slice. |
| buffer< ALLOCATOR, CAPACITY_POLICY > | as_buffer (const ALLOCATOR & alloc=ALLOCATOR()) const Returns a buffer with a Base64 dump of a passed slice. |
| buffer< ALLOCATOR, CAPACITY_POLICY > | as_buffer (const ALLOCATOR & alloc=ALLOCATOR()) const Decodes hexadecimal dump from a passed slice to returned buffer. |
| buffer< ALLOCATOR, CAPACITY_POLICY > | as_buffer (const ALLOCATOR & alloc=ALLOCATOR()) const Decodes Base58 dump from a passed slice to returned buffer. |
| buffer< ALLOCATOR, CAPACITY_POLICY > | as_buffer (const ALLOCATOR & alloc=ALLOCATOR()) const Decodes Base64 dump from a passed slice to returned buffer. |
| string< ALLOCATOR > | as_hex_string (bool uppercase=false, unsigned wrap_width=0, const ALLOCATOR & alloc=ALLOCATOR()) const Returns a string with a hexadecimal dump of the slice content. |
| string< ALLOCATOR > | as_string (const ALLOCATOR & alloc=ALLOCATOR()) const Returns a string with a hexadecimal dump of a passed slice. |
| string< ALLOCATOR > | as_string (const ALLOCATOR & alloc=ALLOCATOR()) const Returns a string with a Base58 dump of a passed slice. |
| string< ALLOCATOR > | as_string (const ALLOCATOR & alloc=ALLOCATOR()) const Returns a string with a Base64 dump of a passed slice. |
| string< ALLOCATOR > | as_string (const ALLOCATOR & alloc=ALLOCATOR()) const Decodes hexadecimal dump from a passed slice to returned string. |
| string< ALLOCATOR > | as_string (const ALLOCATOR & alloc=ALLOCATOR()) const Decodes Base58 dump from a passed slice to returned string. |
| string< ALLOCATOR > | as_string (const ALLOCATOR & alloc=ALLOCATOR()) const Decodes Base64 dump from a passed slice to returned string. |
| slice & | assign (const void * ptr, size_t bytes) |
| slice & | assign (const slice & src) noexcept |
| slice & | assign (const ::MDBX_val & src) |
| slice & | assign (slice && src) noexcept |
| slice & | assign (::MDBX_val && src) |
| slice & | assign (const void * begin, const void * end) |
| slice & | assign (const char * c_str) |
| cursor & | assign (const cursor & src) |
| byte | at (size_t n) const Returns the nth byte in the referenced data with bounds checking. |
| buffer< ALLOCATOR, CAPACITY_POLICY > | base58_decode (bool ignore_spaces=false, const ALLOCATOR & alloc=ALLOCATOR()) const Decodes Base58 dump from the slice content to returned buffer. |
| buffer< ALLOCATOR, CAPACITY_POLICY > | base64_decode (bool ignore_spaces=false, const ALLOCATOR & alloc=ALLOCATOR()) const Decodes Base64 dump from the slice content to returned buffer. |
| const byte * | begin () noexcept const Returns an iterator to the beginning of the referenced data. |
| byte * | begin () noexcept Returns an iterator to the beginning of the referenced data. |
| void | bind (::mdbx::txn & txn, ::mdbx::map_handle map_handle) Bind/renew a cursor with a new transaction and specified key-value map handle. |
| constexpr | buffer (const struct slice & src, bool make_reference, const allocator_type & alloc=allocator_type()) |
| buffer (const txn & transaction, const struct slice & src, const allocator_type & alloc) |
|
| const byte * | byte_ptr () noexcept const Returns casted to pointer to byte an address of data. |
| byte * | byte_ptr () noexcept |
| void | capture () noexcept |
| const char * | char_ptr () noexcept const Returns casted to pointer to char an address of data. |
| char * | char_ptr () noexcept |
| unsigned | check_readers () Checks for stale readers in the lock table and return number of cleared slots. |
| MDBX_NODISCARD MDBX_chk_context_t & | chk (MDBX_chk_context_t & ctx, const MDBX_chk_callbacks_t * cb=nullptr, MDBX_chk_flags_t flags=MDBX_CHK_DEFAULTS, MDBX_chk_severity_t verbosity=MDBX_chk_info, unsigned timeout_seconds_16dot16=0) const Checks the integrity of the environment (database). |
| void | clear () noexcept Makes the slice empty and referencing to nothing. |
| void | clear_map (map_handle map) Clear key-value map. |
| bool | clear_map (const ::std::string & name, bool throw_if_absent=false) |
| txn_managed | clone (void * context=nullptr) const Clone read transaction. |
| void | clone (txn_managed & txn_for_renew_into_clone, void * context=nullptr) const Renew given read transaction into clone. |
| void | close_map (const map_handle & handle) Close a key-value map (aka table) handle. Normally unnecessary. |
| MDBX_error_t | code () noexcept const Returns error code. |
| int | compare_keys (map_handle map, const slice & a, const slice & b) noexcept const Compare two keys according to a particular key-value map (aka table). |
| int | compare_keys (map_handle map, const pair & a, const pair & b) noexcept const Compare keys of two pairs according to a particular key-value map (aka table). |
| int | compare_position (const cursor & left, const cursor & right, bool ignore_nested=false) |
| int | compare_position_nothrow (const cursor & left, const cursor & right, bool ignore_nested=false) |
| int | compare_values (map_handle map, const slice & a, const slice & b) noexcept const Compare two values according to a particular key-value map (aka table). |
| int | compare_values (map_handle map, const pair & a, const pair & b) noexcept const Compare values of two pairs according to a particular key-value map(aka table). |
| void | copy (const char * destination, bool compactify, bool force_dynamic_size=false) Copy an MVCC-snapshot of the database to the destination path. |
| void | copy (const ::std::string & destination, bool compactify, bool force_dynamic_size=false) Copy an MVCC-snapshot of the database to the destination path. |
| void | copy (const ::mdbx::filesystem::path & destination, bool compactify, bool force_dynamic_size=false) Copy an MVCC-snapshot of the database to the destination path. |
| void | copy (filehandle fd, bool compactify, bool force_dynamic_size=false) Copy an MVCC-snapshot of the database to the given file handle. |
| size_t | count_multivalue () const Return count of duplicates for current key. |
| size_t | count_multivalue (MDBX_stat * stat) const Return count of duplicates for current key, along with basic statistics of the table. |
| map_handle | create_map (const slice & 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. |
| 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. |
| 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. |
| constexpr | cursor (MDBX_cursor * ptr) noexcept |
| cursor (cursor && other) noexcept |
|
| const void * | data () noexcept const Return a pointer to the beginning of the referenced data. |
| void * | data () noexcept |
| defrag_result | defrag (VISITOR & visitor, size_t defrag_atleast=0, size_t time_atleast_dot16=0, size_t defrag_enough=0, size_t time_limit_dot16=0, intptr_t acceptable_backlash=-1, intptr_t preferred_batch=0) Performs database defragmentation. |
| defrag_result | defrag (size_t defrag_atleast=0, size_t time_atleast_dot16=0, size_t defrag_enough=0, size_t time_limit_dot16=0, intptr_t acceptable_backlash=-1, intptr_t preferred_batch=0) Performs database defragmentation without a progress visitor. |
| operate_parameters & | disable_clear_memory (bool value=true) noexcept Sets the clear-memory disable mode, i.e. operate_options::disable_clear_memory . |
| operate_parameters & | disable_readahead (bool value=true) noexcept Sets the readahead disable mode, i.e. operate_options::disable_readahead . |
| void | drop_map (map_handle map) Drops key-value map using handle. |
| bool | drop_map (const ::std::string & name, bool throw_if_absent=false) Drop key-value map. |
| bool | empty () noexcept const Checks whether the slice is empty. |
| operate_parameters & | enable_validation (bool value=true) noexcept Sets the validation enable mode, i.e. operate_options::enable_validation . |
| buffer< ALLOCATOR, CAPACITY_POLICY > | encode_base58 (unsigned wrap_width=0, const ALLOCATOR & alloc=ALLOCATOR()) const Returns a buffer with a Base58 dump of the slice content. |
| buffer< ALLOCATOR, CAPACITY_POLICY > | encode_base64 (unsigned wrap_width=0, const ALLOCATOR & alloc=ALLOCATOR()) const Returns a buffer with a Base64 dump of the slice content. |
| buffer< ALLOCATOR, CAPACITY_POLICY > | encode_hex (bool uppercase=false, unsigned wrap_width=0, const ALLOCATOR & alloc=ALLOCATOR()) const Returns a buffer with a hexadecimal dump of the slice content. |
| const byte * | end () noexcept const Return a pointer to the end of the referenced data. |
| byte * | end () noexcept Return a pointer to the end of the referenced data. |
| const byte * | end_byte_ptr () noexcept const Returns casted to pointer to byte an end of data. |
| byte * | end_byte_ptr () noexcept |
| const char * | end_char_ptr () noexcept const Returns casted to pointer to char an end of data. |
| char * | end_char_ptr () noexcept |
| bool | ends_with (const slice & suffix) noexcept const Checks if the data ends with the given suffix. |
| int | enumerate_readers (VISITOR & visitor) Enumerate readers. |
| int | enumerate_tables (VISITOR & visitor) const Enumerates user's named tables in a database. |
| env (env && other) noexcept |
|
| inline ::mdbx::env | env () noexcept const Returns the transaction's environment. |
| bool | eof () const |
| bool | erase (map_handle map, const slice & key) Removes all values for given key. |
| bool | erase (map_handle map, const slice & key, const slice & value) Removes the particular multi-value entry of the key. |
| bool | erase (bool whole_multivalue=false) Removes single key-value pair or all multi-values at the current cursor position. |
| bool | erase (const slice & key, bool whole_multivalue=true) Seeks and removes first value or whole multi-value of the given key. |
| bool | erase (const slice & key, const slice & value) Seeks and removes the particular multi-value entry of the key. |
| size_t | erase_bunch (bunch_delete action) Quickly removes bunches of neighboring items much faster by cutting out entire pages and branches from the B+ tree structure. |
| size_t | erase_range (const cursor & end, bool end_including) Quickly removes a range of items between the current cursor position and the position of end much faster by cutting out entire pages and branches from the B+ tree structure. |
| constexpr | error (MDBX_error_t error_code) noexcept |
| ptrdiff_t | estimate (const cursor & from, const cursor & to) |
| 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 |
| 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, const slice & key) const |
| ptrdiff_t | estimate_from_first (map_handle map, const slice & to) const |
| estimate_result (const cursor & cursor, move_operation operation, const slice & key, const slice & value) |
|
| ptrdiff_t | estimate_to_last (map_handle map, const slice & from) const |
| operate_parameters & | exclusive (bool value=true) noexcept Sets the exclusive mode, i.e. operate_options::exclusive . |
| uint64_t | extra_option (extra_runtime_option option) const Gets the value of extra runtime options from an environment. |
| BUFFER | extract (map_handle map, const slice & key, const ALLOCATOR & alloc=ALLOCATOR()) Removes and return a value of the key. |
| size_t | find (const slice & needle, size_t pos=0) noexcept const Finds the first occurrence of needle starting atpos . |
| size_t | find (byte c, size_t pos=0) noexcept const Finds the first occurrence of needle starting atpos . |
| move_result | find (const slice & key, bool throw_notfound=true) |
| size_t | find_first_not_of (const slice & chars, size_t pos=0) noexcept const Finds the first byte not matching any byte of chars starting atpos . |
| size_t | find_first_not_of (byte c, size_t pos=0) noexcept const Finds the first byte not matching any byte of chars starting atpos . |
| size_t | find_first_of (const slice & chars, size_t pos=0) noexcept const Finds the first byte matching any byte of chars starting atpos . |
| size_t | find_first_of (byte c, size_t pos=0) noexcept const Finds the first byte matching any byte of chars starting atpos . |
| size_t | find_last_not_of (const slice & chars, size_t pos=npos) noexcept const Finds the last byte not matching any byte of chars not afterpos . |
| size_t | find_last_not_of (byte c, size_t pos=npos) noexcept const Finds the last byte not matching any byte of chars not afterpos . |
| size_t | find_last_of (const slice & chars, size_t pos=npos) noexcept const Finds the last byte matching any byte of chars not afterpos . |
| size_t | find_last_of (byte c, size_t pos=npos) noexcept const Finds the last byte matching any byte of chars not afterpos . |
| move_result | find_multivalue (const slice & key, const slice & value, bool throw_notfound=true) |
| MDBX_txn_flags_t | flags () const Returns transaction's flags. |
| slice | get (map_handle map, const slice & key) const Get value by key from a key-value map (aka table). |
| 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 table). |
| slice | get (map_handle map, const slice & key, const slice & value_at_absence) const Get value by key from a key-value map (aka table). |
| 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 table). |
| MDBX_hsr_func | get_HandleSlowReaders () noexcept const 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. |
| inline ::std::vector< pair > | get_batch (size_t max_pairs, move_operation op, bool * is_last=nullptr) const Reads a batch of key-value pairs. |
| const build_info & | get_build () noexcept Returns libmdbx build information. |
| MDBX_NODISCARD cache_result | get_cached (map_handle map, const slice & key, slice * data, cache_entry & entry) const Gets a value by key using the transparent read-your-writes cache. |
| MDBX_NODISCARD slice | get_cached (map_handle map, const slice & key, cache_entry & entry, cache_status * status=nullptr) const Gets a value by key using the transparent read-your-writes cache, throwing exceptions on errors. |
| canary | get_canary () const Returns the four integer markers (aka "canary") associated with the environment. |
| void * | get_context () noexcept const Returns the application context associated with the environment. |
| void * | get_context () noexcept const Returns the application context associated with the transaction. |
| void * | get_context () noexcept const Returns the application context associated with the cursor. |
| MDBX_NODISCARD env::durability | get_durability () const Returns current durability mode. |
| pair_result | get_equal_or_great (map_handle map, const slice & key) const Gets the value for an equal or greater key from a table. |
| pair_result | get_equal_or_great (map_handle map, const slice & key, const slice & value_at_absence) const Gets the value for an equal or greater key from a table. |
| filehandle | get_filehandle () const Returns the file descriptor for the DXB file of MDBX environment. |
| MDBX_env_flags_t | get_flags () const Returns environment flags. |
| gc_info | get_gc_info (VISITOR & visitor) const Provides information of Garbage Collection and page usage. |
| gc_info | get_gc_info () const |
| info | get_info () const Return snapshot information about the MDBX environment. |
| info | get_info (const txn & txn) const Return information about the MDBX environment accordingly to the specified transaction. |
| info | get_info (bool scan_reader_lock_table=false) const Returns information about the MDBX transaction. |
| map_handle::info | get_map_flags (map_handle map) const Returns information about key-value map (aka table) handle. |
| map_stat | get_map_stat (map_handle map) const Returns statistics for a table. |
| MDBX_NODISCARD env::mode | get_mode () const Returns current operation mode. |
| MDBX_NODISCARD env::operate_parameters | get_operation_parameters () const Returns current operation parameters. |
| MDBX_NODISCARD env::operate_options | get_options () const Returns current operate options. |
| MDBX_NODISCARD env::reclaiming_options | get_reclaiming () const Returns current reclaiming options. |
| stat | get_stat () const Returns snapshot statistics about the MDBX environment. |
| stat | get_stat (const txn & txn) const Return statistics about the MDBX environment accordingly to the specified transaction. |
| uint32_t | get_tree_deepmask (map_handle map) const Returns depth (bitmask) information of nested dupsort (multi-value) B+trees for given table. |
| const version_info & | get_version () noexcept Returns libmdbx version information. |
| operate_parameters & | half_synchronous_weak_last () noexcept Sets the durability level to env::durability::half_synchronous_weak_last . |
| size_t | hash_value () noexcept const Returns the hash value of referenced data. |
| slice | head (size_t n) noexcept const Returns the first "n" bytes of the slice. |
| buffer< ALLOCATOR, CAPACITY_POLICY > | hex_decode (bool ignore_spaces=false, const ALLOCATOR & alloc=ALLOCATOR()) const Decodes hexadecimal dump from the slice content to returned buffer. |
| uint64_t | id () const Return the transaction's ID. |
| void | ignore_key_order () Disables the control of the order of keys when reading database pages for this cursor. |
| constexpr | info (map_handle::flags flags, map_handle::state state) noexcept |
| void | insert (map_handle map, const slice & key, slice value) |
| void | insert (const slice & key, slice value) |
| slice | insert_reserve (map_handle map, const slice & key, size_t value_length) |
| slice | insert_reserve (const slice & key, size_t value_length) |
| void | invalidate () noexcept Invalidates the slice by nullifying the data pointer while preserving the length; makes is_valid() return false unless the slice was already of zero length. |
| bool | is_base58 (bool ignore_spaces=false) noexcept const Checks whether the content of the slice is a Base58 dump. |
| bool | is_base64 (bool ignore_spaces=false) noexcept const Checks whether the content of the slice is a Base64 dump. |
| bool | is_clean () noexcept const |
| bool | is_dirty (const void * ptr) const Checks whether the given data is on a dirty page. |
| bool | is_failure () noexcept const |
| bool | is_hex (bool ignore_spaces=false) noexcept const Checks whether the content of the slice is a hexadecimal dump. |
| bool | is_mdbx_error () noexcept const Returns true for MDBX's errors. |
| bool | is_null () noexcept const Checks whether the slice data pointer is nullptr. |
| bool | is_result_false () noexcept const |
| bool | is_result_true () noexcept const |
| bool | is_success () noexcept const |
| MDBX_CXX11_CONSTEXPR_ENUM mdbx::key_mode | key_mode () noexcept const |
| operate_parameters & | lazy_weak_tail () noexcept Sets the durability level to env::durability::lazy_weak_tail . |
| size_t | length () noexcept const Returns the number of bytes. |
| operate_parameters & | lifo (bool value=true) noexcept Sets the LIFO reclaiming mode, i.e. reclaiming_options::lifo . |
| move_result | lower_bound (const slice & key, bool throw_notfound=false) |
| move_result | lower_bound_multivalue (const slice & key, const slice & value, bool throw_notfound=false) |
| void | make_broken () Marks transaction as broken to prevent further operations. |
| buffer< ALLOCATOR, CAPACITY_POLICY > | make_buffer (PRODUCER & producer, const ALLOCATOR & alloc) |
| buffer< ALLOCATOR, CAPACITY_POLICY > | make_buffer (const PRODUCER & producer, const ALLOCATOR & alloc) |
| geometry & | make_dynamic (intptr_t lower=default_value, intptr_t upper=default_value) noexcept |
| geometry & | make_fixed (intptr_t size) noexcept |
| string< ALLOCATOR > | make_string (PRODUCER & producer, const ALLOCATOR & alloc) |
| string< ALLOCATOR > | make_string (const PRODUCER & producer, const ALLOCATOR & alloc) |
| map_handle | map () const |
| unsigned | max_maps () const Returns the maximum number of named tables for the environment. |
| unsigned | max_readers () const Returns the maximum number of threads/reader slots for the environment. |
| slice | middle (size_t from, size_t n) noexcept const Returns the middle "n" bytes of the slice. |
| move_result (const cursor & cursor, bool throw_notfound) |
|
| move_result (cursor & cursor, move_operation operation, const slice & key, const slice & value, bool throw_notfound) |
|
| operate_parameters & | nested_transactions (bool value=true) noexcept Sets the nested transactions mode, i.e. operate_options::nested_transactions . |
| operate_parameters & | no_sticky_threads (bool value=true) noexcept Sets the "no sticky threads" mode, i.e. operate_options::no_sticky_threads . |
| bool | on_first () const |
| bool | on_first_multival () const |
| bool | on_last () const |
| bool | on_last_multival () const |
| cursor_managed | open_cursor (map_handle map) const Opens cursor for specified key-value map handle. |
| map_handle | open_map (const slice & name, const ::mdbx::key_mode key_mode=::mdbx::key_mode::usual, const ::mdbx::value_mode value_mode=::mdbx::value_mode::single) const Open existing key-value map. |
| map_handle | open_map (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. |
| 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. |
| map_handle | open_map_accede (const slice & name) const Open existing key-value map. |
| map_handle | open_map_accede (const char * name) const Open existing key-value map. |
| map_handle | open_map_accede (const ::std::string & name) const Open existing key-value map. |
| bool | operator!= (const error & a, const error & b) |
| bool | operator!= (const slice & a, const slice & b) |
| bool | operator!= (const pair & a, const pair & b) |
| bool | operator< (const slice & a, const slice & b) |
| bool | operator< (const pair & a, const pair & b) |
| inline ::std::ostream & | operator<< (::std::ostream & out, const buffer< ALLOCATOR, CAPACITY_POLICY > & it) |
| inline ::std::ostream & | operator<< (::std::ostream & out, const to_hex & wrapper) |
| inline ::std::ostream & | operator<< (::std::ostream & out, const to_base58 & wrapper) |
| inline ::std::ostream & | operator<< (::std::ostream & out, const to_base64 & wrapper) |
| LIBMDBX_API::std::ostream & | operator<< (::std::ostream &, const slice &) |
| LIBMDBX_API::std::ostream & | operator<< (::std::ostream &, const pair &) |
| LIBMDBX_API::std::ostream & | operator<< (::std::ostream &, const pair_result &) |
| LIBMDBX_API::std::ostream & | operator<< (::std::ostream &, const env::geometry::size &) |
| LIBMDBX_API::std::ostream & | operator<< (::std::ostream &, const env::geometry &) |
| LIBMDBX_API::std::ostream & | operator<< (::std::ostream &, const env::operate_parameters &) |
| LIBMDBX_API::std::ostream & | operator<< (::std::ostream &, const env::mode &) |
| LIBMDBX_API::std::ostream & | operator<< (::std::ostream &, const env::durability &) |
| LIBMDBX_API::std::ostream & | operator<< (::std::ostream &, const env::reclaiming_options &) |
| LIBMDBX_API::std::ostream & | operator<< (::std::ostream &, const env::operate_options &) |
| LIBMDBX_API::std::ostream & | operator<< (::std::ostream &, const env_managed::create_parameters &) |
| LIBMDBX_API::std::ostream & | operator<< (::std::ostream &, const MDBX_log_level_t &) |
| LIBMDBX_API::std::ostream & | operator<< (::std::ostream &, const MDBX_debug_flags_t &) |
| LIBMDBX_API::std::ostream & | operator<< (::std::ostream &, const error &) |
| inline ::std::ostream & | operator<< (::std::ostream & out, const MDBX_error_t & errcode) |
| bool | operator<= (const slice & a, const slice & b) |
| bool | operator<= (const pair & a, const pair & b) |
| slice & | operator= (slice && src) noexcept |
| slice & | operator= (::MDBX_val && src) |
| env & | operator= (env && other) noexcept |
| txn & | operator= (txn && other) noexcept |
| cursor & | operator= (cursor && other) noexcept |
| bool | operator== (const error & a, const error & b) |
| bool | operator== (const slice & a, const slice & b) |
| bool | operator== (const pair & a, const pair & b) |
| bool | operator> (const slice & a, const slice & b) |
| bool | operator> (const pair & a, const pair & b) |
| bool | operator>= (const slice & a, const slice & b) |
| bool | operator>= (const pair & a, const pair & b) |
| byte | operator[] (size_t n) noexcept const Returns the nth byte in the referenced data. |
| void | park_reading (bool autounpark=true) Park read-only transaction. |
| txn_managed | prepare_read () const Creates but not start read transaction. |
| 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) |
| MDBX_error_t | put (const slice & key, slice * value, MDBX_put_flags_t flags) noexcept |
| void | put (const slice & key, slice value, put_mode mode) |
| txn & | put_canary (const canary & canary) Set integers markers (aka "canary") associated with the environment. |
| size_t | put_multiple_samelength (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) |
| size_t | put_multiple_samelength (const slice & key, const size_t value_length, const void * values_array, size_t values_count, put_mode mode, bool allow_partial=false) |
| constexpr | 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 |
| operate_parameters & | readonly () noexcept Sets the operation mode to env::mode::readonly . |
| bool | refresh () Refresh the read-only transaction to the most recent snapshot. |
| size_t | release_all_cursors (bool unbind) const Unbind or close all cursors. |
| void | remove_prefix (size_t n) noexcept Drops the first "n" bytes from this slice. |
| void | remove_suffix (size_t n) noexcept Drops the last "n" bytes from this slice. |
| void | rename_map (map_handle map, const char * new_name) Переименовывает таблицу ключ-значение. |
| void | rename_map (map_handle map, const slice & new_name) Переименовывает таблицу ключ-значение. |
| void | rename_map (map_handle map, const ::std::string & new_name) Переименовывает таблицу ключ-значение. |
| void | renew (::mdbx::txn & txn) Renew/bind a cursor with a new transaction and previously used key-value map handle. |
| void | renew_reading () Renew read-only transaction. |
| 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. |
| BUFFER | replace (map_handle map, const slice & key, const slice & new_value, const ALLOCATOR & alloc=ALLOCATOR()) Replaces and returns a value of the key with new one. |
| BUFFER | replace_reserve (map_handle map, const slice & key, size_t length, slice & new_value_reservation, const ALLOCATOR & alloc=ALLOCATOR()) |
| void | reset () Resets the cursor state. |
| void | reset_reading () Reset read-only transaction. |
| void | resurrect_after_fork () Restores the environment after fork() , dropping all read-write locks and reader slots of the parent process. |
| void | rethrow_captured () const |
| size_t | rfind (const slice & needle, size_t pos=npos) noexcept const Finds the last occurrence of needle not afterpos . |
| size_t | rfind (byte c, size_t pos=npos) noexcept const Finds the last occurrence of needle not afterpos . |
| operate_parameters & | robust_synchronous () noexcept Sets the durability level to env::durability::robust_synchronous . |
| slice | safe_head (size_t n) const Returns the first "n" bytes of the slice. |
| slice | safe_middle (size_t from, size_t n) const Returns the middle "n" bytes of the slice. |
| void | safe_remove_prefix (size_t n) Drops the first "n" bytes from this slice. |
| void | safe_remove_suffix (size_t n) Drops the last "n" bytes from this slice. |
| slice | safe_tail (size_t n) const Returns the last "n" bytes of the slice. |
| bool | scroll (intptr_t distable, unsigned deepness=42, bool throw_notfound=true) |
| bool | seek (const slice & key) |
| uint64_t | sequence (map_handle map) const Reads sequence generator associated with a key-value map (aka table). |
| uint64_t | sequence (map_handle map, uint64_t increment) Reads and increment sequence generator associated with a key-value map (aka table). |
| env & | set_HandleSlowReaders (MDBX_hsr_func cb) 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. |
| env & | set_context (void * your_context) Sets the application context associated with the environment. |
| txn & | set_context (void * your_context) Sets the application context associated with the transaction. |
| cursor & | set_context (void * your_context) Sets the application context associated with the cursor. |
| operate_options & | set_disable_clear_memory (bool value=true) noexcept Sets the clear-memory disable mode. |
| operate_options & | set_disable_readahead (bool value=true) noexcept Sets the readahead disable mode. |
| operate_parameters & | set_durability (env::durability value) noexcept Sets the durability level. |
| operate_options & | set_enable_validation (bool value=true) noexcept Sets the validation enable mode. |
| slice & | set_end (const void * ptr) Sets the length by specifying the end of the slice data. |
| operate_options & | set_exclusive (bool value=true) noexcept Sets the exclusive mode. |
| env & | set_extra_option (extra_runtime_option option, uint64_t value) Sets the value of a extra runtime options for an environment. |
| create_parameters & | set_file_mode_bits (mdbx_mode_t value) noexcept Sets the file mode bits used for creation of the DB files. |
| create_parameters & | set_geometry (const env::geometry & value) noexcept Sets the database geometry for size management. |
| env & | set_geometry (const geometry & size) Set all size-related parameters of environment. |
| geometry & | set_growth_step (intptr_t step) noexcept Sets the growth step in bytes. |
| slice & | set_length (size_t bytes) Set slice length. |
| reclaiming_options & | set_lifo (bool value=true) noexcept Sets the LIFO reclaiming mode. |
| operate_parameters & | set_max_maps (unsigned value) noexcept Sets the maximum number of named tables/maps for the environment. Zero means default value. |
| operate_parameters & | set_max_readers (unsigned value) noexcept Sets the maximum number of threads/reader slots for the environment. Zero means default value. |
| operate_parameters & | set_mode (env::mode value) noexcept Sets the operation mode. |
| operate_options & | set_nested_transactions (bool value=true) noexcept Sets the nested transactions mode. |
| operate_options & | set_no_sticky_threads (bool value=true) noexcept Sets the "no sticky threads" mode. |
| operate_parameters & | set_options (const env::operate_options & value) noexcept Sets the operate options. |
| geometry & | set_pagesize (intptr_t size) noexcept Sets the database page size for new database creation. |
| operate_parameters & | set_reclaiming (const env::reclaiming_options & value) noexcept Sets the garbage reclaiming options. |
| geometry & | set_shrink_threshold (intptr_t threshold) noexcept Sets the shrink threshold in bytes. |
| geometry & | set_size_lower (intptr_t size) noexcept Sets the lower bound of database size in bytes. |
| geometry & | set_size_now (intptr_t size) noexcept Sets the size in bytes to setup the database size for now. |
| geometry & | set_size_upper (intptr_t size) noexcept Sets the upper bound of database size in bytes. |
| 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. |
| 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. |
| env & | set_sync_threshold (size_t bytes) Sets threshold to force flush the data buffers to disk, for non-sync durability modes. |
| create_parameters & | set_use_subdirectory (bool value=true) noexcept Sets whether to use a subdirectory to place the DB files. |
| size_t | size () noexcept const Returns the number of bytes. |
| constexpr | slice () noexcept Create an empty slice. |
| constexpr | slice (const void * ptr, size_t bytes) Create a slice that refers to [0,bytes-1] of memory bytes pointed by ptr. |
| constexpr | slice (const void * begin, const void * end) Create a slice that refers to [begin,end] of memory bytes. |
| constexpr | slice (const char * c_str) Create a slice that refers to c_str[0,strlen(c_str)-1]. |
| constexpr | slice (const MDBX_val & src) |
| constexpr | slice (MDBX_val && src) |
| constexpr | slice (slice && src) noexcept |
| txn_managed | start_read () const Starts read (read-only) transaction. |
| txn_managed | start_write (bool dont_wait=false) Starts write (read-write) transaction. |
| txn_managed | start_write (txn & parent) Starts write (read-write) transaction. |
| bool | starts_with (const slice & prefix) noexcept const Checks if the data starts with the given prefix. |
| void | success_or_throw () const |
| void | success_or_throw (const exception_thunk & thunk) const |
| 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. |
| 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. |
| size_t | sync_threshold () const Gets threshold used to force flush the data buffers to disk, for non-sync durability modes. |
| bool | sync_to_disk (bool force=true, bool nonblock=false) Flush the environment data buffers. |
| slice | tail (size_t n) noexcept const Returns the last "n" bytes of the slice. |
| void | thread_register () Registers the current thread as a reader for the environment, i.e. assigns a reader slot. |
| void | thread_unregister () Unregisters the current thread, i.e. releases its reader slot. |
| void | throw_on_failure () const |
| value_result | try_insert (map_handle map, const slice & key, slice value) |
| value_result | try_insert (const slice & key, slice value) |
| value_result | try_insert_reserve (map_handle map, const slice & key, size_t value_length) |
| value_result | try_insert_reserve (const slice & key, size_t value_length) |
| txn_managed | try_start_write () Tries to start write (read-write) transaction without blocking. |
| bool | try_update (map_handle map, const slice & key, const slice & value) |
| bool | try_update (const slice & key, const slice & value) |
| value_result | try_update_reserve (map_handle map, const slice & key, size_t value_length) |
| value_result | try_update_reserve (const slice & key, size_t value_length) |
| void | turn_for_recovery (unsigned target_meta) Turns the database to the specified meta-page. |
| txn (txn && other) noexcept |
|
| inline ::mdbx::txn | txn () const Returns the cursor's transaction. |
| bool | txn_lock (bool dont_wait=false) Acquires write-transaction lock. |
| void | txn_unlock () Releases write-transaction lock acquired by txn_lock() . |
| void | unbind () Unbind cursor from a transaction. |
| bool | unpark_reading (bool restart_if_ousted=true) Resume parked read-only transaction. |
| void | update (map_handle map, const slice & key, const slice & value) |
| void | update (const slice & key, const slice & value) |
| slice | update_reserve (map_handle map, const slice & key, size_t value_length) |
| slice | update_reserve (const slice & key, size_t value_length) |
| move_result | upper_bound (const slice & key, bool throw_notfound=false) |
| move_result | upper_bound_multivalue (const slice & key, const slice & value, bool throw_notfound=false) |
| void | upsert (map_handle map, const slice & key, const slice & value) |
| void | upsert (const slice & key, const slice & value) |
| slice | upsert_reserve (map_handle map, const slice & key, size_t value_length) |
| slice | upsert_reserve (const slice & key, size_t value_length) |
| MDBX_CXX11_CONSTEXPR_ENUM mdbx::value_mode | value_mode () noexcept const |
| MDBX_NODISCARD int | warmup (MDBX_warmup_flags_t flags, unsigned timeout_seconds_16dot16, const MDBX_txn * txn=nullptr) const Loads into memory the given pages of the database and their on-disk neighbours in advance. |
| operate_parameters & | whole_fragile () noexcept Sets the durability level to env::durability::whole_fragile . |
| operate_parameters & | write_file_io () noexcept Sets the operation mode to env::mode::write_file_io . |
| operate_parameters & | write_mapped_io () noexcept Sets the operation mode to env::mode::write_mapped_io . |
| ~cursor () noexcept |
|
| ~env () noexcept |
|
| ~txn () noexcept |
Public Static Functions
| Type | Name |
|---|---|
| bool | boolean_or_throw (int error_code) |
| bool | boolean_or_throw (int error_code, const exception_thunk & thunk) |
| intptr_t | compare_fast (const slice & a, const slice & b) noexcept Three-way fast non-lexicographically length-based comparison. |
| intptr_t | compare_fast (const pair & a, const pair & b) noexcept Three-way fast non-lexicographically length-based comparison. |
| intptr_t | compare_lexicographically (const slice & a, const slice & b) noexcept Three-way lexicographically comparison. |
| intptr_t | compare_lexicographically (const pair & a, const pair & b) noexcept Three-way lexicographically comparison. |
| size_t | dbsize_max (intptr_t pagesize) Returns the maximal database size in bytes for specified page size. |
| size_t | dbsize_min (intptr_t pagesize) Returns the minimal database size in bytes for specified page size. |
| ptrdiff_t | distance_between (const cursor from, const cursor to, unsigned deepness=42) |
| bool | distribute (const cursor from, const cursor to, cursor * cursors_array, intptr_t cursors_array_size, unsigned deepness=42) |
| bool | distribute (const cursor from, const cursor to, const std::vector< cursor > & cursors, unsigned deepness=42) |
| bool | distribute (const cursor from, const cursor to, const std::vector< cursor_managed > & cursors, unsigned deepness=42) |
| operate_parameters | fragile_write () noexcept Constructs parameters for a writable environment with env::durability::whole_fragile durability and_env::mode::write_mapped_io ._ |
| MDBX_NODISCARD info | get_preopen_snapinfo (const ::std::string & pathname) Provides information about a database, including meta-page and geometry, without opening it. |
| MDBX_NODISCARD info | get_preopen_snapinfo (const char * pathname) |
| MDBX_NODISCARD info | get_preopen_snapinfo (const ::mdbx::filesystem::path & pathname) |
| MDBX_NODISCARD sysraminfo | get_sysraminfo () Returns information about the system RAM. |
| size_t | key_max (intptr_t pagesize, MDBX_db_flags_t flags) Returns the maximal key size in bytes for specified page size and table flags. |
| size_t | key_max (intptr_t pagesize, key_mode mode) Returns the maximal key size in bytes for specified page size and keys mode. |
| size_t | key_max (const env & env, MDBX_db_flags_t flags) Returns the maximal key size in bytes for given environment and table flags. |
| size_t | key_max (const env & env, key_mode mode) Returns the maximal key size in bytes for given environment and keys mode. |
| size_t | key_min (MDBX_db_flags_t flags) noexcept Returns the minimal key size in bytes for specified table flags. |
| size_t | key_min (key_mode mode) noexcept Returns the minimal key size in bytes for specified keys mode. |
| operate_parameters | lazy_write () noexcept Constructs parameters for a writable environment with env::durability::lazy_weak_tail durability and_env::mode::write_mapped_io ._ |
| size_t | max_map_handles (void) Returns the maximum opened map handles, aka DBI-handles. |
| int | memcmp (const void * a, const void * b, size_t bytes) noexcept constexpr-enabled memcmp(). |
| void * | memcpy (void * dest, const void * src, size_t bytes) noexcept constexpr-enabled memcpy(). |
| MDBX_NODISCARD env::operate_options | options_from_flags (MDBX_env_flags_t flags) noexcept |
| size_t | pagesize_max () noexcept Returns the maximal database page size in bytes. |
| size_t | pagesize_min () noexcept Returns the minimal database page size in bytes. |
| size_t | 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 page size and table flags. |
| size_t | pairsize4page_max (intptr_t pagesize, value_mode mode) Returns maximal size of key-value pair to fit in a single page for specified page size and values mode. |
| size_t | pairsize4page_max (const env & env, MDBX_db_flags_t flags) Returns maximal size of key-value pair to fit in a single page for given environment and table flags. |
| size_t | pairsize4page_max (const env & env, value_mode mode) Returns maximal size of key-value pair to fit in a single page for given environment and values mode. |
| operate_parameters | read_only () noexcept Constructs parameters for a read-only environment. |
| MDBX_NODISCARD env::reclaiming_options | reclaiming_from_flags (MDBX_env_flags_t flags) noexcept |
| operate_parameters | safe_write () noexcept Constructs parameters for a writable environment with env::durability::robust_synchronous durability and_env::mode::write_mapped_io ._ |
| size_t | strlen (const char * c_str) noexcept constexpr-enabled strlen(). |
| void | success_or_throw (MDBX_error_t error_code) |
| void | success_or_throw (int error_code, const exception_thunk & thunk) |
| void | throw_exception (int error_code) |
| void | throw_on_failure (int error_code) |
| void | throw_on_nullptr (const void * ptr, MDBX_error_t error_code) |
| size_t | 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. |
| size_t | valsize4page_max (intptr_t pagesize, MDBX_db_flags_t flags) Returns maximal data size in bytes to fit in a leaf-page or single large/overflow-page for specified size and table flags. |
| size_t | valsize4page_max (intptr_t pagesize, value_mode mode) Returns maximal data size in bytes to fit in a leaf-page or single large/overflow-page for specified page size and values mode. |
| size_t | valsize4page_max (const env & env, MDBX_db_flags_t flags) Returns maximal data size in bytes to fit in a leaf-page or single large/overflow-page for given environment and table flags. |
| size_t | valsize4page_max (const env & env, value_mode mode) Returns maximal data size in bytes to fit in a leaf-page or single large/overflow-page for given environment and values mode. |
| size_t | value_max (intptr_t pagesize, MDBX_db_flags_t flags) Returns the maximal value size in bytes for specified page size and table flags. |
| size_t | value_max (intptr_t pagesize, value_mode mode) Returns the maximal value size in bytes for specified page size and values mode. |
| size_t | value_max (const env & env, MDBX_db_flags_t flags) Returns the maximal value size in bytes for given environment and table flags. |
| size_t | value_max (const env & env, value_mode mode) Returns the maximal value size in bytes for given environment and values mode. |
| size_t | value_min (MDBX_db_flags_t flags) noexcept Returns the minimal values size in bytes for specified table flags. |
| size_t | value_min (value_mode mode) noexcept Returns the minimal values size in bytes for specified values mode. |
Protected Functions
| Type | Name |
|---|---|
| constexpr | env (MDBX_env * ptr) noexcept |
| ptrdiff_t | estimate (move_operation operation, MDBX_val * key, MDBX_val * value) const |
| bool | move (move_operation operation, MDBX_val * key, MDBX_val * value, bool throw_notfound) const |
| constexpr | txn (MDBX_txn * ptr) noexcept |
Macros
| Type | Name |
|---|---|
| define | MDBX_CXX_HAS_POLYMORPHIC_ALLOCATOR 1Defined as 1 if themdbx::polymorphic_allocator is available. |
| define | MDBX_STD_FILESYSTEM_PATH ::mdbx::filesystem::pathDefined if mdbx::filesystem::path is available. |
Public Types Documentation
typedef buffer_pair
Combines pair of buffers for key and value to hold an operands for certain operations.
using mdbx::buffer_pair = buffer_pair_spec<typename BUFFER::allocator_type, typename BUFFER::reservation_policy>;
typedef build_info
libmdbx build information
using mdbx::build_info = ::MDBX_build_info;
Attention:
Some strings could be NULL in case no corresponding information was provided at build time (i.e. flags).
typedef byte
The byte-like type that don't presumes aliases for pointers as does the char .
using mdbx::byte = char8_t;
Essentially, to enable all kinds of an compiler optimization, we need just the unsigned char * restrict type in C99 terms, i.e. the non-aliasing pointer to unsigned char. However, C++ still doesn't have restrict keyword not non-aliases type attribute, but a char-pointers may be aliased.
On the other hand, while uint8_t is provided and CHAR_BIT = 8 the char8_t * actually act the same as the C99 unsigned char * restrict. So using char8_t should not be an issue, since both the CHAR_BIT = 8 and uint8_tare required.
At the same time, the approach of using char8_t has several advantages:
* the restrict attribute is defined on level of the base type and is inherited by any derived pointer type;
* some compilers treat __restrict as an attribute of an instance of a type (i.e. a variable, a specific pointer), but not a type attribute.
Nonetheless, I should think about switching to the uint8_t * __restrict__ for byte pointers.
Note:
Functions whose signature depends on the mdbx::byte type must be strictly defined as inline!
typedef default_allocator
using mdbx::default_allocator = polymorphic_allocator;
typedef default_buffer
Default buffer.
using mdbx::default_buffer = buffer<default_allocator, default_capacity_policy>;
typedef default_buffer_pair
Default pair of buffers.
using mdbx::default_buffer_pair = buffer_pair<default_buffer>;
typedef duration
Duration in 1/65536 units of second.
using mdbx::duration = ::std::chrono::duration<unsigned, ::std::ratio<1, 65536>>;
typedef filehandle
using mdbx::filehandle = ::mdbx_filehandle_t;
typedef legacy_allocator
Legacy allocator but it is recommended to use polymorphic_allocator .
using mdbx::legacy_allocator = ::std::string::allocator_type;
typedef path
using mdbx::path = ::mdbx::filesystem::path;
typedef path_char
using mdbx::path_char = path_string::value_type;
typedef path_string
using mdbx::path_string = ::mdbx::filesystem::path::string_type;
typedef polymorphic_allocator
Default polymorphic allocator for modern code.
using mdbx::polymorphic_allocator = ::std::pmr::string::allocator_type;
typedef string
Default single-byte string.
using mdbx::string = ::std::basic_string<char, ::std::char_traits<char>, ALLOCATOR>;
typedef txnid
Transaction ID and MVCC-snapshot number.
using mdbx::txnid = uint64_t;
typedef version_info
libmdbx version information,
using mdbx::version_info = ::MDBX_version_info;
See also: https://semver.org/
Public Attributes Documentation
variable buffer
class MDBX_MSVC_DECLSPEC_EMPTY_BASES mdbx::buffer;
Public Static Attributes Documentation
variable silent_chk_callbacks
const MDBX_chk_callbacks_t mdbx::silent_chk_callbacks;
Zeroed set of check callbacks for a "silent" integrity check.
Public Functions Documentation
function MDBX_EXTERN_API_TEMPLATE
MDBX_EXTERN_API_TEMPLATE (
LIBMDBX_API_TYPE,
buffer< legacy_allocator, default_capacity_policy >
)
function MDBX_EXTERN_API_TEMPLATE
MDBX_EXTERN_API_TEMPLATE (
LIBMDBX_API_TYPE,
buffer< polymorphic_allocator, default_capacity_policy >
)
function alter_flags
Alter environment flags.
inline env & alter_flags (
MDBX_env_flags_t flags,
bool on_off
)
function append
Adding a key-value pair, provided that ascending order of the keys and (optionally) values are preserved.
inline void append (
map_handle map,
const slice & key,
const slice & value,
bool multivalue_order_preserved=true
)
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:
mapA map handle to appendkeyA key to be appendvalueA value to store with the keymultivalue_order_preservedIfmultivalue_order_preserved == truethen the same rules applied for to pages of nested b+tree of multimap's values.
function as_base58_string
Returns a string with a Base58 dump of the slice content.
template<class ALLOCATOR>
inline string< ALLOCATOR > as_base58_string (
unsigned wrap_width=0,
const ALLOCATOR & alloc=ALLOCATOR()
) const
function as_base64_string
Returns a string with a Base64 dump of the slice content.
template<class ALLOCATOR>
inline string< ALLOCATOR > as_base64_string (
unsigned wrap_width=0,
const ALLOCATOR & alloc=ALLOCATOR()
) const
function as_buffer
Returns a buffer with a hexadecimal dump of a passed slice.
template<class ALLOCATOR, typename CAPACITY_POLICY>
inline buffer< ALLOCATOR, CAPACITY_POLICY > as_buffer (
const ALLOCATOR & alloc=ALLOCATOR()
) const
function as_buffer
Returns a buffer with a Base58 dump of a passed slice.
template<class ALLOCATOR, typename CAPACITY_POLICY>
inline buffer< ALLOCATOR, CAPACITY_POLICY > as_buffer (
const ALLOCATOR & alloc=ALLOCATOR()
) const
function as_buffer
Returns a buffer with a Base64 dump of a passed slice.
template<class ALLOCATOR, typename CAPACITY_POLICY>
inline buffer< ALLOCATOR, CAPACITY_POLICY > as_buffer (
const ALLOCATOR & alloc=ALLOCATOR()
) const
function as_buffer
Decodes hexadecimal dump from a passed slice to returned buffer.
template<class ALLOCATOR, typename CAPACITY_POLICY>
inline buffer< ALLOCATOR, CAPACITY_POLICY > as_buffer (
const ALLOCATOR & alloc=ALLOCATOR()
) const
function as_buffer
Decodes Base58 dump from a passed slice to returned buffer.
template<class ALLOCATOR, typename CAPACITY_POLICY>
inline buffer< ALLOCATOR, CAPACITY_POLICY > as_buffer (
const ALLOCATOR & alloc=ALLOCATOR()
) const
function as_buffer
Decodes Base64 dump from a passed slice to returned buffer.
template<class ALLOCATOR, typename CAPACITY_POLICY>
inline buffer< ALLOCATOR, CAPACITY_POLICY > as_buffer (
const ALLOCATOR & alloc=ALLOCATOR()
) const
function as_hex_string
Returns a string with a hexadecimal dump of the slice content.
template<class ALLOCATOR>
inline string< ALLOCATOR > as_hex_string (
bool uppercase=false,
unsigned wrap_width=0,
const ALLOCATOR & alloc=ALLOCATOR()
) const
function as_string
Returns a string with a hexadecimal dump of a passed slice.
template<class ALLOCATOR>
inline string< ALLOCATOR > as_string (
const ALLOCATOR & alloc=ALLOCATOR()
) const
function as_string
Returns a string with a Base58 dump of a passed slice.
template<class ALLOCATOR>
inline string< ALLOCATOR > as_string (
const ALLOCATOR & alloc=ALLOCATOR()
) const
function as_string
Returns a string with a Base64 dump of a passed slice.
template<class ALLOCATOR>
inline string< ALLOCATOR > as_string (
const ALLOCATOR & alloc=ALLOCATOR()
) const
function as_string
Decodes hexadecimal dump from a passed slice to returned string.
template<class ALLOCATOR>
inline string< ALLOCATOR > as_string (
const ALLOCATOR & alloc=ALLOCATOR()
) const
function as_string
Decodes Base58 dump from a passed slice to returned string.
template<class ALLOCATOR>
inline string< ALLOCATOR > as_string (
const ALLOCATOR & alloc=ALLOCATOR()
) const
function as_string
Decodes Base64 dump from a passed slice to returned string.
template<class ALLOCATOR>
inline string< ALLOCATOR > as_string (
const ALLOCATOR & alloc=ALLOCATOR()
) const
function assign
inline slice & assign (
const void * ptr,
size_t bytes
)
function assign
inline slice & assign (
const slice & src
) noexcept
function assign
inline slice & assign (
const ::MDBX_val & src
)
function assign
inline slice & assign (
slice && src
) noexcept
function assign
inline slice & assign (
::MDBX_val && src
)
function assign
inline slice & assign (
const void * begin,
const void * end
)
function assign
inline slice & assign (
const char * c_str
)
function assign
inline cursor & assign (
const cursor & src
)
function at
Returns the nth byte in the referenced data with bounds checking.
byte at (
size_t n
) const
Exception:
std::out_of_rangeifn >= size()
function base58_decode
Decodes Base58 dump from the slice content to returned buffer.
template<class ALLOCATOR, class CAPACITY_POLICY>
inline buffer< ALLOCATOR, CAPACITY_POLICY > base58_decode (
bool ignore_spaces=false,
const ALLOCATOR & alloc=ALLOCATOR()
) const
function base64_decode
Decodes Base64 dump from the slice content to returned buffer.
template<class ALLOCATOR, class CAPACITY_POLICY>
inline buffer< ALLOCATOR, CAPACITY_POLICY > base64_decode (
bool ignore_spaces=false,
const ALLOCATOR & alloc=ALLOCATOR()
) const
function begin
Returns an iterator to the beginning of the referenced data.
const byte * begin () noexcept const
function begin
Returns an iterator to the beginning of the referenced data.
byte * begin () noexcept
function bind
Bind/renew a cursor with a new transaction and specified key-value map handle.
inline void bind (
::mdbx::txn & txn,
::mdbx::map_handle map_handle
)
function buffer
constexpr buffer (
const struct slice & src,
bool make_reference,
const allocator_type & alloc=allocator_type()
)
function buffer
template<class ALLOCATOR, typename CAPACITY_POLICY>
inline buffer (
const txn & transaction,
const struct slice & src,
const allocator_type & alloc
)
function byte_ptr
Returns casted to pointer to byte an address of data.
const byte * byte_ptr () noexcept const
function byte_ptr
byte * byte_ptr () noexcept
function capture
inline void capture () noexcept
function char_ptr
Returns casted to pointer to char an address of data.
const char * char_ptr () noexcept const
function char_ptr
char * char_ptr () noexcept
function check_readers
Checks for stale readers in the lock table and return number of cleared slots.
inline unsigned check_readers ()
function chk
Checks the integrity of the environment (database).
inline MDBX_NODISCARD MDBX_chk_context_t & chk (
MDBX_chk_context_t & ctx,
const MDBX_chk_callbacks_t * cb=nullptr,
MDBX_chk_flags_t flags=MDBX_CHK_DEFAULTS,
MDBX_chk_severity_t verbosity=MDBX_chk_info,
unsigned timeout_seconds_16dot16=0
) const
Performs a full consistency check of the database with interactive callbacks, see mdbx_env_chk(). The caller provides an MDBX_chk_context_t context where the results of the check are generated (ctx.result), and optionally a set of callbacks (cb, all fields may be nullptr).
Note:
The API is not frozen yet and may be improved in future versions.
Parameters:
ctxA zero-initialized context of the check, where the results are generated. Pointers inctx.result(e.g.tables) remain valid until the next check or close of the environment.cbA set of callback functions, all optional.nullptrmeans no callbacks.flagsFlags/options of the check, MDBX_chk_flags_t.verbosityThe required detail level of progress and results.timeout_seconds_16dot16Duration limit of the check in 1/65536 fractions of a second, zero means no limit.
Returns:
The reference to the ctx for chaining.
Exception:
- mdbx::error on failure.
See also: mdbx_env_chk()
function clear
Makes the slice empty and referencing to nothing.
void clear () noexcept
function clear_map
Clear key-value map.
inline void clear_map (
map_handle map
)
function clear_map
inline bool clear_map (
const ::std::string & name,
bool throw_if_absent=false
)
Returns:
True if the key-value map existed and was cleared, either false if the key-value map did not exist and there is nothing to clear.
function clone
Clone read transaction.
inline txn_managed clone (
void * context=nullptr
) const
function clone
Renew given read transaction into clone.
inline void clone (
txn_managed & txn_for_renew_into_clone,
void * context=nullptr
) const
function close_map
Close a key-value map (aka table) handle. Normally unnecessary.
inline void close_map (
const map_handle & handle
)
Closing a table 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 table handle or one of its cursors any further. Do not close a handle if an existing transaction has modified its table. Doing so can cause misbehavior from database corruption to errors like MDBX_BAD_DBI (since the DB name is gone).
function code
Returns error code.
MDBX_error_t code () noexcept const
function compare_keys
Compare two keys according to a particular key-value map (aka table).
inline int compare_keys (
map_handle map,
const slice & a,
const slice & b
) noexcept const
function compare_keys
Compare keys of two pairs according to a particular key-value map (aka table).
inline int compare_keys (
map_handle map,
const pair & a,
const pair & b
) noexcept const
function compare_position
inline int compare_position (
const cursor & left,
const cursor & right,
bool ignore_nested=false
)
function compare_position_nothrow
inline int compare_position_nothrow (
const cursor & left,
const cursor & right,
bool ignore_nested=false
)
function compare_values
Compare two values according to a particular key-value map (aka table).
inline int compare_values (
map_handle map,
const slice & a,
const slice & b
) noexcept const
function compare_values
Compare values of two pairs according to a particular key-value map(aka table).
inline int compare_values (
map_handle map,
const pair & a,
const pair & b
) noexcept const
function copy
Copy an MVCC-snapshot of the database to the destination path.
inline void copy (
const char * destination,
bool compactify,
bool force_dynamic_size=false
)
Copies the consistent state as seen by this transaction, see mdbx_txn_copy2pathname().
See also: env::copy()
function copy
Copy an MVCC-snapshot of the database to the destination path.
inline void copy (
const ::std::string & destination,
bool compactify,
bool force_dynamic_size=false
)
Copies the consistent state as seen by this transaction, see mdbx_txn_copy2pathname().
See also: env::copy()
function copy
Copy an MVCC-snapshot of the database to the destination path.
inline void copy (
const ::mdbx::filesystem::path & destination,
bool compactify,
bool force_dynamic_size=false
)
Copies the consistent state as seen by this transaction, see mdbx_txn_copy2pathname().
See also: env::copy()
function copy
Copy an MVCC-snapshot of the database to the given file handle.
inline void copy (
filehandle fd,
bool compactify,
bool force_dynamic_size=false
)
See also: mdbx_txn_copy2fd()
function count_multivalue
Return count of duplicates for current key.
inline size_t count_multivalue () const
function count_multivalue
Return count of duplicates for current key, along with basic statistics of the table.
inline size_t count_multivalue (
MDBX_stat * stat
) const
See also: mdbx_cursor_count_ex()
function create_map
Create new or open existing key-value map.
inline map_handle create_map (
const slice & name,
const ::mdbx::key_mode key_mode=::mdbx::key_mode::usual,
const ::mdbx::value_mode value_mode=::mdbx::value_mode::single
)
function create_map
Create new or open existing key-value map.
inline 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
)
function create_map
Create new or open existing key-value map.
inline 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
)
function cursor
constexpr cursor (
MDBX_cursor * ptr
) noexcept
function cursor
inline cursor (
cursor && other
) noexcept
function data
Return a pointer to the beginning of the referenced data.
const void * data () noexcept const
function data
void * data () noexcept
function defrag
Performs database defragmentation.
template<typename VISITOR>
inline defrag_result defrag (
VISITOR & visitor,
size_t defrag_atleast=0,
size_t time_atleast_dot16=0,
size_t defrag_enough=0,
size_t time_limit_dot16=0,
intptr_t acceptable_backlash=-1,
intptr_t preferred_batch=0
)
Defragmentation is the transfer of data from pages located at the end of the database to free pages closer to the beginning, so the freed tail can be cut off while reducing the size of the database file, see mdbx_env_defrag(). It is almost always performed in several cycles, each of which ends with committing an internal transaction.
Note:
No transactions nor cursors must be open while defragmenting.
The visitor functor (if provided) is called time-to-time with a reference to the current defrag_result and must return defrag_control::proceed to continue, defrag_control::abort to abort immediately, or defrag_control::discontinue to stop after completing scheduled operations.
Returns:
The final defrag_result. Stopping reasons are reported via its stopping_reasons field and are not treated as errors (the same for MDBX_RESULT_TRUE and MDBX_LAGGARD_READER).
Parameters:
visitorAn optional functor with the signaturedefrag_control visitor(const defrag_result &progress).defrag_atleastThe required at least number of pages by which the database must be reduced, zero means no lower bound.time_atleast_dot16The minimum time in 1/65536 fractions of a second that should be spent to defragment more even if goals reached, zero means no lower bound.defrag_enoughThe number of pages by which it will be enough to shrink the database to finish, zero means no limit.time_limit_dot16The time limit in 1/65536 fractions of a second that could be spent to defragment, zero means no limit.acceptable_backlashStop if the next cycle will be unable to shrink the database by more pages than this value, -1 means autopilot.preferred_batchThe preferred maximum number of pages to be moved per defragmentation cycle, zero means no limit.
Exception:
- mdbx::error on failure (other than stopping reasons above).
See also: mdbx_env_defrag()
function defrag
Performs database defragmentation without a progress visitor.
inline defrag_result defrag (
size_t defrag_atleast=0,
size_t time_atleast_dot16=0,
size_t defrag_enough=0,
size_t time_limit_dot16=0,
intptr_t acceptable_backlash=-1,
intptr_t preferred_batch=0
)
The same defragmentation as in the overload accepting a visitor functor, but without progress callbacks.
Parameters:
defrag_atleastThe required at least number of pages by which the database must be reduced, zero means no lower bound.time_atleast_dot16The minimum time in 1/65536 fractions of a second that should be spent to defragment more even if goals reached, zero means no lower bound.defrag_enoughThe number of pages by which it will be enough to shrink the database to finish, zero means no limit.time_limit_dot16The time limit in 1/65536 fractions of a second that could be spent to defragment, zero means no limit.acceptable_backlashStop if the next cycle will be unable to shrink the database by more pages than this value, -1 means autopilot.preferred_batchThe preferred maximum number of pages to be moved per defragmentation cycle, zero means no limit.
Exception:
- mdbx::error on failure (other than stopping reasons above).
See also: mdbx_env_defrag()
function disable_clear_memory
Sets the clear-memory disable mode, i.e. operate_options::disable_clear_memory .
operate_parameters & disable_clear_memory (
bool value=true
) noexcept
function disable_readahead
Sets the readahead disable mode, i.e. operate_options::disable_readahead .
operate_parameters & disable_readahead (
bool value=true
) noexcept
function drop_map
Drops key-value map using handle.
inline void drop_map (
map_handle map
)
function drop_map
Drop key-value map.
inline bool drop_map (
const ::std::string & name,
bool throw_if_absent=false
)
Returns:
True if the key-value map existed and was deleted, either false if the key-value map did not exist and there is nothing to delete.
function empty
Checks whether the slice is empty.
bool empty () noexcept const
function enable_validation
Sets the validation enable mode, i.e. operate_options::enable_validation .
operate_parameters & enable_validation (
bool value=true
) noexcept
function encode_base58
Returns a buffer with a Base58 dump of the slice content.
template<class ALLOCATOR, class CAPACITY_POLICY>
inline buffer< ALLOCATOR, CAPACITY_POLICY > encode_base58 (
unsigned wrap_width=0,
const ALLOCATOR & alloc=ALLOCATOR()
) const
function encode_base64
Returns a buffer with a Base64 dump of the slice content.
template<class ALLOCATOR, class CAPACITY_POLICY>
inline buffer< ALLOCATOR, CAPACITY_POLICY > encode_base64 (
unsigned wrap_width=0,
const ALLOCATOR & alloc=ALLOCATOR()
) const
function encode_hex
Returns a buffer with a hexadecimal dump of the slice content.
template<class ALLOCATOR, class CAPACITY_POLICY>
inline buffer< ALLOCATOR, CAPACITY_POLICY > encode_hex (
bool uppercase=false,
unsigned wrap_width=0,
const ALLOCATOR & alloc=ALLOCATOR()
) const
function end
Return a pointer to the end of the referenced data.
const byte * end () noexcept const
An iterator-style pointer (one past the last byte).
function end
Return a pointer to the end of the referenced data.
byte * end () noexcept
An iterator-style pointer (one past the last byte).
function end_byte_ptr
Returns casted to pointer to byte an end of data.
const byte * end_byte_ptr () noexcept const
function end_byte_ptr
byte * end_byte_ptr () noexcept
function end_char_ptr
Returns casted to pointer to char an end of data.
const char * end_char_ptr () noexcept const
function end_char_ptr
char * end_char_ptr () noexcept
function ends_with
Checks if the data ends with the given suffix.
bool ends_with (
const slice & suffix
) noexcept const
function enumerate_readers
Enumerate readers.
template<typename VISITOR>
inline int enumerate_readers (
VISITOR & visitor
)
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.
function enumerate_tables
Enumerates user's named tables in a database.
template<typename VISITOR>
inline int enumerate_tables (
VISITOR & visitor
) const
Calls the visitor functor for each user-created named table until the named tables are exhausted, or until the visitor returns exit_loop (which will be returned as a result).
Parameters:
visitorA functor with the signatureint visitor(const slice &name, MDBX_db_flags_t flags , const MDBX_stat &stat, MDBX_dbi dbi), which will be called for each table.
Returns:
The last value returned by the visitor's functor.
See also: mdbx_enumerate_tables()
function env
inline env (
env && other
) noexcept
function env
Returns the transaction's environment.
inline inline ::mdbx::env env () noexcept const
function eof
inline bool eof () const
function erase
Removes all values for given key.
inline bool erase (
map_handle map,
const slice & key
)
function erase
Removes the particular multi-value entry of the key.
inline bool erase (
map_handle map,
const slice & key,
const slice & value
)
function erase
Removes single key-value pair or all multi-values at the current cursor position.
inline bool erase (
bool whole_multivalue=false
)
function erase
Seeks and removes first value or whole multi-value of the given key.
inline bool erase (
const slice & key,
bool whole_multivalue=true
)
Returns:
True if the key is found and a value(s) is removed.
function erase
Seeks and removes the particular multi-value entry of the key.
inline bool erase (
const slice & key,
const slice & value
)
Returns:
True if the given key-value pair is found and removed.
function erase_bunch
Quickly removes bunches of neighboring items much faster by cutting out entire pages and branches from the B+ tree structure.
inline size_t erase_bunch (
bunch_delete action
)
Returns:
The number of removed items.
See also: erase_range()
See also: mdbx_cursor_bunch_delete()
function erase_range
Quickly removes a range of items between the current cursor position and the position of end much faster by cutting out entire pages and branches from the B+ tree structure.
inline size_t erase_range (
const cursor & end,
bool end_including
)
Parameters:
endA positioned cursor defining the end of the range.end_includingWhether theendposition itself should be included in the range to be deleted.
Returns:
The number of removed items.
See also: erase_bunch()
See also: mdbx_cursor_delete_range()
function error
constexpr error (
MDBX_error_t error_code
) noexcept
function estimate
inline ptrdiff_t estimate (
const cursor & from,
const cursor & to
)
function estimate
inline ptrdiff_t estimate (
map_handle map,
const pair & from,
const pair & to
) const
function estimate
inline ptrdiff_t estimate (
map_handle map,
const slice & from,
const slice & to
) const
function estimate
inline estimate_result estimate (
const slice & key,
const slice & value
) const
function estimate
inline estimate_result estimate (
const slice & key
) const
function estimate
inline estimate_result estimate (
move_operation operation
) const
function estimate
inline estimate_result estimate (
move_operation operation,
const slice & key
) const
function estimate_from_first
inline ptrdiff_t estimate_from_first (
map_handle map,
const slice & to
) const
function estimate_result
inline estimate_result (
const cursor & cursor,
move_operation operation,
const slice & key,
const slice & value
)
function estimate_to_last
inline ptrdiff_t estimate_to_last (
map_handle map,
const slice & from
) const
function exclusive
Sets the exclusive mode, i.e. operate_options::exclusive .
operate_parameters & exclusive (
bool value=true
) noexcept
function extra_option
Gets the value of extra runtime options from an environment.
inline uint64_t extra_option (
extra_runtime_option option
) const
function extract
Removes and return a value of the key.
template<class BUFFER, class ALLOCATOR>
inline BUFFER extract (
map_handle map,
const slice & key,
const ALLOCATOR & alloc=ALLOCATOR()
)
function find
Finds the first occurrence of needle starting atpos .
size_t find (
const slice & needle,
size_t pos=0
) noexcept const
Returns:
The position of the first match or npos.
function find
Finds the first occurrence of needle starting atpos .
size_t find (
byte c,
size_t pos=0
) noexcept const
Returns:
The position of the first match or npos.
function find
inline move_result find (
const slice & key,
bool throw_notfound=true
)
function find_first_not_of
Finds the first byte not matching any byte of chars starting atpos .
size_t find_first_not_of (
const slice & chars,
size_t pos=0
) noexcept const
Returns:
The position of the first match or npos.
function find_first_not_of
Finds the first byte not matching any byte of chars starting atpos .
size_t find_first_not_of (
byte c,
size_t pos=0
) noexcept const
Returns:
The position of the first match or npos.
function find_first_of
Finds the first byte matching any byte of chars starting atpos .
size_t find_first_of (
const slice & chars,
size_t pos=0
) noexcept const
Returns:
The position of the first match or npos.
function find_first_of
Finds the first byte matching any byte of chars starting atpos .
size_t find_first_of (
byte c,
size_t pos=0
) noexcept const
Returns:
The position of the first match or npos.
function find_last_not_of
Finds the last byte not matching any byte of chars not afterpos .
size_t find_last_not_of (
const slice & chars,
size_t pos=npos
) noexcept const
Returns:
The position of the last match or npos.
function find_last_not_of
Finds the last byte not matching any byte of chars not afterpos .
size_t find_last_not_of (
byte c,
size_t pos=npos
) noexcept const
Returns:
The position of the last match or npos.
function find_last_of
Finds the last byte matching any byte of chars not afterpos .
size_t find_last_of (
const slice & chars,
size_t pos=npos
) noexcept const
Returns:
The position of the last match or npos.
function find_last_of
Finds the last byte matching any byte of chars not afterpos .
size_t find_last_of (
byte c,
size_t pos=npos
) noexcept const
Returns:
The position of the last match or npos.
function find_multivalue
inline move_result find_multivalue (
const slice & key,
const slice & value,
bool throw_notfound=true
)
function flags
Returns transaction's flags.
inline MDBX_txn_flags_t flags () const
function get
Get value by key from a key-value map (aka table).
inline slice get (
map_handle map,
const slice & key
) const
function get
Get first of multi-value and values count by key from a key-value multimap (aka table).
inline slice get (
map_handle map,
slice key,
size_t & values_count
) const
function get
Get value by key from a key-value map (aka table).
inline slice get (
map_handle map,
const slice & key,
const slice & value_at_absence
) const
function get
Get first of multi-value and values count by key from a key-value multimap (aka table).
inline slice get (
map_handle map,
slice key,
size_t & values_count,
const slice & value_at_absence
) const
function get_HandleSlowReaders
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.
inline MDBX_hsr_func get_HandleSlowReaders () noexcept const
See also: set_HandleSlowReaders()
function get_batch
Reads a batch of key-value pairs.
inline inline ::std::vector< pair > get_batch (
size_t max_pairs,
move_operation op,
bool * is_last=nullptr
) const
Fetches up to max_pairs key-value pairs starting from the current cursor position, advancing the cursor. The returned slices reference database-owned memory and remain valid while the transaction and cursor are alive.
Parameters:
max_pairsThe maximum number of key-value pairs to fetch.opThe positioning operation, either move_operation::first or move_operation::next.is_lastOptional flag set totruewhen the returned chunk is the last one (no pairs left after it).
Returns:
The vector of fetched key-value pairs.
See also: mdbx_cursor_get_batch()
function get_build
Returns libmdbx build information.
const build_info & get_build () noexcept
function get_cached
Gets a value by key using the transparent read-your-writes cache.
inline MDBX_NODISCARD cache_result get_cached (
map_handle map,
const slice & key,
slice * data,
cache_entry & entry
) const
Uses the cached information to check as quickly as possible whether the data has changed or not, with early exit when searching through the DB. Supports multithreaded cases and resolves collisions in a lockfree way; the MDBX_NOSTICKYTHREADS mode is required to use it from different threads.
Parameters:
mapThe table handle.keyThe key to search for.dataThe resulting value; points into database-owned memory and remains valid until the transaction end.entryThe cache entry corresponding to the key, must be initialized (cache_entry::reset()) before use.
Returns:
The cache_result with the pair of error code and cache status. The caller inspects errcode and status explicitly.
See also: mdbx_cache_get()
function get_cached
Gets a value by key using the transparent read-your-writes cache, throwing exceptions on errors.
inline MDBX_NODISCARD slice get_cached (
map_handle map,
const slice & key,
cache_entry & entry,
cache_status * status=nullptr
) const
Parameters:
mapThe table handle.keyThe key to search for.entryThe cache entry corresponding to the key.statusOptional address to receive the cache_status.
Returns:
The resulting value, or throws mdbx::not_found if the key is absent (like get()).
See also: mdbx_cache_get()
function get_canary
Returns the four integer markers (aka "canary") associated with the environment.
inline canary get_canary () const
function get_context
Returns the application context associated with the environment.
inline void * get_context () noexcept const
function get_context
Returns the application context associated with the transaction.
inline void * get_context () noexcept const
function get_context
Returns the application context associated with the cursor.
inline void * get_context () noexcept const
function get_durability
Returns current durability mode.
inline MDBX_NODISCARD env::durability get_durability () const
function get_equal_or_great
Gets the value for an equal or greater key from a table.
inline pair_result get_equal_or_great (
map_handle map,
const slice & key
) const
Returns:
Bundle of key-value pair and boolean flag, which will be true if the exact key was found and false otherwise.
function get_equal_or_great
Gets the value for an equal or greater key from a table.
inline pair_result get_equal_or_great (
map_handle map,
const slice & key,
const slice & value_at_absence
) const
Returns:
Bundle of key-value pair and boolean flag, which will be true if the exact key was found and false otherwise.
function get_filehandle
Returns the file descriptor for the DXB file of MDBX environment.
inline filehandle get_filehandle () const
function get_flags
Returns environment flags.
inline MDBX_env_flags_t get_flags () const
function get_gc_info
Provides information of Garbage Collection and page usage.
template<typename VISITOR>
inline gc_info get_gc_info (
VISITOR & visitor
) const
Scans the whole GC to summarise the GC state and page usage for the given transaction, optionally iterating GC entries by calling the visitor functor for each span of pages inside GC (excepting the pages forming the B-tree structure of GC itself).
Parameters:
visitorAn optional functor with the signatureint visitor(uint64_t span_txnid, size_t span_pgno, size_t span_length, bool span_is_reclaimable)returning continue_loop to proceed or any other value to stop enumeration.
Returns:
The gc_info of the database. An empty (zeroed) info is returned when the GC is empty (MDBX_NOTFOUND).
Note:
This API has not been frozen yet.
See also: mdbx_gc_info()
function get_gc_info
inline gc_info get_gc_info () const
function get_info
Return snapshot information about the MDBX environment.
inline info get_info () const
function get_info
Return information about the MDBX environment accordingly to the specified transaction.
inline info get_info (
const txn & txn
) const
function get_info
Returns information about the MDBX transaction.
inline info get_info (
bool scan_reader_lock_table=false
) const
function get_map_flags
Returns information about key-value map (aka table) handle.
inline map_handle::info get_map_flags (
map_handle map
) const
function get_map_stat
Returns statistics for a table.
inline map_stat get_map_stat (
map_handle map
) const
function get_mode
Returns current operation mode.
inline MDBX_NODISCARD env::mode get_mode () const
function get_operation_parameters
Returns current operation parameters.
inline MDBX_NODISCARD env::operate_parameters get_operation_parameters () const
function get_options
Returns current operate options.
inline MDBX_NODISCARD env::operate_options get_options () const
function get_reclaiming
Returns current reclaiming options.
inline MDBX_NODISCARD env::reclaiming_options get_reclaiming () const
function get_stat
Returns snapshot statistics about the MDBX environment.
inline stat get_stat () const
function get_stat
Return statistics about the MDBX environment accordingly to the specified transaction.
inline stat get_stat (
const txn & txn
) const
function get_tree_deepmask
Returns depth (bitmask) information of nested dupsort (multi-value) B+trees for given table.
inline uint32_t get_tree_deepmask (
map_handle map
) const
function get_version
Returns libmdbx version information.
const version_info & get_version () noexcept
function half_synchronous_weak_last
Sets the durability level to env::durability::half_synchronous_weak_last .
operate_parameters & half_synchronous_weak_last () noexcept
function hash_value
Returns the hash value of referenced data.
size_t hash_value () noexcept const
Attention:
Function implementation and returned hash values may change from version to version, and in future the t1ha3 will be used here. Therefore values obtained from this function shouldn't be persisted anywhere.
function head
Returns the first "n" bytes of the slice.
slice head (
size_t n
) noexcept const
Precondition:
REQUIRES: n <= size()
function hex_decode
Decodes hexadecimal dump from the slice content to returned buffer.
template<class ALLOCATOR, class CAPACITY_POLICY>
inline buffer< ALLOCATOR, CAPACITY_POLICY > hex_decode (
bool ignore_spaces=false,
const ALLOCATOR & alloc=ALLOCATOR()
) const
function id
Return the transaction's ID.
inline uint64_t id () const
function ignore_key_order
Disables the control of the order of keys when reading database pages for this cursor.
inline void ignore_key_order ()
Useful when reading a database whose user-defined comparison functions are unavailable, otherwise such reads return MDBX_CORRUPTED.
See also: mdbx_cursor_ignord()
function info
constexpr info (
map_handle::flags flags,
map_handle::state state
) noexcept
function insert
inline void insert (
map_handle map,
const slice & key,
slice value
)
function insert
inline void insert (
const slice & key,
slice value
)
function insert_reserve
inline slice insert_reserve (
map_handle map,
const slice & key,
size_t value_length
)
function insert_reserve
inline slice insert_reserve (
const slice & key,
size_t value_length
)
function invalidate
Invalidates the slice by nullifying the data pointer while preserving the length; makes is_valid() returnfalse unless the slice was already of zero length.
void invalidate () noexcept
function is_base58
Checks whether the content of the slice is a Base58 dump.
inline bool is_base58 (
bool ignore_spaces=false
) noexcept const
Parameters:
ignore_spacesIftruefunction will skips spaces surrounding (before, between and after) a encoded bytes. However, spaces should not break a code group of characters.
function is_base64
Checks whether the content of the slice is a Base64 dump.
inline bool is_base64 (
bool ignore_spaces=false
) noexcept const
Parameters:
ignore_spacesIftruefunction will skips spaces surrounding (before, between and after) a encoded bytes. However, spaces should not break a code group of characters.
function is_clean
inline bool is_clean () noexcept const
function is_dirty
Checks whether the given data is on a dirty page.
inline bool is_dirty (
const void * ptr
) const
function is_failure
bool is_failure () noexcept const
function is_hex
Checks whether the content of the slice is a hexadecimal dump.
inline bool is_hex (
bool ignore_spaces=false
) noexcept const
Parameters:
ignore_spacesIftruefunction will skips spaces surrounding (before, between and after) a encoded bytes. However, spaces should not break a pair of characters encoding a single byte.
function is_mdbx_error
Returns true for MDBX's errors.
bool is_mdbx_error () noexcept const
function is_null
Checks whether the slice data pointer is nullptr.
bool is_null () noexcept const
function is_result_false
bool is_result_false () noexcept const
function is_result_true
bool is_result_true () noexcept const
function is_success
bool is_success () noexcept const
function key_mode
MDBX_CXX11_CONSTEXPR_ENUM mdbx::key_mode key_mode () noexcept const
function lazy_weak_tail
Sets the durability level to env::durability::lazy_weak_tail .
operate_parameters & lazy_weak_tail () noexcept
function length
Returns the number of bytes.
size_t length () noexcept const
function lifo
Sets the LIFO reclaiming mode, i.e. reclaiming_options::lifo .
operate_parameters & lifo (
bool value=true
) noexcept
function lower_bound
inline move_result lower_bound (
const slice & key,
bool throw_notfound=false
)
function lower_bound_multivalue
inline move_result lower_bound_multivalue (
const slice & key,
const slice & value,
bool throw_notfound=false
)
function make_broken
Marks transaction as broken to prevent further operations.
inline void make_broken ()
function make_buffer
template<class ALLOCATOR, class CAPACITY_POLICY, MutableByteProducer PRODUCER>
inline buffer< ALLOCATOR, CAPACITY_POLICY > make_buffer (
PRODUCER & producer,
const ALLOCATOR & alloc
)
function make_buffer
template<class ALLOCATOR, class CAPACITY_POLICY, ImmutableByteProducer PRODUCER>
inline buffer< ALLOCATOR, CAPACITY_POLICY > make_buffer (
const PRODUCER & producer,
const ALLOCATOR & alloc
)
function make_dynamic
geometry & make_dynamic (
intptr_t lower=default_value,
intptr_t upper=default_value
) noexcept
function make_fixed
geometry & make_fixed (
intptr_t size
) noexcept
function make_string
template<class ALLOCATOR, MutableByteProducer PRODUCER>
inline string< ALLOCATOR > make_string (
PRODUCER & producer,
const ALLOCATOR & alloc
)
function make_string
template<class ALLOCATOR, ImmutableByteProducer PRODUCER>
inline string< ALLOCATOR > make_string (
const PRODUCER & producer,
const ALLOCATOR & alloc
)
function map
inline map_handle map () const
function max_maps
Returns the maximum number of named tables for the environment.
inline unsigned max_maps () const
See also: extra_runtime_option::max_maps
function max_readers
Returns the maximum number of threads/reader slots for the environment.
inline unsigned max_readers () const
See also: extra_runtime_option::max_readers
function middle
Returns the middle "n" bytes of the slice.
slice middle (
size_t from,
size_t n
) noexcept const
Precondition:
REQUIRES: from + n <= size()
function move_result
inline move_result (
const cursor & cursor,
bool throw_notfound
)
function move_result
inline move_result (
cursor & cursor,
move_operation operation,
const slice & key,
const slice & value,
bool throw_notfound
)
function nested_transactions
Sets the nested transactions mode, i.e. operate_options::nested_transactions .
operate_parameters & nested_transactions (
bool value=true
) noexcept
function no_sticky_threads
Sets the "no sticky threads" mode, i.e. operate_options::no_sticky_threads .
operate_parameters & no_sticky_threads (
bool value=true
) noexcept
function on_first
inline bool on_first () const
function on_first_multival
inline bool on_first_multival () const
function on_last
inline bool on_last () const
function on_last_multival
inline bool on_last_multival () const
function open_cursor
Opens cursor for specified key-value map handle.
inline cursor_managed open_cursor (
map_handle map
) const
function open_map
Open existing key-value map.
inline map_handle open_map (
const slice & name,
const ::mdbx::key_mode key_mode=::mdbx::key_mode::usual,
const ::mdbx::value_mode value_mode=::mdbx::value_mode::single
) const
function open_map
Open existing key-value map.
inline 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
function open_map
Open existing key-value map.
inline 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
function open_map_accede
Open existing key-value map.
inline map_handle open_map_accede (
const slice & name
) const
function open_map_accede
Open existing key-value map.
inline map_handle open_map_accede (
const char * name
) const
function open_map_accede
Open existing key-value map.
inline map_handle open_map_accede (
const ::std::string & name
) const
function operator!=
bool operator!= (
const error & a,
const error & b
)
function operator!=
bool operator!= (
const slice & a,
const slice & b
)
function operator!=
bool operator!= (
const pair & a,
const pair & b
)
function operator<
bool operator< (
const slice & a,
const slice & b
)
function operator<
bool operator< (
const pair & a,
const pair & b
)
function operator<<
template<class ALLOCATOR, typename CAPACITY_POLICY>
inline ::std::ostream & operator<< (
::std::ostream & out,
const buffer< ALLOCATOR, CAPACITY_POLICY > & it
)
function operator<<
inline ::std::ostream & operator<< (
::std::ostream & out,
const to_hex & wrapper
)
function operator<<
inline ::std::ostream & operator<< (
::std::ostream & out,
const to_base58 & wrapper
)
function operator<<
inline ::std::ostream & operator<< (
::std::ostream & out,
const to_base64 & wrapper
)
function operator<<
LIBMDBX_API::std::ostream & operator<< (
::std::ostream &,
const slice &
)
function operator<<
LIBMDBX_API::std::ostream & operator<< (
::std::ostream &,
const pair &
)
function operator<<
LIBMDBX_API::std::ostream & operator<< (
::std::ostream &,
const pair_result &
)
function operator<<
LIBMDBX_API::std::ostream & operator<< (
::std::ostream &,
const env::geometry::size &
)
function operator<<
LIBMDBX_API::std::ostream & operator<< (
::std::ostream &,
const env::geometry &
)
function operator<<
LIBMDBX_API::std::ostream & operator<< (
::std::ostream &,
const env::operate_parameters &
)
function operator<<
LIBMDBX_API::std::ostream & operator<< (
::std::ostream &,
const env::mode &
)
function operator<<
LIBMDBX_API::std::ostream & operator<< (
::std::ostream &,
const env::durability &
)
function operator<<
LIBMDBX_API::std::ostream & operator<< (
::std::ostream &,
const env::reclaiming_options &
)
function operator<<
LIBMDBX_API::std::ostream & operator<< (
::std::ostream &,
const env::operate_options &
)
function operator<<
LIBMDBX_API::std::ostream & operator<< (
::std::ostream &,
const env_managed::create_parameters &
)
function operator<<
LIBMDBX_API::std::ostream & operator<< (
::std::ostream &,
const MDBX_log_level_t &
)
function operator<<
LIBMDBX_API::std::ostream & operator<< (
::std::ostream &,
const MDBX_debug_flags_t &
)
function operator<<
LIBMDBX_API::std::ostream & operator<< (
::std::ostream &,
const error &
)
function operator<<
inline ::std::ostream & operator<< (
::std::ostream & out,
const MDBX_error_t & errcode
)
function operator<=
bool operator<= (
const slice & a,
const slice & b
)
function operator<=
bool operator<= (
const pair & a,
const pair & b
)
function operator=
inline slice & operator= (
slice && src
) noexcept
function operator=
inline slice & operator= (
::MDBX_val && src
)
function operator=
inline env & operator= (
env && other
) noexcept
function operator=
inline txn & operator= (
txn && other
) noexcept
function operator=
inline cursor & operator= (
cursor && other
) noexcept
function operator==
bool operator== (
const error & a,
const error & b
)
function operator==
bool operator== (
const slice & a,
const slice & b
)
function operator==
bool operator== (
const pair & a,
const pair & b
)
function operator>
bool operator> (
const slice & a,
const slice & b
)
function operator>
bool operator> (
const pair & a,
const pair & b
)
function operator>=
bool operator>= (
const slice & a,
const slice & b
)
function operator>=
bool operator>= (
const pair & a,
const pair & b
)
function operator[]
Returns the nth byte in the referenced data.
byte operator[] (
size_t n
) noexcept const
Precondition:
REQUIRES: n < size()
function park_reading
Park read-only transaction.
inline void park_reading (
bool autounpark=true
)
function prepare_read
Creates but not start read transaction.
inline txn_managed prepare_read () const
function put
inline MDBX_error_t put (
map_handle map,
const slice & key,
slice * value,
MDBX_put_flags_t flags
) noexcept
function put
inline void put (
map_handle map,
const slice & key,
slice value,
put_mode mode
)
function put
inline MDBX_error_t put (
const slice & key,
slice * value,
MDBX_put_flags_t flags
) noexcept
function put
inline void put (
const slice & key,
slice value,
put_mode mode
)
function put_canary
Set integers markers (aka "canary") associated with the environment.
inline txn & put_canary (
const canary & canary
)
function put_multiple_samelength
inline size_t put_multiple_samelength (
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
)
function put_multiple_samelength
inline size_t put_multiple_samelength (
const slice & key,
const size_t value_length,
const void * values_array,
size_t values_count,
put_mode mode,
bool allow_partial=false
)
function reader_info
constexpr 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
function readonly
Sets the operation mode to env::mode::readonly .
operate_parameters & readonly () noexcept
function refresh
Refresh the read-only transaction to the most recent snapshot.
inline bool refresh ()
Replaces the MVCC-snapshot of the given read-only transaction with the most recent committed one, see mdbx_txn_refresh().
Returns:
True if the transaction was already reading the most recent version and no actions were performed, or false if it was refreshed (i.e. advanced to a newer snapshot).
See also: reset_reading()
See also: renew_reading()
function release_all_cursors
Unbind or close all cursors.
inline size_t release_all_cursors (
bool unbind
) const
function remove_prefix
Drops the first "n" bytes from this slice.
inline void remove_prefix (
size_t n
) noexcept
Precondition:
REQUIRES: n <= size()
function remove_suffix
Drops the last "n" bytes from this slice.
inline void remove_suffix (
size_t n
) noexcept
Precondition:
REQUIRES: n <= size()
function rename_map
Переименовывает таблицу ключ-значение.
inline void rename_map (
map_handle map,
const char * new_name
)
function rename_map
Переименовывает таблицу ключ-значение.
inline void rename_map (
map_handle map,
const slice & new_name
)
function rename_map
Переименовывает таблицу ключ-значение.
inline void rename_map (
map_handle map,
const ::std::string & new_name
)
function renew
Renew/bind a cursor with a new transaction and previously used key-value map handle.
inline void renew (
::mdbx::txn & txn
)
function renew_reading
Renew read-only transaction.
inline void renew_reading ()
function replace
Replaces the particular multi-value of the key with a new value.
inline void replace (
map_handle map,
const slice & key,
slice & old_value,
const slice & new_value
)
function replace
Replaces and returns a value of the key with new one.
template<class BUFFER, class ALLOCATOR>
inline BUFFER replace (
map_handle map,
const slice & key,
const slice & new_value,
const ALLOCATOR & alloc=ALLOCATOR()
)
function replace_reserve
template<class BUFFER, class ALLOCATOR>
inline BUFFER replace_reserve (
map_handle map,
const slice & key,
size_t length,
slice & new_value_reservation,
const ALLOCATOR & alloc=ALLOCATOR()
)
function reset
Resets the cursor state.
inline void reset ()
As a result of the reset, the cursor becomes unpositioned and does not allow relative positioning operations, getting or changing data until the cursor is set to a position independent of the current one.
See also: mdbx_cursor_reset()
function reset_reading
Reset read-only transaction.
inline void reset_reading ()
function resurrect_after_fork
Restores the environment after fork() , dropping all read-write locks and reader slots of the parent process.
inline void resurrect_after_fork ()
function rethrow_captured
inline void rethrow_captured () const
function rfind
Finds the last occurrence of needle not afterpos .
size_t rfind (
const slice & needle,
size_t pos=npos
) noexcept const
Returns:
The position of the last match or npos.
function rfind
Finds the last occurrence of needle not afterpos .
size_t rfind (
byte c,
size_t pos=npos
) noexcept const
Returns:
The position of the last match or npos.
function robust_synchronous
Sets the durability level to env::durability::robust_synchronous .
operate_parameters & robust_synchronous () noexcept
function safe_head
Returns the first "n" bytes of the slice.
slice safe_head (
size_t n
) const
Exception:
std::out_of_rangeifn > size()
function safe_middle
Returns the middle "n" bytes of the slice.
slice safe_middle (
size_t from,
size_t n
) const
Exception:
std::out_of_rangeiffrom + n > size()
function safe_remove_prefix
Drops the first "n" bytes from this slice.
inline void safe_remove_prefix (
size_t n
)
Exception:
std::out_of_rangeifn > size()
function safe_remove_suffix
Drops the last "n" bytes from this slice.
inline void safe_remove_suffix (
size_t n
)
Exception:
std::out_of_rangeifn > size()
function safe_tail
Returns the last "n" bytes of the slice.
slice safe_tail (
size_t n
) const
Exception:
std::out_of_rangeifn > size()
function scroll
inline bool scroll (
intptr_t distable,
unsigned deepness=42,
bool throw_notfound=true
)
function seek
inline bool seek (
const slice & key
)
function sequence
Reads sequence generator associated with a key-value map (aka table).
inline uint64_t sequence (
map_handle map
) const
function sequence
Reads and increment sequence generator associated with a key-value map (aka table).
inline uint64_t sequence (
map_handle map,
uint64_t increment
)
function set_HandleSlowReaders
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.
inline env & set_HandleSlowReaders (
MDBX_hsr_func cb
)
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
function set_context
Sets the application context associated with the environment.
inline env & set_context (
void * your_context
)
function set_context
Sets the application context associated with the transaction.
inline txn & set_context (
void * your_context
)
function set_context
Sets the application context associated with the cursor.
inline cursor & set_context (
void * your_context
)
function set_disable_clear_memory
Sets the clear-memory disable mode.
operate_options & set_disable_clear_memory (
bool value=true
) noexcept
function set_disable_readahead
Sets the readahead disable mode.
operate_options & set_disable_readahead (
bool value=true
) noexcept
function set_durability
Sets the durability level.
operate_parameters & set_durability (
env::durability value
) noexcept
function set_enable_validation
Sets the validation enable mode.
operate_options & set_enable_validation (
bool value=true
) noexcept
function set_end
Sets the length by specifying the end of the slice data.
slice & set_end (
const void * ptr
)
function set_exclusive
Sets the exclusive mode.
operate_options & set_exclusive (
bool value=true
) noexcept
function set_extra_option
Sets the value of a extra runtime options for an environment.
inline env & set_extra_option (
extra_runtime_option option,
uint64_t value
)
function set_file_mode_bits
Sets the file mode bits used for creation of the DB files.
create_parameters & set_file_mode_bits (
mdbx_mode_t value
) noexcept
function set_geometry
Sets the database geometry for size management.
create_parameters & set_geometry (
const env::geometry & value
) noexcept
function set_geometry
Set all size-related parameters of environment.
inline env & set_geometry (
const geometry & size
)
function set_growth_step
Sets the growth step in bytes.
geometry & set_growth_step (
intptr_t step
) noexcept
function set_length
Set slice length.
slice & set_length (
size_t bytes
)
function set_lifo
Sets the LIFO reclaiming mode.
reclaiming_options & set_lifo (
bool value=true
) noexcept
function set_max_maps
Sets the maximum number of named tables/maps for the environment. Zero means default value.
operate_parameters & set_max_maps (
unsigned value
) noexcept
function set_max_readers
Sets the maximum number of threads/reader slots for the environment. Zero means default value.
operate_parameters & set_max_readers (
unsigned value
) noexcept
function set_mode
Sets the operation mode.
operate_parameters & set_mode (
env::mode value
) noexcept
function set_nested_transactions
Sets the nested transactions mode.
operate_options & set_nested_transactions (
bool value=true
) noexcept
function set_no_sticky_threads
Sets the "no sticky threads" mode.
operate_options & set_no_sticky_threads (
bool value=true
) noexcept
function set_options
Sets the operate options.
operate_parameters & set_options (
const env::operate_options & value
) noexcept
function set_pagesize
Sets the database page size for new database creation.
geometry & set_pagesize (
intptr_t size
) noexcept
function set_reclaiming
Sets the garbage reclaiming options.
operate_parameters & set_reclaiming (
const env::reclaiming_options & value
) noexcept
function set_shrink_threshold
Sets the shrink threshold in bytes.
geometry & set_shrink_threshold (
intptr_t threshold
) noexcept
function set_size_lower
Sets the lower bound of database size in bytes.
geometry & set_size_lower (
intptr_t size
) noexcept
function set_size_now
Sets the size in bytes to setup the database size for now.
geometry & set_size_now (
intptr_t size
) noexcept
function set_size_upper
Sets the upper bound of database size in bytes.
geometry & set_size_upper (
intptr_t size
) noexcept
function set_sync_period__seconds_16dot16
Sets relative period since the last unsteady commit to force flush the data buffers to disk, for non-sync durability modes.
inline env & set_sync_period__seconds_16dot16 (
unsigned seconds_16dot16
)
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 env::durability::whole_fragile, env::durability::lazy_weak_tail or in part env::durability::half_synchronous_weak_last. The settled period is not 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, which means that no timeout is checked and no additional flush will be made.
See also: extra_runtime_option::sync_period
Parameters:
seconds_16dot16The period in 1/65536 of second when a synchronous flush would be made since the last unsteady commit.
function set_sync_period__seconds_double
Sets relative period since the last unsteady commit to force flush the data buffers to disk, for non-sync durability modes.
inline env & set_sync_period__seconds_double (
double seconds
)
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 env::durability::whole_fragile, env::durability::lazy_weak_tail or in part env::durability::half_synchronous_weak_last. The settled period is not 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, which means that no timeout is checked and no additional flush will be made.
See also: extra_runtime_option::sync_period
Parameters:
secondsThe period in second when a synchronous flush would be made since the last unsteady commit.
function set_sync_threshold
Sets threshold to force flush the data buffers to disk, for non-sync durability modes.
inline env & set_sync_threshold (
size_t bytes
)
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 env::durability::whole_fragile, env::durability::lazy_weak_tail or in part env::durability::half_synchronous_weak_last.
The default is 0, which means that no threshold is checked and no additional flush will be made.
See also: extra_runtime_option::sync_bytes
function set_use_subdirectory
Sets whether to use a subdirectory to place the DB files.
create_parameters & set_use_subdirectory (
bool value=true
) noexcept
function size
Returns the number of bytes.
size_t size () noexcept const
function slice
Create an empty slice.
constexpr slice () noexcept
function slice
Create a slice that refers to [0,bytes-1] of memory bytes pointed by ptr.
constexpr slice (
const void * ptr,
size_t bytes
)
function slice
Create a slice that refers to [begin,end] of memory bytes.
constexpr slice (
const void * begin,
const void * end
)
function slice
Create a slice that refers to c_str[0,strlen(c_str)-1].
explicit constexpr slice (
const char * c_str
)
function slice
constexpr slice (
const MDBX_val & src
)
function slice
constexpr slice (
MDBX_val && src
)
function slice
constexpr slice (
slice && src
) noexcept
function start_read
Starts read (read-only) transaction.
inline txn_managed start_read () const
function start_write
Starts write (read-write) transaction.
inline txn_managed start_write (
bool dont_wait=false
)
function start_write
Starts write (read-write) transaction.
inline txn_managed start_write (
txn & parent
)
function starts_with
Checks if the data starts with the given prefix.
bool starts_with (
const slice & prefix
) noexcept const
function success_or_throw
inline void success_or_throw () const
function success_or_throw
inline void success_or_throw (
const exception_thunk & thunk
) const
function sync_period__seconds_16dot16
Gets relative period since the last unsteady commit that used to force flush the data buffers to disk, for non-sync durability modes.
inline unsigned sync_period__seconds_16dot16 () const
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 env::durability::whole_fragile, env::durability::lazy_weak_tail or in part env::durability::half_synchronous_weak_last. The settled period is not 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, which means that no timeout is checked and no additional flush will be made.
See also: extra_runtime_option::sync_period
See also: set_sync_period(const duration&)
See also: extra_runtime_option::sync_period
See also: sync_period__seconds_16dot16(unsigned)
function sync_period__seconds_double
Gets relative period since the last unsteady commit that used to force flush the data buffers to disk, for non-sync durability modes.
inline double sync_period__seconds_double () const
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 env::durability::whole_fragile, env::durability::lazy_weak_tail or in part env::durability::half_synchronous_weak_last. The settled period is not 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, which means that no timeout is checked and no additional flush will be made.
See also: extra_runtime_option::sync_period
See also: set_sync_period(const duration&)
See also: extra_runtime_option::sync_period
See also: set_sync_period__seconds_double(double)
function sync_threshold
Gets threshold used to force flush the data buffers to disk, for non-sync durability modes.
inline size_t sync_threshold () const
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 env::durability::whole_fragile, env::durability::lazy_weak_tail or in part env::durability::half_synchronous_weak_last.
The default is 0, which means that no threshold is checked and no additional flush will be made.
See also: extra_runtime_option::sync_bytes
See also: extra_runtime_option::sync_bytes
function sync_to_disk
Flush the environment data buffers.
inline bool sync_to_disk (
bool force=true,
bool nonblock=false
)
Returns:
True if sync done or no data to sync; false if the environment is busy by another thread and nonblock=true is used.
function tail
Returns the last "n" bytes of the slice.
slice tail (
size_t n
) noexcept const
Precondition:
REQUIRES: n <= size()
function thread_register
Registers the current thread as a reader for the environment, i.e. assigns a reader slot.
inline void thread_register ()
function thread_unregister
Unregisters the current thread, i.e. releases its reader slot.
inline void thread_unregister ()
function throw_on_failure
inline void throw_on_failure () const
function try_insert
inline value_result try_insert (
map_handle map,
const slice & key,
slice value
)
function try_insert
inline value_result try_insert (
const slice & key,
slice value
)
function try_insert_reserve
inline value_result try_insert_reserve (
map_handle map,
const slice & key,
size_t value_length
)
function try_insert_reserve
inline value_result try_insert_reserve (
const slice & key,
size_t value_length
)
function try_start_write
Tries to start write (read-write) transaction without blocking.
inline txn_managed try_start_write ()
function try_update
inline bool try_update (
map_handle map,
const slice & key,
const slice & value
)
function try_update
inline bool try_update (
const slice & key,
const slice & value
)
function try_update_reserve
inline value_result try_update_reserve (
map_handle map,
const slice & key,
size_t value_length
)
function try_update_reserve
inline value_result try_update_reserve (
const slice & key,
size_t value_length
)
function turn_for_recovery
Turns the database to the specified meta-page.
inline void turn_for_recovery (
unsigned target_meta
)
Mostly an internal API for the mdbx_chk utility and subject to change; use only when you know what you are doing. See env_managed::open_for_recovery().
See also: mdbx_env_turn_for_recovery()
function txn
inline txn (
txn && other
) noexcept
function txn
Returns the cursor's transaction.
inline inline ::mdbx::txn txn () const
function txn_lock
Acquires write-transaction lock.
inline bool txn_lock (
bool dont_wait=false
)
Provided for custom and/or complex locking scenarios, see mdbx_txn_lock(). Callers MUST NOT hold any write transaction while holding the lock.
Parameters:
dont_waitIf true, does not block and returnsfalseimmediately when the lock is held by another thread or process.
Returns:
True if the lock was acquired, false otherwise.
See also: txn_unlock()
See also: mdbx_txn_lock()
function txn_unlock
Releases write-transaction lock acquired by txn_lock() .
inline void txn_unlock ()
See also: txn_lock()
See also: mdbx_txn_unlock()
function unbind
Unbind cursor from a transaction.
inline void unbind ()
function unpark_reading
Resume parked read-only transaction.
inline bool unpark_reading (
bool restart_if_ousted=true
)
Returns:
True if transaction was restarted while restart_if_ousted=true.
function update
inline void update (
map_handle map,
const slice & key,
const slice & value
)
function update
inline void update (
const slice & key,
const slice & value
)
function update_reserve
inline slice update_reserve (
map_handle map,
const slice & key,
size_t value_length
)
function update_reserve
inline slice update_reserve (
const slice & key,
size_t value_length
)
function upper_bound
inline move_result upper_bound (
const slice & key,
bool throw_notfound=false
)
function upper_bound_multivalue
inline move_result upper_bound_multivalue (
const slice & key,
const slice & value,
bool throw_notfound=false
)
function upsert
inline void upsert (
map_handle map,
const slice & key,
const slice & value
)
function upsert
inline void upsert (
const slice & key,
const slice & value
)
function upsert_reserve
inline slice upsert_reserve (
map_handle map,
const slice & key,
size_t value_length
)
function upsert_reserve
inline slice upsert_reserve (
const slice & key,
size_t value_length
)
function value_mode
MDBX_CXX11_CONSTEXPR_ENUM mdbx::value_mode value_mode () noexcept const
function warmup
Loads into memory the given pages of the database and their on-disk neighbours in advance.
inline MDBX_NODISCARD int warmup (
MDBX_warmup_flags_t flags,
unsigned timeout_seconds_16dot16,
const MDBX_txn * txn=nullptr
) const
Returns:
MDBX_RESULT_TRUE if the specified timeout is reached during loading data into memory, MDBX_SUCCESS on success.
See also: mdbx_env_warmup()
function whole_fragile
Sets the durability level to env::durability::whole_fragile .
operate_parameters & whole_fragile () noexcept
function write_file_io
Sets the operation mode to env::mode::write_file_io .
operate_parameters & write_file_io () noexcept
function write_mapped_io
Sets the operation mode to env::mode::write_mapped_io .
operate_parameters & write_mapped_io () noexcept
function ~cursor
inline ~cursor () noexcept
function ~env
inline ~env () noexcept
function ~txn
inline ~txn () noexcept
Public Static Functions Documentation
function boolean_or_throw
static inline bool boolean_or_throw (
int error_code
)
function boolean_or_throw
static inline bool boolean_or_throw (
int error_code,
const exception_thunk & thunk
)
function compare_fast
Three-way fast non-lexicographically length-based comparison.
static intptr_t compare_fast (
const slice & a,
const slice & b
) noexcept
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 greater than b.
function compare_fast
Three-way fast non-lexicographically length-based comparison.
static intptr_t compare_fast (
const pair & a,
const pair & b
) noexcept
function compare_lexicographically
Three-way lexicographically comparison.
static intptr_t compare_lexicographically (
const slice & a,
const slice & b
) noexcept
Returns:
value: == 0 if a lexicographically equal b; < 0 if a lexicographically less than b; > 0 if a lexicographically greater than b.
function compare_lexicographically
Three-way lexicographically comparison.
static intptr_t compare_lexicographically (
const pair & a,
const pair & b
) noexcept
function dbsize_max
Returns the maximal database size in bytes for specified page size.
static inline size_t dbsize_max (
intptr_t pagesize
)
function dbsize_min
Returns the minimal database size in bytes for specified page size.
static inline size_t dbsize_min (
intptr_t pagesize
)
function distance_between
static inline ptrdiff_t distance_between (
const cursor from,
const cursor to,
unsigned deepness=42
)
function distribute
static inline bool distribute (
const cursor from,
const cursor to,
cursor * cursors_array,
intptr_t cursors_array_size,
unsigned deepness=42
)
function distribute
static inline bool distribute (
const cursor from,
const cursor to,
const std::vector< cursor > & cursors,
unsigned deepness=42
)
function distribute
static inline bool distribute (
const cursor from,
const cursor to,
const std::vector< cursor_managed > & cursors,
unsigned deepness=42
)
function fragile_write
Constructs parameters for a writable environment with env::durability::whole_fragile durability and_env::mode::write_mapped_io ._
static operate_parameters fragile_write () noexcept
function get_preopen_snapinfo
Provides information about a database, including meta-page and geometry, without opening it.
static inline MDBX_NODISCARD info get_preopen_snapinfo (
const ::std::string & pathname
)
Returns:
The info of the database. Errors are thrown as mdbx::error.
See also: mdbx_preopen_snapinfo()
function get_preopen_snapinfo
static inline MDBX_NODISCARD info get_preopen_snapinfo (
const char * pathname
)
function get_preopen_snapinfo
static inline MDBX_NODISCARD info get_preopen_snapinfo (
const ::mdbx::filesystem::path & pathname
)
function get_sysraminfo
Returns information about the system RAM.
static inline MDBX_NODISCARD sysraminfo get_sysraminfo ()
function key_max
Returns the maximal key size in bytes for specified page size and table flags.
static inline size_t key_max (
intptr_t pagesize,
MDBX_db_flags_t flags
)
function key_max
Returns the maximal key size in bytes for specified page size and keys mode.
static inline size_t key_max (
intptr_t pagesize,
key_mode mode
)
function key_max
Returns the maximal key size in bytes for given environment and table flags.
static inline size_t key_max (
const env & env,
MDBX_db_flags_t flags
)
function key_max
Returns the maximal key size in bytes for given environment and keys mode.
static inline size_t key_max (
const env & env,
key_mode mode
)
function key_min
Returns the minimal key size in bytes for specified table flags.
static inline size_t key_min (
MDBX_db_flags_t flags
) noexcept
function key_min
Returns the minimal key size in bytes for specified keys mode.
static inline size_t key_min (
key_mode mode
) noexcept
function lazy_write
Constructs parameters for a writable environment with env::durability::lazy_weak_tail durability and_env::mode::write_mapped_io ._
static operate_parameters lazy_write () noexcept
function max_map_handles
Returns the maximum opened map handles, aka DBI-handles.
static inline size_t max_map_handles (
void
)
function memcmp
constexpr-enabled memcmp().
static int memcmp (
const void * a,
const void * b,
size_t bytes
) noexcept
function memcpy
constexpr-enabled memcpy().
static void * memcpy (
void * dest,
const void * src,
size_t bytes
) noexcept
function options_from_flags
static inline MDBX_NODISCARD env::operate_options options_from_flags (
MDBX_env_flags_t flags
) noexcept
function pagesize_max
Returns the maximal database page size in bytes.
static inline size_t pagesize_max () noexcept
function pagesize_min
Returns the minimal database page size in bytes.
static inline size_t pagesize_min () noexcept
function pairsize4page_max
Returns maximal size of key-value pair to fit in a single page for specified page size and table flags.
static inline size_t pairsize4page_max (
intptr_t pagesize,
MDBX_db_flags_t flags
)
function pairsize4page_max
Returns maximal size of key-value pair to fit in a single page for specified page size and values mode.
static inline size_t pairsize4page_max (
intptr_t pagesize,
value_mode mode
)
function pairsize4page_max
Returns maximal size of key-value pair to fit in a single page for given environment and table flags.
static inline size_t pairsize4page_max (
const env & env,
MDBX_db_flags_t flags
)
function pairsize4page_max
Returns maximal size of key-value pair to fit in a single page for given environment and values mode.
static inline size_t pairsize4page_max (
const env & env,
value_mode mode
)
function read_only
Constructs parameters for a read-only environment.
static operate_parameters read_only () noexcept
function reclaiming_from_flags
static inline MDBX_NODISCARD env::reclaiming_options reclaiming_from_flags (
MDBX_env_flags_t flags
) noexcept
function safe_write
Constructs parameters for a writable environment with env::durability::robust_synchronous durability and_env::mode::write_mapped_io ._
static operate_parameters safe_write () noexcept
function strlen
constexpr-enabled strlen().
static size_t strlen (
const char * c_str
) noexcept
function success_or_throw
static inline void success_or_throw (
MDBX_error_t error_code
)
function success_or_throw
static inline void success_or_throw (
int error_code,
const exception_thunk & thunk
)
function throw_exception
static inline void throw_exception (
int error_code
)
function throw_on_failure
static inline void throw_on_failure (
int error_code
)
function throw_on_nullptr
static inline void throw_on_nullptr (
const void * ptr,
MDBX_error_t error_code
)
function transaction_size_max
Returns the maximal write transaction size (i.e. limit for summary volume of dirty pages) in bytes for specified page size.
static inline size_t transaction_size_max (
intptr_t pagesize
)
function valsize4page_max
Returns maximal data size in bytes to fit in a leaf-page or single large/overflow-page for specified size and table flags.
static inline size_t valsize4page_max (
intptr_t pagesize,
MDBX_db_flags_t flags
)
function valsize4page_max
Returns maximal data size in bytes to fit in a leaf-page or single large/overflow-page for specified page size and values mode.
static inline size_t valsize4page_max (
intptr_t pagesize,
value_mode mode
)
function valsize4page_max
Returns maximal data size in bytes to fit in a leaf-page or single large/overflow-page for given environment and table flags.
static inline size_t valsize4page_max (
const env & env,
MDBX_db_flags_t flags
)
function valsize4page_max
Returns maximal data size in bytes to fit in a leaf-page or single large/overflow-page for given environment and values mode.
static inline size_t valsize4page_max (
const env & env,
value_mode mode
)
function value_max
Returns the maximal value size in bytes for specified page size and table flags.
static inline size_t value_max (
intptr_t pagesize,
MDBX_db_flags_t flags
)
function value_max
Returns the maximal value size in bytes for specified page size and values mode.
static inline size_t value_max (
intptr_t pagesize,
value_mode mode
)
function value_max
Returns the maximal value size in bytes for given environment and table flags.
static inline size_t value_max (
const env & env,
MDBX_db_flags_t flags
)
function value_max
Returns the maximal value size in bytes for given environment and values mode.
static inline size_t value_max (
const env & env,
value_mode mode
)
function value_min
Returns the minimal values size in bytes for specified table flags.
static inline size_t value_min (
MDBX_db_flags_t flags
) noexcept
function value_min
Returns the minimal values size in bytes for specified values mode.
static inline size_t value_min (
value_mode mode
) noexcept
Protected Functions Documentation
function env
constexpr env (
MDBX_env * ptr
) noexcept
function estimate
inline ptrdiff_t estimate (
move_operation operation,
MDBX_val * key,
MDBX_val * value
) const
function move
inline bool move (
move_operation operation,
MDBX_val * key,
MDBX_val * value,
bool throw_notfound
) const
function txn
constexpr txn (
MDBX_txn * ptr
) noexcept
Macro Definition Documentation
define MDBX_CXX_HAS_POLYMORPHIC_ALLOCATOR
Defined as 1 if themdbx::polymorphic_allocator is available.
#define MDBX_CXX_HAS_POLYMORPHIC_ALLOCATOR `1`
See also: The <memory_resource> Standard C++17 library header
define MDBX_STD_FILESYSTEM_PATH
Defined if mdbx::filesystem::path is available.
#define MDBX_STD_FILESYSTEM_PATH `::mdbx::filesystem::path`
If defined, it is always mdbx::filesystem::path, which in turn can refer to std::filesystem::path or std::experimental::filesystem::path. Nonetheless MDBX_STD_FILESYSTEM_PATH is not defined if the mdbx::path falls back to a plain std::string or std::wstring.