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

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

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

Go to the source code of this file.

Classes

class  mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >
 The chunk of data stored inside the buffer or located outside it. More...
 
class  mdbx::exception_thunk
 Transfers C++ exceptions thru C callbacks. More...
 
class  mdbx::error
 Implements error information and throwing corresponding exceptions. More...
 
class  mdbx::exception
 Base class for all libmdbx's exceptions that are corresponds to libmdbx errors. More...
 
class  mdbx::fatal
 Fatal exception that lead termination anyway in dangerous unrecoverable cases. More...
 
struct  mdbx::slice
 References a data located outside the slice. More...
 
struct  mdbx::allocation_aware_details::move_assign_alloc< T, A, PoCMA >
 
struct  mdbx::allocation_aware_details::move_assign_alloc< T, A, false >
 
struct  mdbx::allocation_aware_details::move_assign_alloc< T, A, true >
 
struct  mdbx::allocation_aware_details::copy_assign_alloc< T, A, PoCCA >
 
struct  mdbx::allocation_aware_details::copy_assign_alloc< T, A, false >
 
struct  mdbx::allocation_aware_details::copy_assign_alloc< T, A, true >
 
struct  mdbx::allocation_aware_details::swap_alloc< T, A, PoCS >
 
struct  mdbx::allocation_aware_details::swap_alloc< T, A, false >
 
struct  mdbx::allocation_aware_details::swap_alloc< T, A, true >
 
struct  mdbx::default_capacity_policy
 
struct  mdbx::to_hex
 Hexadecimal encoder which satisfy SliceTranscoder concept. More...
 
struct  mdbx::to_base58
 Base58 encoder which satisfy SliceTranscoder concept. More...
 
struct  mdbx::to_base64
 Base64 encoder which satisfy SliceTranscoder concept. More...
 
struct  mdbx::from_hex
 Hexadecimal decoder which satisfy SliceTranscoder concept. More...
 
struct  mdbx::from_base58
 Base58 decoder which satisfy SliceTranscoder concept. More...
 
struct  mdbx::from_base64
 Base64 decoder which satisfy SliceTranscoder concept. More...
 
class  mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >
 The chunk of data stored inside the buffer or located outside it. More...
 
union  mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::silo::bin
 
struct  mdbx::buffer< ALLOCATOR, CAPACITY_POLICY >::silo::bin::allocated
 
struct  mdbx::value_result
 Combines data slice with boolean flag to represent result of certain operations. More...
 
struct  mdbx::pair
 Combines pair of slices for key and value to represent result of certain operations. More...
 
struct  mdbx::pair_result
 Combines pair of slices for key and value with boolean flag to represent result of certain operations. More...
 
struct  mdbx::map_handle
 A handle for an individual database (key-value spaces) in the environment. More...
 
struct  mdbx::map_handle::info
 
class  mdbx::env
 Unmanaged database environment. More...
 
struct  mdbx::env::geometry
 Database geometry for size management. More...
 
struct  mdbx::env::geometry::size
 Tagged type for output to std::ostream. More...
 
struct  mdbx::env::reclaiming_options
 Garbage reclaiming options. More...
 
struct  mdbx::env::operate_options
 Operate options. More...
 
struct  mdbx::env::operate_parameters
 Operate parameters. More...
 
struct  mdbx::env::limits
 
struct  mdbx::env::reader_info
 Reader information. More...
 
class  mdbx::env_managed
 Managed database environment. More...
 
struct  mdbx::env_managed::create_parameters
 Additional parameters for creating a new database. More...
 
class  mdbx::txn
 Unmanaged database transaction. More...
 
class  mdbx::txn_managed
 Managed database transaction. More...
 
class  mdbx::cursor
 Unmanaged cursor. More...
 
struct  mdbx::cursor::move_result
 
class  mdbx::cursor_managed
 Managed cursor. More...
 
struct  std::hash<::mdbx::slice >
 

