Skip to content

File mdbx.h++

FileList > mdbx.h++

Go to the source code of this file

The libmdbx C++ API header file. More...

  • #include <algorithm>
  • #include <cassert>
  • #include <climits>
  • #include <cstdint>
  • #include <cstring>
  • #include <exception>
  • #include <ostream>
  • #include <sstream>
  • #include <stdexcept>
  • #include <string>
  • #include <type_traits>
  • #include <utility>
  • #include <vector>
  • #include "mdbx.h"

Namespaces

Type Name
namespace mdbx
The libmdbx C++ API namespace.
namespace allocation_aware_details
namespace std
STL namespace.

Classes

Type Name
struct bad_map_id
Thrown on MDBX_BAD_DBI , i.e. an invalid table handle was used.
struct bad_transaction
Thrown on MDBX_BAD_TXN , i.e. a transaction handle is invalid or was used after being finished.
struct bad_value_size
Thrown on MDBX_BAD_VALSIZE , i.e. an unsupported size of a key or a data item.
class buffer <class ALLOCATOR, typename CAPACITY_POLICY>
The chunk of data stored inside the buffer or located outside it.
struct capacity_holder
struct inplace_flag_holder
struct stub_allocated_holder
struct buffer_pair_spec <typename ALLOCATOR, typename CAPACITY_POLICY>
A pair of buffer instances for a key and a value, with the same allocator and capacity policy; the buffer counterpart ofpair .
struct buffer_tag
Type tag for delivered buffer template classes.
class cache_entry
Cache entry for the transparent read-your-writes caching, see txn::get_cached() andmdbx_cache_get() .
class cursor
Unmanaged cursor.
struct estimate_result
The result of a range estimation: the boundary key-value pair plus the approximate number of items.
struct move_result
The result of a cursor move/seek operation: the found key-value pair plus the success flag.
class cursor_managed
Managed cursor.
struct dangling_map_id
Thrown on MDBX_DANGLING_DBI , i.e. a table handle refers to a non-existent table.
struct db_corrupted
Thrown on MDBX_CORRUPTED , i.e. the database is corrupted or an invalid data was detected.
struct db_full
Thrown on MDBX_MAP_FULL , i.e. the database is full and the environment cannot be extended.
struct db_invalid
Thrown on MDBX_INVALID , i.e. an invalid parameter was specified or the environment is already closed.
struct db_too_large
Thrown on MDBX_TOO_LARGE , i.e. the database is too large for the current process/environment.
struct db_unable_extend
Thrown on MDBX_UNABLE_EXTEND_MAPSIZE , i.e. the requested geometry change needs the mapping to be re-created but it could not be applied right now.
struct db_version_mismatch
Thrown on MDBX_VERSION_MISMATCH , i.e. the database was created by an incompatible version of libmdbx.
struct db_wanna_write_for_recovery
Thrown on MDBX_WANNA_RECOVERY , i.e. the database requires recovery usingmdbx_chk and/ormdbx_env_open_for_recovery() .
struct default_capacity_policy
The default capacity policy for the buffer class: rounds the allocated capacity and advises whether to grow, keep or shrink it.
struct duplicated_lck_file
Thrown on MDBX_DUPLICATED_LCK , i.e. the lock file was created in a manner that conflicts with the current process' state.
class env
Unmanaged database environment.
struct geometry
Database geometry for size management.
struct size
Tagged type for output to std::ostream.
struct limits
A namespace-like holder of static functions returning the various libmdbx limits, the C++ counterpart of the mdbx_limits_*() C API.
struct operate_options
Operate options.
struct operate_parameters
Operate parameters.
struct reader_info
Reader information.
struct reclaiming_options
Garbage reclaiming options.
struct sysraminfo
Information about the system RAM, see mdbx_get_sysraminfo() .
class env_managed
Managed database environment.
struct create_parameters
Additional parameters for creating a new database.
class error
Implements error information and throwing corresponding exceptions.
class exception
Base class for all libmdbx's exceptions that correspond to libmdbx errors.
class exception_thunk
Transfers C++ exceptions thru C callbacks.
class fatal
Fatal exception that leads to termination anyway in dangerous unrecoverable cases.
struct from_base58
Base58 decoder which satisfySliceTranscoder concept.
struct from_base64
Base64 decoder which satisfySliceTranscoder concept.
struct from_hex
Hexadecimal decoder which satisfy SliceTranscoder concept.
struct incompatible_operation
Thrown on MDBX_INCOMPATIBLE , i.e. an operation is incompatible with the environment/table options.
struct internal_page_full
Thrown on MDBX_PAGE_FULL , i.e. an item does not fit into a page of the table.
struct internal_problem
Thrown on MDBX_PROBLEM , i.e. an unexpected internal problem was detected.
struct key_exists
Thrown on MDBX_KEYEXIST , i.e. the key/data pair already exists and_MDBX_NOOVERWRITE _was specified.
struct key_mismatch
Thrown on MDBX_EKEYMISMATCH , i.e. an insert with the append hint but the key is not the last one.
struct laggard_reader
Thrown on MDBX_LAGGARD_READER , i.e. the reader is lagging too much behind.
struct map_handle
A handle for an individual table (aka key-value space, maps or sub-database) in the environment.
struct info
Flags and state of a table (aka map).
struct max_maps_reached
Thrown on MDBX_DBS_FULL , i.e. the maximum number of table handles has been reached.
struct max_readers_reached
Thrown on MDBX_READERS_FULL , i.e. the environment's reader table is full.
struct multivalue
Thrown on MDBX_EMULTIVAL , i.e. the operation is not supported for the multi-value (dupsort) key.
struct mvcc_retarded
Thrown on MDBX_MVCC_RETARDED , i.e. the MVCC snapshot is retarded too much to continue.
struct no_data
Thrown on MDBX_ENODATA , i.e. the requested data is missing.
struct not_found
Thrown on MDBX_NOTFOUND , i.e. the requested key/data pair was not found.
struct operation_not_permitted
Thrown on MDBX_EPERM , i.e. the operation is not permitted in the current state/environment mode.
struct pair
Combines pair of slices for key and value to represent result of certain operations.
struct pair_result
Combines pair of slices for key and value with boolean flag to represent result of certain operations.
struct permission_denied_or_not_writeable
Thrown on MDBX_EACCESS , i.e. a permission was denied or the environment/data is not writable.
struct reader_slot_busy
Thrown on MDBX_BAD_RSLOT , i.e. a reader slot is invalid or busy.
struct remote_media
Thrown on MDBX_EREMOTE , i.e. a file/locking system call failed for the reason that could not be diagnosed.
struct slice
References a data located outside the slice.
struct something_busy
Thrown on MDBX_BUSY , i.e. some resource is busy by another thread or process.
struct thread_mismatch
Thrown on MDBX_THREAD_MISMATCH , i.e. the transaction/cursor is used by an alien thread.
struct to_base58
Base58 encoder which satisfySliceTranscoder concept.
struct to_base64
Base64 encoder which satisfySliceTranscoder concept.
struct to_hex
Hexadecimal encoder which satisfy SliceTranscoder concept.
struct transaction_full
Thrown on MDBX_TXN_FULL , i.e. the transaction has too many dirty pages and cannot be continued.
struct transaction_ousted
Thrown on MDBX_OUSTED , i.e. the current write transaction was ousted by a newer one.
struct transaction_overlapping
Thrown on MDBX_TXN_OVERLAPPING , i.e. a write transaction was started while another one is in progress by the same process.
class txn
Unmanaged database transaction.
class txn_managed
Managed database transaction.
struct value_result
Combines data slice with boolean flag to represent result of certain operations.
struct hash<::mdbx::buffer< ALLOCATOR, CAPACITY_POLICY > > <class ALLOCATOR, typename CAPACITY_POLICY>
struct hash<::mdbx::cursor > <>
struct hash<::mdbx::env > <>
struct hash<::mdbx::map_handle > <>
struct hash<::mdbx::slice > <>
struct hash<::mdbx::txn > <>