Namespaces

 mdbx
 
 mdbx::allocation_aware_details
 

Macros

#define __has_include(header)   (0)
 
#define NOMINMAX
 
#define __ORDER_LITTLE_ENDIAN__   1234
 
#define __ORDER_BIG_ENDIAN__   4321
 
#define MDBX_CXX17_CONSTEXPR   constexpr
 
#define MDBX_CXX20_CONSTEXPR   constexpr
 
#define MDBX_CONSTEXPR_ASSERT(expr)   ((expr) ? void(0) : [] { assert(!#expr); }())
 
#define MDBX_LIKELY(cond)   __builtin_expect(!!(cond), 1)
 
#define MDBX_UNLIKELY(cond)   __builtin_expect(!!(cond), 0)
 
#define MDBX_IF_CONSTEXPR
 
#define MDBX_CXX17_FALLTHROUGH   [[fallthrough]]
 
#define MDBX_CXX20_LIKELY   [[likely]]
 
#define MDBX_CXX20_UNLIKELY   [[unlikely]]
 
#define MDBX_CXX20_CONCEPT(CONCEPT, NAME)   CONCEPT NAME
 
#define MDBX_ASSERT_CXX20_CONCEPT_SATISFIED(CONCEPT, TYPE)   static_assert(CONCEPT<TYPE>)
 
#define MDBX_STD_FILESYSTEM_PATH   ::mdbx::filesystem::path
 
#define MDBX_DECLARE_EXCEPTION(NAME)
 

Typedefs

using mdbx::byte = char8_t
 
using mdbx::version_info = ::MDBX_version_info
 libmdbx version information More...
 
using mdbx::build_info = ::MDBX_build_info
 libmdbx build information More...
 
using mdbx::legacy_allocator = ::std::string::allocator_type
 Legacy default allocator but it is recommended to use polymorphic_allocator. More...
 
using mdbx::polymorphic_allocator = ::std::pmr::string::allocator_type
 Default polymorphic allocator for modern code. More...
 
template<class ALLOCATOR = legacy_allocator>
using mdbx::string = ::std::basic_string< char, ::std::char_traits< char >, ALLOCATOR >
 Default singe-byte string. More...
 
using mdbx::filehandle = ::mdbx_filehandle_t
 
using mdbx::path = MDBX_STD_FILESYSTEM_PATH
 

Enumerations

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

Functions

const MDBX_CXX11_CONSTEXPR version_info & mdbx::get_version () noexcept
 Returns libmdbx version information. More...
 
const MDBX_CXX11_CONSTEXPR build_info & mdbx::get_build () noexcept
 Returns libmdbx build information. More...
 
 mdbx::MDBX_DECLARE_EXCEPTION (bad_map_id)
 
 mdbx::MDBX_DECLARE_EXCEPTION (bad_transaction)
 
 mdbx::MDBX_DECLARE_EXCEPTION (bad_value_size)
 
 mdbx::MDBX_DECLARE_EXCEPTION (db_corrupted)
 
 mdbx::MDBX_DECLARE_EXCEPTION (db_full)
 
 mdbx::MDBX_DECLARE_EXCEPTION (db_invalid)
 
 mdbx::MDBX_DECLARE_EXCEPTION (db_too_large)
 
 mdbx::MDBX_DECLARE_EXCEPTION (db_unable_extend)
 
 mdbx::MDBX_DECLARE_EXCEPTION (db_version_mismatch)
 
 mdbx::MDBX_DECLARE_EXCEPTION (db_wanna_write_for_recovery)
 
 mdbx::MDBX_DECLARE_EXCEPTION (incompatible_operation)
 
 mdbx::MDBX_DECLARE_EXCEPTION (internal_page_full)
 
 mdbx::MDBX_DECLARE_EXCEPTION (internal_problem)
 
 mdbx::MDBX_DECLARE_EXCEPTION (key_exists)
 
 mdbx::MDBX_DECLARE_EXCEPTION (key_mismatch)
 
 mdbx::MDBX_DECLARE_EXCEPTION (max_maps_reached)
 
 mdbx::MDBX_DECLARE_EXCEPTION (max_readers_reached)
 
 mdbx::MDBX_DECLARE_EXCEPTION (multivalue)
 
 mdbx::MDBX_DECLARE_EXCEPTION (no_data)
 
 mdbx::MDBX_DECLARE_EXCEPTION (not_found)
 
 mdbx::MDBX_DECLARE_EXCEPTION (operation_not_permitted)
 
 mdbx::MDBX_DECLARE_EXCEPTION (permission_denied_or_not_writeable)
 
 mdbx::MDBX_DECLARE_EXCEPTION (reader_slot_busy)
 
 mdbx::MDBX_DECLARE_EXCEPTION (remote_media)
 
 mdbx::MDBX_DECLARE_EXCEPTION (something_busy)
 
 mdbx::MDBX_DECLARE_EXCEPTION (thread_mismatch)
 
 mdbx::MDBX_DECLARE_EXCEPTION (transaction_full)
 
 mdbx::MDBX_DECLARE_EXCEPTION (transaction_overlapping)
 
LIBMDBX_API void mdbx::throw_too_small_target_buffer ()
 
LIBMDBX_API void mdbx::throw_max_length_exceeded ()
 
LIBMDBX_API void mdbx::throw_out_range ()
 
LIBMDBX_API void mdbx::throw_allocators_mismatch ()
 
template<class ALLOCATOR = legacy_allocator, typename CAPACITY_POLICY = default_capacity_policy, MDBX_CXX20_CONCEPT(MutableByteProducer, PRODUCER) >
buffer< ALLOCATOR, CAPACITY_POLICY > mdbx::make_buffer (PRODUCER &producer, const ALLOCATOR &allocator=ALLOCATOR())
 
template<class ALLOCATOR = legacy_allocator, typename CAPACITY_POLICY = default_capacity_policy, MDBX_CXX20_CONCEPT(ImmutableByteProducer, PRODUCER) >
buffer< ALLOCATOR, CAPACITY_POLICY > mdbx::make_buffer (const PRODUCER &producer, const ALLOCATOR &allocator=ALLOCATOR())
 
template<class ALLOCATOR = legacy_allocator, MDBX_CXX20_CONCEPT(MutableByteProducer, PRODUCER) >
string< ALLOCATOR > mdbx::make_string (PRODUCER &producer, const ALLOCATOR &allocator=ALLOCATOR())
 
template<class ALLOCATOR = legacy_allocator, MDBX_CXX20_CONCEPT(ImmutableByteProducer, PRODUCER) >
string< ALLOCATOR > mdbx::make_string (const PRODUCER &producer, const ALLOCATOR &allocator=ALLOCATOR())
 
template<typename A >
constexpr bool mdbx::allocation_aware_details::allocator_is_always_equal () noexcept
 
inline ::std::ostream & mdbx::operator<< (::std::ostream &out, const to_hex &wrapper)
 
inline ::std::ostream & mdbx::operator<< (::std::ostream &out, const to_base58 &wrapper)
 
inline ::std::ostream & mdbx::operator<< (::std::ostream &out, const to_base64 &wrapper)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const slice &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const pair &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const pair_result &)
 
template<class ALLOCATOR , typename CAPACITY_POLICY >
inline ::std::ostream & mdbx::operator<< (::std::ostream &out, const buffer< ALLOCATOR, CAPACITY_POLICY > &it)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const env::geometry::size &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const env::geometry &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const env::operate_parameters &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const env::mode &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const env::durability &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const env::reclaiming_options &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const env::operate_options &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const env_managed::create_parameters &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const MDBX_log_level_t &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const MDBX_debug_flags_t &)
 