Public Types

Type Name
union bin

Macros

Type Name
define MDBX_ASSERT_CXX20_CONCEPT_SATISFIED (CONCEPT, TYPE) static\_assert(CONCEPT&lt;TYPE&gt;)
define MDBX_CONSTEXPR_ASSERT (expr) ((expr) ? void(0) : [] { assert(!#expr); }())
define MDBX_CXX01_CONSTEXPR_ENUM [**MDBX\_CXX01\_CONSTEXPR**](group__api__macros.md#define-mdbx_cxx01_constexpr)
define MDBX_CXX11_CONSTEXPR_ENUM [**MDBX\_CXX11\_CONSTEXPR**](group__api__macros.md#define-mdbx_cxx11_constexpr)
define MDBX_CXX14_CONSTEXPR_ENUM [**MDBX\_CXX14\_CONSTEXPR**](group__api__macros.md#define-mdbx_cxx14_constexpr)
define MDBX_CXX17_CONSTEXPR constexpr
define MDBX_CXX17_CONSTEXPR_ENUM [**MDBX\_CXX17\_CONSTEXPR**](mdbx_8h_09_09.md#define-mdbx_cxx17_constexpr)
define MDBX_CXX17_FALLTHROUGH [[fallthrough]]
define MDBX_CXX20_CONSTEXPR constexpr
define MDBX_CXX20_CONSTEXPR_ENUM [**MDBX\_CXX20\_CONSTEXPR**](mdbx_8h_09_09.md#define-mdbx_cxx20_constexpr)
define MDBX_CXX20_LIKELY [[likely]]
define MDBX_EXTERN_API_TEMPLATE (API_ATTRIBUTES, ...) extern template class API\_ATTRIBUTES \_\_VA\_ARGS\_\_
define MDBX_IF_CONSTEXPR constexpr
define MDBX_INSTALL_API_TEMPLATE (API_ATTRIBUTES, ...) template class \_\_VA\_ARGS\_\_
define MDBX_MSVC_DECLSPEC_EMPTY_BASES
define MDBX_NODISCARD [[nodiscard]]
define MDBX_USING_CXX_EXPERIMENTAL_FILESYSTEM 0

Detailed Description

This file is part of the libmdbx amalgamated source code (v0.15.0-334-gb8f2dad5 at 2026-10-29T00:17:01+03:00).

libmdbx (aka MDBX) is an extremely fast, compact, powerful, embeddable, transactional key-value store, with Apache 2.0 license. MDBX has a specific set of properties and capabilities, focused on creating unique lightweight solutions with extraordinary performance.

Please visit https://libmdbx.dqdkfa.ru for more information, documentation, C++ API description and links to the origin git repo with the source code. Questions, feedback and suggestions are welcome to the Telegram' group https://t.me/libmdbx, MAX' chat https://max.ru/join/dKckvyuARxp1vRK-wnPur8zYCEkbR3OUOmpPWkWxp78.

Donations are welcome to ETH 0xD104d8f8B2dC312aaD74899F83EBf3EEBDC1EA3A, BTC bc1qzvl9uegf2ea6cwlytnanrscyv8snwsvrc0xfsu, SOL FTCTgbHajoLVZGr8aEFWMzx3NDMyS5wXJgfeMTmJznRi. Всё будет хорошо!

The libmdbx project has been completely relocated to the jurisdiction of the Russian Federation.

Note:

libmdbx is still open and provided with first-class free support.

Copyright:

SPDX-License-Identifier: Apache-2.0

Author:

Леонид Юрьев aka Leonid Yuriev leo@yuriev.ru

Date:

2020-2026

Public Types Documentation

union bin



Macro Definition Documentation

define MDBX_ASSERT_CXX20_CONCEPT_SATISFIED

#define MDBX_ASSERT_CXX20_CONCEPT_SATISFIED (
    CONCEPT,
    TYPE
) `static_assert(CONCEPT<TYPE>)`

define MDBX_CONSTEXPR_ASSERT

#define MDBX_CONSTEXPR_ASSERT (
    expr
) `((expr) ? void(0) : [] { assert(!#expr); }())`

Workaround for old compilers without support assertion inside constexpr functions.


define MDBX_CXX01_CONSTEXPR_ENUM

#define MDBX_CXX01_CONSTEXPR_ENUM `MDBX_CXX01_CONSTEXPR`

define MDBX_CXX11_CONSTEXPR_ENUM

#define MDBX_CXX11_CONSTEXPR_ENUM `MDBX_CXX11_CONSTEXPR`

define MDBX_CXX14_CONSTEXPR_ENUM

#define MDBX_CXX14_CONSTEXPR_ENUM `MDBX_CXX14_CONSTEXPR`

define MDBX_CXX17_CONSTEXPR

#define MDBX_CXX17_CONSTEXPR `constexpr`

Workaround for old compilers without properly support for C++17 constexpr


define MDBX_CXX17_CONSTEXPR_ENUM

#define MDBX_CXX17_CONSTEXPR_ENUM `MDBX_CXX17_CONSTEXPR`

define MDBX_CXX17_FALLTHROUGH

#define MDBX_CXX17_FALLTHROUGH `[[fallthrough]]`

define MDBX_CXX20_CONSTEXPR

#define MDBX_CXX20_CONSTEXPR `constexpr`

Workaround for old compilers without properly support for C++20 constexpr.


define MDBX_CXX20_CONSTEXPR_ENUM

#define MDBX_CXX20_CONSTEXPR_ENUM `MDBX_CXX20_CONSTEXPR`

define MDBX_CXX20_LIKELY

#define MDBX_CXX20_LIKELY `[[likely]]`

define MDBX_EXTERN_API_TEMPLATE

#define MDBX_EXTERN_API_TEMPLATE (
    API_ATTRIBUTES,
    ...
) `extern template class API_ATTRIBUTES __VA_ARGS__`

define MDBX_IF_CONSTEXPR

#define MDBX_IF_CONSTEXPR `constexpr`

Workaround for old compilers without properly support for C++20 if constexpr.


define MDBX_INSTALL_API_TEMPLATE

#define MDBX_INSTALL_API_TEMPLATE (
    API_ATTRIBUTES,
    ...
) `template class __VA_ARGS__`

define MDBX_MSVC_DECLSPEC_EMPTY_BASES

#define MDBX_MSVC_DECLSPEC_EMPTY_BASES 

define MDBX_NODISCARD

#define MDBX_NODISCARD `[[nodiscard]]`

Workaround for old compilers without [[nodiscard]] support


define MDBX_USING_CXX_EXPERIMENTAL_FILESYSTEM

#define MDBX_USING_CXX_EXPERIMENTAL_FILESYSTEM `0`


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