LIBMDBX_API ::std::ostream & mdbx::operator<< (::std::ostream &, const error &)
 
inline ::std::ostream & mdbx::operator<< (::std::ostream &out, const MDBX_error_t &errcode)
 
MDBX_CXX11_CONSTEXPR bool mdbx::operator== (const error &a, const error &b) noexcept
 
MDBX_CXX11_CONSTEXPR bool mdbx::operator!= (const error &a, const error &b) noexcept
 
MDBX_NOTHROW_PURE_FUNCTION MDBX_CXX14_CONSTEXPR bool mdbx::operator== (const slice &a, const slice &b) noexcept
 
MDBX_NOTHROW_PURE_FUNCTION MDBX_CXX14_CONSTEXPR bool mdbx::operator< (const slice &a, const slice &b) noexcept
 
MDBX_NOTHROW_PURE_FUNCTION MDBX_CXX14_CONSTEXPR bool mdbx::operator> (const slice &a, const slice &b) noexcept
 
MDBX_NOTHROW_PURE_FUNCTION MDBX_CXX14_CONSTEXPR bool mdbx::operator<= (const slice &a, const slice &b) noexcept
 
MDBX_NOTHROW_PURE_FUNCTION MDBX_CXX14_CONSTEXPR bool mdbx::operator>= (const slice &a, const slice &b) noexcept
 
MDBX_NOTHROW_PURE_FUNCTION MDBX_CXX14_CONSTEXPR bool mdbx::operator!= (const slice &a, const slice &b) noexcept
 
MDBX_CXX11_CONSTEXPR bool mdbx::operator== (const env &a, const env &b) noexcept
 
MDBX_CXX11_CONSTEXPR bool mdbx::operator!= (const env &a, const env &b) noexcept
 
MDBX_CXX11_CONSTEXPR bool mdbx::operator== (const txn &a, const txn &b) noexcept
 
MDBX_CXX11_CONSTEXPR bool mdbx::operator!= (const txn &a, const txn &b) noexcept
 
MDBX_CXX11_CONSTEXPR bool mdbx::operator== (const cursor &a, const cursor &b) noexcept
 
MDBX_CXX11_CONSTEXPR bool mdbx::operator!= (const cursor &a, const cursor &b) noexcept
 
ptrdiff_t mdbx::estimate (const cursor &from, const cursor &to)
 
string std::to_string (const ::mdbx::slice &value)
 
template<class ALLOCATOR , typename CAPACITY_POLICY >
string std::to_string (const ::mdbx::buffer< ALLOCATOR, CAPACITY_POLICY > &buffer)
 
string std::to_string (const ::mdbx::pair &value)
 
string std::to_string (const ::mdbx::env::geometry &value)
 
string std::to_string (const ::mdbx::env::operate_parameters &value)
 
string std::to_string (const ::mdbx::env::mode &value)
 
string std::to_string (const ::mdbx::env::durability &value)
 
string std::to_string (const ::mdbx::env::reclaiming_options &value)
 
string std::to_string (const ::mdbx::env::operate_options &value)
 
string std::to_string (const ::mdbx::env_managed::create_parameters &value)
 
string std::to_string (const ::MDBX_log_level_t &value)
 
string std::to_string (const ::MDBX_debug_flags_t &value)
 
string std::to_string (const ::mdbx::error &value)
 
string std::to_string (const ::MDBX_error_t &errcode)
 

Variables

template<typename T >
concept mdbx::MutableByteProducer
 
template<typename T >
concept mdbx::ImmutableByteProducer
 
template<typename T >
concept mdbx::SliceTranscoder
 

Detailed Description

The libmdbx C++ API header file.

Author
Copyright (c) 2020-2022, Leonid Yuriev leo@y.nosp@m.urie.nosp@m.v.ru.

Tested with:

  • Elbrus LCC >= 1.23 (http://www.mcst.ru/lcc);
  • GNU C++ >= 4.8;
  • clang >= 3.9;
  • MSVC >= 14.0 (Visual Studio 2015), but 19.2x could hang due optimizer bug;
  • AppleClang, but without C++20 concepts.

Macro Definition Documentation

◆ __has_include

#define __has_include (   header)    (0)

◆ __ORDER_BIG_ENDIAN__

#define __ORDER_BIG_ENDIAN__   4321

◆ __ORDER_LITTLE_ENDIAN__

#define __ORDER_LITTLE_ENDIAN__   1234

◆ MDBX_ASSERT_CXX20_CONCEPT_SATISFIED

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

◆ MDBX_CONSTEXPR_ASSERT

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

◆ MDBX_CXX17_CONSTEXPR

#define MDBX_CXX17_CONSTEXPR   constexpr

◆ MDBX_CXX17_FALLTHROUGH

#define MDBX_CXX17_FALLTHROUGH   [[fallthrough]]

◆ MDBX_CXX20_CONCEPT

#define MDBX_CXX20_CONCEPT (   CONCEPT,
  NAME 
)    CONCEPT NAME

◆ MDBX_CXX20_CONSTEXPR

#define MDBX_CXX20_CONSTEXPR   constexpr

◆ MDBX_CXX20_LIKELY

#define MDBX_CXX20_LIKELY   [[likely]]

◆ MDBX_CXX20_UNLIKELY

#define MDBX_CXX20_UNLIKELY   [[unlikely]]

◆ MDBX_DECLARE_EXCEPTION

#define MDBX_DECLARE_EXCEPTION (   NAME)
Value:
struct LIBMDBX_API_TYPE NAME : public exception { \
NAME(const ::mdbx::error &); \
virtual ~NAME() noexcept; \
}

◆ MDBX_IF_CONSTEXPR

#define MDBX_IF_CONSTEXPR

◆ MDBX_LIKELY

#define MDBX_LIKELY (   cond)    __builtin_expect(!!(cond), 1)

◆ MDBX_STD_FILESYSTEM_PATH

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

◆ MDBX_UNLIKELY

#define MDBX_UNLIKELY (   cond)    __builtin_expect(!!(cond), 0)

◆ NOMINMAX

#define NOMINMAX

Function Documentation

◆ to_string() [1/14]

template<class ALLOCATOR , typename CAPACITY_POLICY >
string std::to_string ( const ::mdbx::buffer< ALLOCATOR, CAPACITY_POLICY > &  buffer)
inline

◆ to_string() [2/14]

string std::to_string ( const ::mdbx::env::durability value)
inline

◆ to_string() [3/14]

string std::to_string ( const ::mdbx::env::geometry value)
inline

◆ to_string() [4/14]

string std::to_string ( const ::mdbx::env::mode value)
inline

◆ to_string() [5/14]

string std::to_string ( const ::mdbx::env::operate_options value)
inline

◆ to_string() [6/14]

string std::to_string ( const ::mdbx::env::operate_parameters value)
inline

◆ to_string() [7/14]

string std::to_string ( const ::mdbx::env::reclaiming_options value)
inline

◆ to_string() [8/14]

string std::to_string ( const ::mdbx::env_managed::create_parameters value)
inline

◆ to_string() [9/14]

string std::to_string ( const ::mdbx::error value)
inline

◆ to_string() [10/14]

string std::to_string ( const ::mdbx::pair value)
inline

◆ to_string() [11/14]

string std::to_string ( const ::mdbx::slice value)
inline

◆ to_string() [12/14]

string std::to_string ( const ::MDBX_debug_flags_t value)
inline

◆ to_string() [13/14]

string std::to_string ( const ::MDBX_error_t errcode)
inline

◆ to_string() [14/14]

string std::to_string ( const ::MDBX_log_level_t value)
inline
LIBMDBX_API_TYPE
#define LIBMDBX_API_TYPE
Definition: mdbx.h:603