28#if defined(__SIZEOF_INT128__) && !defined(__GLIBCXX_TYPE_INT_N_0) && defined(__clang__) && __clang_major__ < 4
29#define __GLIBCXX_BITSIZE_INT_N_0 128
30#define __GLIBCXX_TYPE_INT_N_0 __int128
33#if !defined(__cplusplus) || __cplusplus < 201103L
34#if !defined(_MSC_VER) || _MSC_VER < 1900
35#error "C++11 compiler or better is required"
37#error "Please add `/Zc:__cplusplus` to MSVC compiler options to enforce it conform ISO C++"
41#if (defined(_WIN32) || defined(_WIN64)) && MDBX_WITHOUT_MSVC_CRT
42#error "CRT is required for C++ API, the MDBX_WITHOUT_MSVC_CRT option must be disabled"
46#define __has_include(header) (0)
49#if __has_include(<version>)
71#if defined(__cpp_lib_memory_resource) && __cpp_lib_memory_resource >= 201603L
72#include <memory_resource>
75#if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L
79#ifndef MDBX_USING_CXX_EXPERIMETAL_FILESYSTEM
80#ifdef INCLUDE_STD_FILESYSTEM_EXPERIMENTAL
81#define MDBX_USING_CXX_EXPERIMETAL_FILESYSTEM 1
82#elif defined(__cpp_lib_filesystem) && __cpp_lib_filesystem >= 201703L && __cplusplus >= 201703L
83#define MDBX_USING_CXX_EXPERIMETAL_FILESYSTEM 0
84#elif (!defined(_MSC_VER) || __cplusplus >= 201403L || \
85 (defined(_MSC_VER) && defined(_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING) && __cplusplus >= 201403L))
86#if defined(__cpp_lib_experimental_filesystem) && __cpp_lib_experimental_filesystem >= 201406L
87#define MDBX_USING_CXX_EXPERIMETAL_FILESYSTEM 1
88#elif defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L && __has_include(<experimental/filesystem>)
89#define MDBX_USING_CXX_EXPERIMETAL_FILESYSTEM 1
91#define MDBX_USING_CXX_EXPERIMETAL_FILESYSTEM 0
94#define MDBX_USING_CXX_EXPERIMETAL_FILESYSTEM 0
98#if MDBX_USING_CXX_EXPERIMETAL_FILESYSTEM
99#include <experimental/filesystem>
100#elif defined(__cpp_lib_filesystem) && __cpp_lib_filesystem >= 201703L
104#if defined(__cpp_lib_span) && __cpp_lib_span >= 202002L
108#if !defined(_MSC_VER) || defined(__clang__)
110#define MDBX_EXTERN_API_TEMPLATE(API_ATTRIBUTES, API_TYPENAME) extern template class API_ATTRIBUTES API_TYPENAME
111#define MDBX_INSTALL_API_TEMPLATE(API_ATTRIBUTES, API_TYPENAME) template class API_TYPENAME
114#define MDBX_EXTERN_API_TEMPLATE(API_ATTRIBUTES, API_TYPENAME) extern template class API_TYPENAME
115#define MDBX_INSTALL_API_TEMPLATE(API_ATTRIBUTES, API_TYPENAME) template class API_ATTRIBUTES API_TYPENAME
118#if __cplusplus >= 201103L
125#if (defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L) || \
126 (defined(__cpp_lib_endian) && __cpp_lib_endian >= 201907L) || \
127 (defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L) || \
128 (defined(__cpp_lib_int_pow2) && __cpp_lib_int_pow2 >= 202002L)
130#elif !(defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__))
131#if defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && defined(__BIG_ENDIAN)
132#define __ORDER_LITTLE_ENDIAN__ __LITTLE_ENDIAN
133#define __ORDER_BIG_ENDIAN__ __BIG_ENDIAN
134#define __BYTE_ORDER__ __BYTE_ORDER
135#elif defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN)
136#define __ORDER_LITTLE_ENDIAN__ _LITTLE_ENDIAN
137#define __ORDER_BIG_ENDIAN__ _BIG_ENDIAN
138#define __BYTE_ORDER__ _BYTE_ORDER
140#define __ORDER_LITTLE_ENDIAN__ 1234
141#define __ORDER_BIG_ENDIAN__ 4321
142#if defined(__LITTLE_ENDIAN__) || (defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)) || defined(__ARMEL__) || \
143 defined(__THUMBEL__) || defined(__AARCH64EL__) || defined(__MIPSEL__) || defined(_MIPSEL) || defined(__MIPSEL) || \
144 defined(_M_ARM) || defined(_M_ARM64) || defined(__e2k__) || defined(__elbrus_4c__) || defined(__elbrus_8c__) || \
145 defined(__bfin__) || defined(__BFIN__) || defined(__ia64__) || defined(_IA64) || defined(__IA64__) || \
146 defined(__ia64) || defined(_M_IA64) || defined(__itanium__) || defined(__ia32__) || defined(__CYGWIN__) || \
147 defined(_WIN64) || defined(_WIN32) || defined(__TOS_WIN__) || defined(__WINDOWS__)
148#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
149#elif defined(__BIG_ENDIAN__) || (defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)) || defined(__ARMEB__) || \
150 defined(__THUMBEB__) || defined(__AARCH64EB__) || defined(__MIPSEB__) || defined(_MIPSEB) || defined(__MIPSEB) || \
151 defined(__m68k__) || defined(M68000) || defined(__hppa__) || defined(__hppa) || defined(__HPPA__) || \
152 defined(__sparc__) || defined(__sparc) || defined(__370__) || defined(__THW_370__) || defined(__s390__) || \
153 defined(__s390x__) || defined(__SYSC_ZARCH__)
154#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
161#define MDBX_CXX17_CONSTEXPR constexpr
162#elif defined(__cpp_constexpr) && __cpp_constexpr >= 201603L && \
163 ((defined(_MSC_VER) && _MSC_VER >= 1915) || (defined(__clang__) && __clang_major__ > 5) || \
164 (defined(__GNUC__) && __GNUC__ > 7) || (!defined(__GNUC__) && !defined(__clang__) && !defined(_MSC_VER)))
165#define MDBX_CXX17_CONSTEXPR constexpr
167#define MDBX_CXX17_CONSTEXPR inline
172#define MDBX_CXX20_CONSTEXPR constexpr
173#elif defined(__cpp_lib_is_constant_evaluated) && __cpp_lib_is_constant_evaluated >= 201811L && \
174 defined(__cpp_lib_constexpr_string) && __cpp_lib_constexpr_string >= 201907L
175#define MDBX_CXX20_CONSTEXPR constexpr
177#define MDBX_CXX20_CONSTEXPR inline
180#if CONSTEXPR_ENUM_FLAGS_OPERATIONS || defined(DOXYGEN)
181#define MDBX_CXX01_CONSTEXPR_ENUM MDBX_CXX01_CONSTEXPR
182#define MDBX_CXX11_CONSTEXPR_ENUM MDBX_CXX11_CONSTEXPR
183#define MDBX_CXX14_CONSTEXPR_ENUM MDBX_CXX14_CONSTEXPR
184#define MDBX_CXX17_CONSTEXPR_ENUM MDBX_CXX17_CONSTEXPR
185#define MDBX_CXX20_CONSTEXPR_ENUM MDBX_CXX20_CONSTEXPR
187#define MDBX_CXX01_CONSTEXPR_ENUM inline
188#define MDBX_CXX11_CONSTEXPR_ENUM inline
189#define MDBX_CXX14_CONSTEXPR_ENUM inline
190#define MDBX_CXX17_CONSTEXPR_ENUM inline
191#define MDBX_CXX20_CONSTEXPR_ENUM inline
195#if defined(CONSTEXPR_ASSERT)
196#define MDBX_CONSTEXPR_ASSERT(expr) CONSTEXPR_ASSERT(expr)
198#define MDBX_CONSTEXPR_ASSERT(expr) void(0)
200#define MDBX_CONSTEXPR_ASSERT(expr) ((expr) ? void(0) : [] { assert(!#expr); }())
204#if defined(DOXYGEN) || (defined(__GNUC__) || __has_builtin(__builtin_expect)) && !defined(__COVERITY__)
205#define MDBX_LIKELY(cond) __builtin_expect(!!(cond), 1)
207#define MDBX_LIKELY(x) (x)
212#if defined(DOXYGEN) || (defined(__GNUC__) || __has_builtin(__builtin_expect)) && !defined(__COVERITY__)
213#define MDBX_UNLIKELY(cond) __builtin_expect(!!(cond), 0)
215#define MDBX_UNLIKELY(x) (x)
221#define MDBX_IF_CONSTEXPR constexpr
222#elif defined(__cpp_if_constexpr) && __cpp_if_constexpr >= 201606L
223#define MDBX_IF_CONSTEXPR constexpr
225#define MDBX_IF_CONSTEXPR
228#if defined(DOXYGEN) || (__has_cpp_attribute(fallthrough) && (!defined(__clang__) || __clang__ > 4)) || \
229 __cplusplus >= 201703L
230#define MDBX_CXX17_FALLTHROUGH [[fallthrough]]
232#define MDBX_CXX17_FALLTHROUGH
235#if defined(DOXYGEN) || (__has_cpp_attribute(likely) >= 201803L && (!defined(__GNUC__) || __GNUC__ > 9))
236#define MDBX_CXX20_LIKELY [[likely]]
238#define MDBX_CXX20_LIKELY
241#ifndef MDBX_CXX20_UNLIKELY
242#if defined(DOXYGEN) || (__has_cpp_attribute(unlikely) >= 201803L && (!defined(__GNUC__) || __GNUC__ > 9))
243#define MDBX_CXX20_UNLIKELY [[unlikely]]
245#define MDBX_CXX20_UNLIKELY
249#ifndef MDBX_HAVE_CXX20_CONCEPTS
250#if defined(__cpp_concepts) && __cpp_concepts >= 202002L && defined(__cpp_lib_concepts) && __cpp_lib_concepts >= 202002L
252#define MDBX_HAVE_CXX20_CONCEPTS 1
253#elif defined(DOXYGEN)
254#define MDBX_HAVE_CXX20_CONCEPTS 1
256#define MDBX_HAVE_CXX20_CONCEPTS 0
260#ifndef MDBX_CXX20_CONCEPT
261#if MDBX_HAVE_CXX20_CONCEPTS || defined(DOXYGEN)
262#define MDBX_CXX20_CONCEPT(CONCEPT, NAME) CONCEPT NAME
264#define MDBX_CXX20_CONCEPT(CONCEPT, NAME) typename NAME
268#ifndef MDBX_ASSERT_CXX20_CONCEPT_SATISFIED
269#if MDBX_HAVE_CXX20_CONCEPTS || defined(DOXYGEN)
270#define MDBX_ASSERT_CXX20_CONCEPT_SATISFIED(CONCEPT, TYPE) static_assert(CONCEPT<TYPE>)
272#define MDBX_ASSERT_CXX20_CONCEPT_SATISFIED(CONCEPT, NAME) \
273 static_assert(true, MDBX_STRINGIFY(CONCEPT) "<" MDBX_STRINGIFY(TYPE) ">")
278#pragma warning(push, 4)
279#pragma warning(disable : 4127)
280#pragma warning(disable : 4251)
282#pragma warning(disable : 4275)
287#pragma warning(disable : 4702)
290#if defined(__LCC__) && __LCC__ >= 126
291#pragma diagnostic push
293#pragma diag_suppress 3058
295#pragma diag_suppress 3060
310#if defined(DOXYGEN) || (defined(__cpp_char8_t) && __cpp_char8_t >= 201811)
320using byte =
unsigned char;
323#if defined(__cpp_lib_endian) && __cpp_lib_endian >= 201907L
324using endian = ::std::endian;
325#elif defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__)
326enum class endian { little = __ORDER_LITTLE_ENDIAN__, big = __ORDER_BIG_ENDIAN__, native = __BYTE_ORDER__ };
328#error "Please use a C++ compiler provides byte order information or C++20 support"
352#if defined(DOXYGEN) || \
353 (defined(__cpp_lib_memory_resource) && __cpp_lib_memory_resource >= 201603L && _GLIBCXX_USE_CXX11_ABI)
363template <
class ALLOCATOR = default_allocator,
class CAPACITY_POLICY = default_capacity_policy>
class buffer;
378template <
class ALLOCATOR = default_allocator>
379using string = ::std::basic_string<char, ::std::char_traits<char>, ALLOCATOR>;
382#if MDBX_USING_CXX_EXPERIMETAL_FILESYSTEM
384namespace filesystem = ::std::experimental::filesystem::v1;
386namespace filesystem = ::std::experimental::filesystem;
388#define MDBX_STD_FILESYSTEM_PATH ::mdbx::filesystem::path
389#elif defined(DOXYGEN) || \
390 (defined(__cpp_lib_filesystem) && __cpp_lib_filesystem >= 201703L && defined(__cpp_lib_string_view) && \
391 __cpp_lib_string_view >= 201606L && \
392 (!defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500) && \
393 (!defined(__IPHONE_OS_VERSION_MIN_REQUIRED) || __IPHONE_OS_VERSION_MIN_REQUIRED >= 130100)) && \
394 (!defined(_MSC_VER) || __cplusplus >= 201703L)
395namespace filesystem = ::std::filesystem;
401#define MDBX_STD_FILESYSTEM_PATH ::mdbx::filesystem::path
404#ifdef MDBX_STD_FILESYSTEM_PATH
406#elif defined(_WIN32) || defined(_WIN64)
407using path = ::std::wstring;
409using path = ::std::string;
412#if defined(__SIZEOF_INT128__) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 128)
413#ifndef MDBX_U128_TYPE
414#define MDBX_U128_TYPE __uint128_t
416#ifndef MDBX_I128_TYPE
417#define MDBX_I128_TYPE __int128_t
421#if __cplusplus >= 201103L || defined(DOXYGEN)
423using duration = ::std::chrono::duration<unsigned, ::std::ratio<1, 65536>>;
434 ::std::exception_ptr captured_;
442 inline
bool is_clean() const noexcept;
443 inline
void capture() noexcept;
471 const
char *
what() const noexcept;
479 [[noreturn]]
void panic(const
char *context_where_when, const
char *func_who_what) const noexcept;
485 inline
void panic_on_failure(const
char *context_where, const
char *func_who) const noexcept;
486 inline
void success_or_panic(const
char *context_where, const
char *func_who) const noexcept;
490 static inline void throw_on_failure(
int error_code);
491 static inline bool boolean_or_throw(
int error_code);
492 static inline void success_or_throw(
int error_code,
const exception_thunk &);
493 static inline bool boolean_or_throw(
int error_code,
const exception_thunk &);
494 static inline void panic_on_failure(
int error_code,
const char *context_where,
const char *func_who)
noexcept;
495 static inline void success_or_panic(
int error_code,
const char *context_where,
const char *func_who)
noexcept;
501 using base = ::std::runtime_error;
519 fatal(const ::mdbx::error &)
noexcept;
529#define MDBX_DECLARE_EXCEPTION(NAME) \
530 struct LIBMDBX_API_TYPE NAME : public exception { \
531 NAME(const ::mdbx::error &); \
532 virtual ~NAME() noexcept; \
566#undef MDBX_DECLARE_EXCEPTION
576static MDBX_CXX14_CONSTEXPR size_t check_length(
size_t headroom,
size_t payload,
size_t tailroom);
585#if MDBX_HAVE_CXX20_CONCEPTS || defined(DOXYGEN)
592 { a.is_empty() } -> std::same_as<bool>;
593 { a.envisage_result_length() } -> std::same_as<size_t>;
594 { a.write_bytes(&array[0],
size_t(42)) } -> std::same_as<char *>;
602 { a.is_empty() } -> std::same_as<bool>;
603 { a.envisage_result_length() } -> std::same_as<size_t>;
604 { a.write_bytes(&array[0],
size_t(42)) } -> std::same_as<char *>;
613 { a.is_erroneous() } -> std::same_as<bool>;
626template <
class ALLOCATOR = default_allocator, MDBX_CXX20_CONCEPT(MutableByteProducer, PRODUCER)>
629template <
class ALLOCATOR = default_allocator, MDBX_CXX20_CONCEPT(ImmutableByteProducer, PRODUCER)>
664 template <
class CHAR,
class T,
class A>
673#if defined(DOXYGEN) || (defined(__cpp_lib_span) && __cpp_lib_span >= 202002L)
675 static_assert(::std::is_standard_layout<POD>::value && !::std::is_pointer<POD>::value,
676 "Must be a standard layout type!");
679 template <
typename POD> MDBX_CXX14_CONSTEXPR ::std::span<const POD>
as_span()
const {
680 static_assert(::std::is_standard_layout<POD>::value && !::std::is_pointer<POD>::value,
681 "Must be a standard layout type!");
684 return ::std::span<const POD>(
static_cast<const POD *
>(
data()),
size() /
sizeof(POD));
688 template <
typename POD> MDBX_CXX14_CONSTEXPR ::std::span<POD>
as_span() {
689 static_assert(::std::is_standard_layout<POD>::value && !::std::is_pointer<POD>::value,
690 "Must be a standard layout type!");
693 return ::std::span<POD>(
static_cast<POD *
>(
data()),
size() /
sizeof(POD));
703#if defined(DOXYGEN) || (defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L)
705 template <
class CHAR,
class T>
708 template <
class CHAR,
class T>
slice(::std::basic_string_view<CHAR, T> &&sv) :
slice(sv) { sv = {}; }
714 static_assert(::std::is_standard_layout<POD>::value && !::std::is_pointer<POD>::value,
715 "Must be a standard layout type!");
716 return slice(&pod,
sizeof(pod));
719 inline slice &assign(
const void *ptr,
size_t bytes);
720 inline slice &assign(
const slice &src)
noexcept;
721 inline slice &assign(const ::MDBX_val &src);
724 inline slice &assign(
const void *begin,
const void *end);
725 template <
class CHAR,
class T,
class ALLOCATOR>
slice &
assign(const ::std::basic_string<CHAR, T, ALLOCATOR> &str) {
726 return assign(str.data(), str.length() *
sizeof(CHAR));
728 inline slice &assign(
const char *c_str);
729#if defined(DOXYGEN) || (defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L)
730 template <
class CHAR,
class T>
slice &
assign(const ::std::basic_string_view<CHAR, T> &view) {
731 return assign(view.begin(), view.end());
733 template <
class CHAR,
class T>
slice &
assign(::std::basic_string_view<CHAR, T> &&view) {
744 operator const MDBX_val *()
const noexcept {
return this; }
746#if defined(DOXYGEN) || (defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L)
747 template <
class CHAR,
class T>
slice &
operator=(const ::std::basic_string_view<CHAR, T> &view) {
751 template <
class CHAR,
class T>
slice &
operator=(::std::basic_string_view<CHAR, T> &&view) {
return assign(view); }
754 template <
class CHAR =
char,
class T = ::std::
char_traits<CHAR>>
755 MDBX_CXX11_CONSTEXPR ::std::basic_string_view<CHAR, T>
string_view() const noexcept {
756 static_assert(
sizeof(CHAR) == 1,
"Must be single byte characters");
761 template <
class CHAR,
class T>
767 template <
class CHAR =
char,
class T = ::std::
char_traits<CHAR>,
class ALLOCATOR = default_allocator>
768 MDBX_CXX20_CONSTEXPR ::std::basic_string<CHAR, T, ALLOCATOR>
as_string(
const ALLOCATOR &alloc = ALLOCATOR())
const {
769 static_assert(
sizeof(CHAR) == 1,
"Must be single byte characters");
770 return ::std::basic_string<CHAR, T, ALLOCATOR>(
char_ptr(),
length(), alloc);
773 template <
class CHAR,
class T,
class ALLOCATOR>
779 template <
class ALLOCATOR = default_allocator>
780 inline string<ALLOCATOR> as_hex_string(
bool uppercase =
false,
unsigned wrap_width = 0,
781 const ALLOCATOR &alloc = ALLOCATOR())
const;
785 template <
class ALLOCATOR = default_allocator>
786 inline string<ALLOCATOR> as_base58_string(
unsigned wrap_width = 0,
const ALLOCATOR &alloc = ALLOCATOR())
const;
790 template <
class ALLOCATOR = default_allocator>
791 inline string<ALLOCATOR> as_base64_string(
unsigned wrap_width = 0,
const ALLOCATOR &alloc = ALLOCATOR())
const;
794 template <
class ALLOCATOR = default_allocator,
class CAPACITY_POLICY = default_capacity_policy>
796 const ALLOCATOR &alloc = ALLOCATOR())
const;
800 template <
class ALLOCATOR = default_allocator,
class CAPACITY_POLICY = default_capacity_policy>
802 const ALLOCATOR &alloc = ALLOCATOR())
const;
806 template <
class ALLOCATOR = default_allocator,
class CAPACITY_POLICY = default_capacity_policy>
808 const ALLOCATOR &alloc = ALLOCATOR())
const;
811 template <
class ALLOCATOR = default_allocator,
class CAPACITY_POLICY = default_capacity_policy>
813 const ALLOCATOR &alloc = ALLOCATOR())
const;
817 template <
class ALLOCATOR = default_allocator,
class CAPACITY_POLICY = default_capacity_policy>
819 const ALLOCATOR &alloc = ALLOCATOR())
const;
823 template <
class ALLOCATOR = default_allocator,
class CAPACITY_POLICY = default_capacity_policy>
825 const ALLOCATOR &alloc = ALLOCATOR())
const;
854#if defined(DOXYGEN) || (defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L)
855 template <
class CHAR,
class T>
void swap(::std::basic_string_view<CHAR, T> &view)
noexcept {
856 static_assert(
sizeof(CHAR) == 1,
"Must be single byte characters");
857 const auto temp = ::std::basic_string_view<CHAR, T>(*
this);
916 inline
void remove_prefix(
size_t n) noexcept;
920 inline
void remove_suffix(
size_t n) noexcept;
924 inline
void safe_remove_prefix(
size_t n);
928 inline
void safe_remove_suffix(
size_t n);
990 const
slice &b) noexcept;
997#if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L
1006 return slice( ~
size_t(0));
1013 static_assert(::std::is_standard_layout<POD>::value && !::std::is_pointer<POD>::value,
1014 "Must be a standard layout type!");
1018 memcpy(&r,
data(),
sizeof(r));
1024#ifdef MDBX_U128_TYPE
1032#ifdef MDBX_I128_TYPE
1040#ifdef MDBX_U128_TYPE
1048#ifdef MDBX_I128_TYPE
1065#if defined(__cpp_lib_allocator_traits_is_always_equal) && __cpp_lib_allocator_traits_is_always_equal >= 201411L
1066 return ::std::allocator_traits<A>::is_always_equal::value;
1068 return ::std::is_empty<A>::value;
1072template <
typename T,
typename A =
typename T::allocator_type,
1073 bool PoCMA = ::std::allocator_traits<A>::propagate_on_container_move_assignment::value>
1084template <
typename T,
typename A>
struct move_assign_alloc<T, A, true> {
1085 static constexpr bool is_nothrow() noexcept {
1086 return allocator_is_always_equal<A>() || ::std::is_nothrow_move_assignable<A>::value;
1088 static constexpr bool is_moveable(T *, T &)
noexcept {
return true; }
1090 target->get_allocator() = ::std::move(source.get_allocator());
1094template <
typename T,
typename A =
typename T::allocator_type,
1095 bool PoCCA = ::std::allocator_traits<A>::propagate_on_container_copy_assignment::value>
1099 static constexpr bool is_nothrow() noexcept {
return false; }
1103template <
typename T,
typename A>
struct copy_assign_alloc<T, A, true> {
1104 static constexpr bool is_nothrow() noexcept {
1105 return allocator_is_always_equal<A>() || ::std::is_nothrow_copy_assignable<A>::value;
1107 static MDBX_CXX20_CONSTEXPR void propagate(T *target,
const T &source)
noexcept(is_nothrow()) {
1109 if (
MDBX_UNLIKELY(target->get_allocator() != source.get_allocator()))
1110 MDBX_CXX20_UNLIKELY target->get_allocator() =
1111 ::std::allocator_traits<A>::select_on_container_copy_construction(source.get_allocator());
1120template <
typename T,
typename A =
typename T::allocator_type,
1121 bool PoCS = ::std::allocator_traits<A>::propagate_on_container_swap::value>
1124template <
typename T,
typename A>
struct swap_alloc<T, A, false> {
1128 if (
MDBX_UNLIKELY(left.get_allocator() != right.get_allocator()))
1138template <
typename T,
typename A>
struct swap_alloc<T, A, true> {
1139 static constexpr bool is_nothrow() noexcept {
1140 return allocator_is_always_equal<A>() ||
1141#if defined(__cpp_lib_is_swappable) && __cpp_lib_is_swappable >= 201603L
1142 ::std::is_nothrow_swappable<A>() ||
1144 (::std::is_nothrow_move_constructible<A>::value && ::std::is_nothrow_move_assignable<A>::value);
1148 if (
MDBX_UNLIKELY(left.get_allocator() != right.get_allocator()))
1149 MDBX_CXX20_UNLIKELY ::std::swap(left.get_allocator(), right.get_allocator());
1171 static_assert(
pettiness_threshold >=
sizeof(uint64_t),
"pettiness_threshold must be > 7");
1180 if (wanna <= inplace && (current <= inplace || current >= std::max(inplace + inplace,
size_t(
pettiness_threshold))))
1183 if (wanna > current)
1187 if (current - wanna >
1191 return round(wanna);
1209 template <
class ALLOCATOR = default_allocator>
1215 template <
class ALLOCATOR = default_allocator,
typename CAPACITY_POLICY = default_capacity_policy>
1223 const size_t bytes =
source.length() << 1;
1233 ::std::ostream &
output(::std::ostream &out)
const;
1256 template <
class ALLOCATOR = default_allocator>
1263 template <
class ALLOCATOR = default_allocator,
typename CAPACITY_POLICY = default_capacity_policy>
1271 const size_t bytes = (
source.length() * 11 + 7) / 8;
1281 ::std::ostream &
output(::std::ostream &out)
const;
1302 template <
class ALLOCATOR = default_allocator>
1309 template <
class ALLOCATOR = default_allocator,
typename CAPACITY_POLICY = default_capacity_policy>
1317 const size_t bytes = (
source.length() + 2) / 3 * 4;
1329 ::std::ostream &
output(::std::ostream &out)
const;
1354 template <
class ALLOCATOR = default_allocator>
1360 template <
class ALLOCATOR = default_allocator,
typename CAPACITY_POLICY = default_capacity_policy>
1393 template <
class ALLOCATOR = default_allocator>
1400 template <
class ALLOCATOR = default_allocator,
typename CAPACITY_POLICY = default_capacity_policy>
1436 template <
class ALLOCATOR = default_allocator>
1443 template <
class ALLOCATOR = default_allocator,
typename CAPACITY_POLICY = default_capacity_policy>
1474#if !defined(_MSC_VER) || _MSC_VER > 1900
1475 using allocator_type = typename ::std::allocator_traits<ALLOCATOR>::template rebind_alloc<uint64_t>;
1477 using allocator_type =
typename ALLOCATOR::template rebind<uint64_t>::other;
1487 ?
alignof(max_align_t) * 2
1498 using allocator_pointer =
typename allocator_traits::pointer;
1499 using allocator_const_pointer =
typename allocator_traits::const_pointer;
1501 MDBX_CXX20_CONSTEXPR ::std::pair<allocator_pointer, size_t> allocate_storage(
size_t bytes) {
1502 assert(bytes >=
sizeof(bin));
1503 constexpr size_t unit =
sizeof(
typename allocator_type::value_type);
1504 static_assert((unit & (unit - 1)) == 0,
"size of ALLOCATOR::value_type should be a power of 2");
1505 static_assert(unit > 0,
"size of ALLOCATOR::value_type must be > 0");
1506 const size_t n = (bytes + unit - 1) / unit;
1507 return ::std::make_pair(allocator_traits::allocate(get_allocator(), n), n * unit);
1511 constexpr size_t unit =
sizeof(
typename allocator_type::value_type);
1512 assert(ptr && bytes >=
sizeof(bin) && bytes >= unit && bytes % unit == 0);
1513 allocator_traits::deallocate(get_allocator(), ptr, bytes / unit);
1516 MDBX_CXX20_CONSTEXPR ::std::pair<allocator_pointer, size_t> provide_storage(
size_t bytes) {
1517 const size_t capacity = bin::advise_capacity(0, bytes);
1518 return bin::is_suitable_for_inplace(capacity) ? ::std::pair<allocator_pointer, size_t>(
nullptr, capacity)
1519 : allocate_storage(capacity);
1523#if defined(__cpp_lib_to_address) && __cpp_lib_to_address >= 201711L
1524 return static_cast<void *
>(::std::to_address(ptr));
1526 return static_cast<void *
>(::std::addressof(*ptr));
1531#if defined(__cpp_lib_to_address) && __cpp_lib_to_address >= 201711L
1532 return static_cast<const void *
>(::std::to_address(ptr));
1534 return static_cast<const void *
>(::std::addressof(*ptr));
1538 union alignas(max_align_t)
bin {
1549 << (
sizeof(
size_t ) - 1) * CHAR_BIT,
1572 static_assert((size_t(reservation_policy::inplace_storage_size_rounding) &
1573 (size_t(reservation_policy::inplace_storage_size_rounding) - 1)) == 0,
1574 "CAPACITY_POLICY::inplace_storage_size_rounding must be power of 2");
1581 static_assert(std::numeric_limits<size_t>::max() - (std::numeric_limits<size_t>::max() >> CHAR_BIT) ==
1599 template <
bool construct_ptr>
1602 if (construct_ptr) {
1615 if (::std::is_trivial<allocator_pointer>::value)
1624 const size_t advised = reservation_policy::advise(current, wanna,
inplace_capacity());
1625 assert(advised >= wanna);
1642 constexpr bool is_inplace(
const void *ptr)
const noexcept {
return bin_.is_inplace(ptr); }
1645 if (bin_.is_allocated()) {
1646 deallocate_storage(bin_.allocated_ptr_, bin_.capacity_.bytes_);
1648 bin_.allocated_ptr_.~allocator_pointer();
1649 bin_.inplace_.lastbyte_ = bin::lastbyte_inplace_signature;
1653 template <
bool external_content>
1655 const void *
const content,
const size_t length) {
1656 assert(wanna_capacity >= wanna_headroom + length);
1657 const size_t old_capacity = bin_.capacity();
1658 const size_t new_capacity = bin::advise_capacity(old_capacity, wanna_capacity);
1661 assert(bin_.is_inplace() == bin::is_suitable_for_inplace(new_capacity));
1662 byte *
const new_place = bin_.address() + wanna_headroom;
1665 if (external_content)
1666 memcpy(new_place, content, length);
1668 const size_t old_headroom = bin_.address() -
static_cast<const byte *
>(content);
1669 assert(old_capacity >= old_headroom + length);
1671 MDBX_CXX20_UNLIKELY ::std::memmove(new_place, content, length);
1677 if (bin::is_suitable_for_inplace(new_capacity)) {
1678 assert(bin_.is_allocated());
1679 const auto old_allocated = ::std::move(bin_.allocated_ptr_);
1680 byte *
const new_place = bin_.template make_inplace<true>() + wanna_headroom;
1683 deallocate_storage(old_allocated, old_capacity);
1687 if (bin_.is_inplace()) {
1688 const auto pair = allocate_storage(new_capacity);
1689 assert(pair.second >= new_capacity);
1690 byte *
const new_place =
static_cast<byte *
>(to_address(pair.first)) + wanna_headroom;
1693 bin_.template make_allocated<true>(pair);
1697 const auto old_allocated = ::std::move(bin_.allocated_ptr_);
1698 if (external_content)
1699 deallocate_storage(old_allocated, old_capacity);
1700 const auto pair = allocate_storage(new_capacity);
1701 assert(pair.second >= new_capacity);
1702 byte *
const new_place = bin_.template make_allocated<false>(pair) + wanna_headroom;
1705 if (!external_content)
1706 deallocate_storage(old_allocated, old_capacity);
1711 assert(capacity() >= offset);
1712 return bin_.address() + offset;
1715 assert(capacity() >= offset);
1716 return bin_.address() + offset;
1719 assert(capacity() >= offset + length);
1720 return static_cast<byte *
>(memcpy(get(offset), ptr, length));
1725 MDBX_CXX20_CONSTEXPR silo(
const allocator_type &alloc = allocator_type()) noexcept : allocator_type(alloc) {}
1726 MDBX_CXX20_CONSTEXPR silo(
size_t capacity,
const allocator_type &alloc = allocator_type()) : silo(alloc) {
1727 if (!bin::is_suitable_for_inplace(capacity))
1728 bin_.template make_allocated<true>(provide_storage(capacity));
1731 silo(silo &&other) =
delete;
1733 silo(silo &&other,
bool is_reference =
false) noexcept(::std::is_nothrow_move_constructible<allocator_type>::value)
1734 : allocator_type(::std::move(other.get_allocator())) {
1735 if (!is_reference) {
1736 if (other.bin_.is_inplace()) {
1737 memcpy(&bin_, &other.bin_,
sizeof(bin));
1740 new (&bin_.allocated_ptr_) allocator_pointer(::std::move(other.bin_.allocated_ptr_));
1741 bin_.capacity_.bytes_ = other.bin_.capacity_.bytes_;
1749 other.bin_.allocated_ptr_.~allocator_pointer();
1750 other.bin_.inplace_.lastbyte_ = bin::lastbyte_inplace_signature;
1757 if (other.bin_.is_inplace()) {
1758 memcpy(&bin_, &other.bin_,
sizeof(bin));
1762 new (&bin_.allocated_ptr_) allocator_pointer(::std::move(other.bin_.allocated_ptr_));
1763 bin_.capacity_.bytes_ = other.bin_.capacity_.bytes_;
1771 other.bin_.allocated_ptr_.~allocator_pointer();
1772 other.bin_.inplace_.lastbyte_ = bin::lastbyte_inplace_signature;
1779 if (!allocation_aware_details::move_assign_alloc<silo, allocator_type>::is_moveable(
this, other))
1780 allocation_aware_details::move_assign_alloc<silo, allocator_type>::propagate(
this, other);
1781 return is_reference ? false : move(std::move(other));
1785 exchange(silo &left,
const bool left_is_reference, silo &right,
const bool right_is_reference)
noexcept(
1786 allocation_aware_details::swap_alloc<silo, allocator_type>::is_nothrow()) {
1787 allocation_aware_details::swap_alloc<silo, allocator_type>::propagate(left, right);
1788 bool left_need_fixup =
false, right_need_fixup =
false;
1789 if (left_is_reference || right_is_reference) {
1790 left_need_fixup = !right_is_reference && left.move(std::move(right));
1791 right_need_fixup = !left_is_reference && right.move(std::move(left));
1793 silo temp(std::move(left),
false);
1794 left_need_fixup = left.move(std::move(right));
1795 right_need_fixup = right.move(std::move(temp));
1797 return std::make_pair(left_need_fixup, right_need_fixup);
1801 const allocator_type &alloc = allocator_type())
1802 : silo(capacity, alloc) {
1803 assert(capacity >= headroom + length);
1805 put(headroom, ptr, length);
1808 MDBX_CXX20_CONSTEXPR silo(
const void *ptr,
size_t length,
const allocator_type &alloc = allocator_type())
1809 : silo(length, 0, ptr, length, alloc) {}
1811 ~silo() { release(); }
1815 MDBX_CXX20_CONSTEXPR void *assign(
size_t headroom,
const void *ptr,
size_t length,
size_t tailroom) {
1816 return reshape<true>(headroom + length + tailroom, headroom, ptr, length);
1819 MDBX_CXX20_CONSTEXPR void *assign(
const void *ptr,
size_t length) {
return assign(0, ptr, length, 0); }
1823 return reshape<false>(whole_capacity, headroom,
nullptr, 0);
1827 content.iov_base = reshape<false>(capacity, headroom, content.iov_base, content.iov_len);
1838 auto ptr = inherited::byte_ptr();
1839 if (src.is_inplace(ptr)) {
1841 intptr_t offset = &silo_.bin_.inplace_.buffer_[0] - &src.inplace_.buffer_[0];
1842 iov_base = ptr + offset;
1850 assert(is_reference());
1851 iov_base = silo_.assign(iov_base, iov_len);
1855 return static_cast<const byte *
>(silo_.data());
1859 return silo_begin() + silo_.capacity();
1862 struct data_preserver :
public exception_thunk {
1864 data_preserver(allocator_type &alloc) : data(alloc) {}
1865 static int callback(
void *context,
MDBX_val *target,
const void *src,
size_t bytes)
noexcept {
1866 auto self =
static_cast<data_preserver *
>(context);
1867 assert(self->is_clean());
1868 assert(&self->data == target);
1871 self->data.assign(src, bytes,
false);
2023 if (!make_reference)
2031 template <
class CHAR,
class T,
class A>
buffer(const ::std::basic_string<CHAR, T, A> &) =
delete;
2032 template <
class CHAR,
class T,
class A>
buffer(const ::std::basic_string<CHAR, T, A> &&) =
delete;
2037#if defined(DOXYGEN) || (defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L)
2038 template <
class CHAR,
class T>
2056 template <
class CHAR,
class T,
class A>
2064#if defined(DOXYGEN) || (defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L)
2065 template <
class CHAR,
class T>
2072 : silo_(check_length(head_room, tail_room), alloc) {
2073 iov_base = silo_.get();
2074 assert(iov_len == 0);
2078 iov_base = silo_.get();
2079 assert(iov_len == 0);
2083 : silo_(check_length(head_room, src.
length(), tail_room), alloc) {
2084 iov_base = memcpy(silo_.get(), src.
data(), iov_len = src.
length());
2096 fixup_import(src.silo_.bin_);
2106 template <
typename POD>
2112 static buffer hex(
const slice &source,
bool uppercase =
false,
unsigned wrap_width = 0,
2129 template <
typename POD>
2130 static buffer hex(
const POD &pod,
bool uppercase =
false,
unsigned wrap_width = 0,
2137 template <
typename POD>
2144 template <
typename POD>
2189 return hex_decode(*
this, ignore_spaces, alloc);
2205 void reserve(
size_t wanna_headroom,
size_t wanna_tailroom) {
2206 wanna_headroom = ::std::min(
2207 ::std::max(
headroom(), wanna_headroom),
2209 wanna_tailroom = ::std::min(
2210 ::std::max(
tailroom(), wanna_tailroom),
2212 const size_t wanna_capacity = check_length(wanna_headroom,
length(), wanna_tailroom);
2213 silo_.resize(wanna_capacity, wanna_headroom, *
this);
2236 const auto pair = silo::exchange(silo_,
is_reference(), other.silo_, other.is_reference());
2237 std::swap(iov_base, other.iov_base);
2238 std::swap(iov_len, other.iov_len);
2240 fixup_import(other.silo_.bin_);
2242 other.fixup_import(silo_.bin_);
2260 if MDBX_IF_CONSTEXPR (!allocation_aware_details::template allocator_is_always_equal<allocator_type>()) {
2261 if (
MDBX_UNLIKELY(silo_.get_allocator() != src.silo_.get_allocator()))
2262 MDBX_CXX20_UNLIKELY {
2268 iov_base = silo_.template reshape<true>(whole_capacity,
headroom, src.
data(), src.
length());
2275 if MDBX_IF_CONSTEXPR (!allocation_aware_details::template allocator_is_always_equal<allocator_type>()) {
2276 if (
MDBX_UNLIKELY(silo_.get_allocator() != src.silo_.get_allocator()))
2277 MDBX_CXX20_UNLIKELY {
2283 if (make_reference) {
2285 iov_base = src.iov_base;
2287 iov_base = silo_.template reshape<true>(src.
length(), 0, src.
data(), src.
length());
2297 if (silo_.assign_move(std::move(src.silo_),
is_reference))
2298 fixup_import(src.silo_.bin_);
2311 return assign(src.iov_base, src.iov_len, make_reference);
2321 assign(src.iov_base, src.iov_len, make_reference);
2322 src.iov_base =
nullptr;
2327 return assign(begin,
static_cast<const byte *
>(
end) -
static_cast<const byte *
>(begin), make_reference);
2330 template <
class CHAR,
class T,
class A>
2331 buffer &
assign(const ::std::basic_string<CHAR, T, A> &str,
bool make_reference =
false) {
2332 return assign(str.data(), str.length(), make_reference);
2336 return assign(c_str, strlen(c_str), make_reference);
2339#if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L
2340 template <
class CHAR,
class T>
2341 buffer &assign(const ::std::basic_string_view<CHAR, T> &view,
bool make_reference =
false) {
2342 return assign(view.data(), view.length(), make_reference);
2345 template <
class CHAR,
class T> buffer &assign(::std::basic_string_view<CHAR, T> &&view,
bool make_reference =
false) {
2346 assign(view.data(), view.length(), make_reference);
2360#if defined(DOXYGEN) || (defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L)
2361 template <
class CHAR,
class T>
buffer &
operator=(const ::std::basic_string_view<CHAR, T> &view)
noexcept {
2362 return assign(view.begin(), view.length());
2366 template <
class CHAR,
class T,
class A>
2411 const size_t wanna_bytes = producer.envisage_result_length();
2418 const size_t wanna_bytes = producer.envisage_result_length();
2462 ptr[0] = uint8_t(u16);
2463 ptr[1] = uint8_t(u16 >> 8);
2472 ptr[0] = uint8_t(u24);
2473 ptr[1] = uint8_t(u24 >> 8);
2474 ptr[2] = uint8_t(u24 >> 16);
2483 ptr[0] = uint8_t(u32);
2484 ptr[1] = uint8_t(u32 >> 8);
2485 ptr[2] = uint8_t(u32 >> 16);
2486 ptr[3] = uint8_t(u32 >> 24);
2495 ptr[0] = uint8_t(u48);
2496 ptr[1] = uint8_t(u48 >> 8);
2497 ptr[2] = uint8_t(u48 >> 16);
2498 ptr[3] = uint8_t(u48 >> 24);
2499 ptr[4] = uint8_t(u48 >> 32);
2500 ptr[5] = uint8_t(u48 >> 40);
2509 ptr[0] = uint8_t(u64);
2510 ptr[1] = uint8_t(u64 >> 8);
2511 ptr[2] = uint8_t(u64 >> 16);
2512 ptr[3] = uint8_t(u64 >> 24);
2513 ptr[4] = uint8_t(u64 >> 32);
2514 ptr[5] = uint8_t(u64 >> 40);
2515 ptr[6] = uint8_t(u64 >> 48);
2516 ptr[7] = uint8_t(u64 >> 56);
2523 template <
size_t SIZE>
static buffer key_from(
const char (&text)[SIZE],
bool make_reference =
true) {
2527#if defined(DOXYGEN) || (defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L)
2528 template <
class CHAR,
class T>
2529 static buffer key_from(const ::std::basic_string_view<CHAR, T> &src,
bool make_reference =
false) {
2530 return buffer(src, make_reference);
2536 template <
class CHAR,
class T,
class A>
2537 static buffer key_from(const ::std::basic_string<CHAR, T, A> &src,
bool make_reference =
false) {
2538 return buffer(src, make_reference);
2578template <
class ALLOCATOR,
class CAPACITY_POLICY, MDBX_CXX20_CONCEPT(MutableByteProducer, PRODUCER)>
2589template <
class ALLOCATOR,
class CAPACITY_POLICY, MDBX_CXX20_CONCEPT(ImmutableByteProducer, PRODUCER)>
2600template <
class ALLOCATOR, MDBX_CXX20_CONCEPT(MutableByteProducer, PRODUCER)>
2605 result.resize(producer.envisage_result_length());
2606 result.resize(producer.write_bytes(
const_cast<char *
>(result.data()), result.capacity()) - result.data());
2611template <
class ALLOCATOR, MDBX_CXX20_CONCEPT(ImmutableByteProducer, PRODUCER)>
2616 result.resize(producer.envisage_result_length());
2617 result.resize(producer.write_bytes(
const_cast<char *
>(result.data()), result.capacity()) - result.data());
2624#if defined(__cpp_lib_memory_resource) && __cpp_lib_memory_resource >= 201603L && _GLIBCXX_USE_CXX11_ABI
2661 const pair &b)
noexcept;
2668#if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L
2693 using stl_pair = ::std::pair<buffer_type, buffer_type>;
2736 return key.is_freestanding() &&
value.is_freestanding();
2741 return key.is_reference() ||
value.is_reference();
2747 key.make_freestanding();
2748 value.make_freestanding();
2755template <
typename BUFFER>
2814#if CONSTEXPR_ENUM_FLAGS_OPERATIONS || defined(DOXYGEN)
2896 operator bool() const noexcept {
return dbi != 0; }
2899#if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L
2901 return a.dbi <=> b.dbi;
2905 return a.dbi == b.dbi;
2908 return a.dbi < b.dbi;
2911 return a.dbi > b.dbi;
2914 return a.dbi <= b.dbi;
2917 return a.dbi >= b.dbi;
2920 return a.dbi != b.dbi;
2969 env &operator=(const
env &) noexcept = default;
2970 inline
env &operator=(
env &&) noexcept;
2971 inline
env(
env &&) noexcept;
2972 inline ~
env() noexcept;
2995#if INTPTR_MAX > 0x7fffFFFFl
3003#if INTPTR_MAX > 0x7fffFFFFl
3049 inline geometry &make_fixed(intptr_t size)
noexcept;
3050 inline geometry &make_dynamic(intptr_t lower = default_value, intptr_t upper = default_value)
noexcept;
3140 bool use_subdirectory =
false
3176 static inline
size_t dbsize_min(intptr_t pagesize);
3178 static inline
size_t dbsize_max(intptr_t pagesize);
3257#ifdef MDBX_STD_FILESYSTEM_PATH
3260#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
3261 env &
copy(const ::std::wstring &destination,
bool compactify,
bool force_dynamic_size =
false);
3262 env &
copy(
const wchar_t *destination,
bool compactify,
bool force_dynamic_size =
false);
3264 env &
copy(const ::std::string &destination,
bool compactify,
bool force_dynamic_size =
false);
3265 env &
copy(
const char *destination,
bool compactify,
bool force_dynamic_size =
false);
3287#ifdef MDBX_STD_FILESYSTEM_PATH
3290#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
3310 inline info get_info()
const;
3313 inline stat get_stat(
const txn &)
const;
3316 inline info get_info(
const txn &)
const;
3364#if __cplusplus >= 201103L || defined(DOXYGEN)
3451 inline env &set_extra_option(extra_runtime_option option, uint64_t value);
3454 inline uint64_t extra_option(extra_runtime_option option)
const;
3460 inline env &set_geometry(
const geometry &size);
3465 inline bool sync_to_disk(
bool force =
true,
bool nonblock =
false);
3514 size_t used,
size_t retained)
noexcept;
3580 using inherited =
env;
3589#ifdef MDBX_STD_FILESYSTEM_PATH
3592#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
3611#ifdef MDBX_STD_FILESYSTEM_PATH
3613 bool accede =
true);
3615#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
3617 bool accede =
true);
3619 bool accede =
true);
3642 MDBX_CXX20_UNLIKELY {
3643 assert(
handle_ != other.handle_);
3670 txn &operator=(const
txn &) noexcept = default;
3671 inline
txn &operator=(
txn &&) noexcept;
3672 inline
txn(
txn &&) noexcept;
3673 inline ~
txn() noexcept;
3686 inline uint64_t
id() const;
3695 inline
bool is_dirty(const
void *ptr) const;
3708 inline info get_info(
bool scan_reader_lock_table =
false)
const;
3717 return size_t(
get_info().txn_space_dirty);
3723 inline void reset_reading();
3726 inline void renew_reading();
3729 inline void make_broken();
3732 inline void park_reading(
bool autounpark =
true);
3736 inline bool unpark_reading(
bool restart_if_ousted =
true);
3764 inline map_handle open_map_accede(
const char *name)
const;
3766 inline map_handle open_map_accede(const ::std::string &name)
const;
3785 bool drop_map(
const char *name,
bool throw_if_absent =
false);
3789 inline bool drop_map(const ::std::string &name,
bool throw_if_absent =
false);
3799 bool clear_map(
const char *name,
bool throw_if_absent =
false);
3802 inline bool clear_map(const ::std::string &name,
bool throw_if_absent =
false);
3816 bool rename_map(
const char *old_name,
const char *new_name,
bool throw_if_absent =
false);
3820 bool rename_map(const ::std::string &old_name, const ::std::string &new_name,
bool throw_if_absent =
false);
3826#if defined(DOXYGEN) || (defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L)
3844 bool drop_map(const ::std::string_view &name,
bool throw_if_absent =
false) {
3849 bool clear_map(const ::std::string_view &name,
bool throw_if_absent =
false) {
3857 bool rename_map(const ::std::string_view &old_name, const ::std::string_view &new_name,
3858 bool throw_if_absent =
false) {
3939 template <
class ALLOCATOR,
typename CAPACITY_POLICY>
3946 template <
class ALLOCATOR,
typename CAPACITY_POLICY>
3952 template <
class ALLOCATOR,
typename CAPACITY_POLICY>
3974 inline void append(
map_handle map,
const slice &key,
const slice &value,
bool multivalue_order_preserved =
true);
3976 return append(map, kv.
key, kv.
value, multivalue_order_preserved);
3979 inline size_t put_multiple_samelength(
map_handle map,
const slice &key,
const size_t value_length,
3980 const void *values_array,
size_t values_count,
put_mode mode,
3981 bool allow_partial =
false);
3982 template <
typename VALUE>
3984 put_mode mode,
bool allow_partial =
false) {
3985 static_assert(::std::is_standard_layout<VALUE>::value && !::std::is_pointer<VALUE>::value &&
3986 !::std::is_array<VALUE>::value,
3987 "Must be a standard layout type!");
3990 template <
typename VALUE>
3997 inline ptrdiff_t estimate_from_first(
map_handle map,
const slice &to)
const;
3998 inline ptrdiff_t estimate_to_last(
map_handle map,
const slice &from)
const;
4010 using inherited =
txn;
4018 txn_managed(txn_managed &&) = default;
4019 txn_managed &operator=(txn_managed &&other) noexcept {
4021 MDBX_CXX20_UNLIKELY {
4022 assert(
handle_ != other.handle_);
4082 inline ~
cursor() noexcept;
4114 inline void *get_context() const noexcept;
4117 inline
cursor &set_context(
void *your_context);
4179 bool throw_notfound);
4202 template <
typename CALLABLE_PREDICATE>
4205 static int probe(
void *context,
MDBX_val *key,
MDBX_val *value,
void *arg)
noexcept {
4206 auto thunk =
static_cast<wrapper *
>(context);
4207 assert(thunk->is_clean());
4208 auto &predicate = *
static_cast<CALLABLE_PREDICATE *
>(arg);
4222 template <
typename CALLABLE_PREDICATE>
bool fullscan(CALLABLE_PREDICATE predicate,
bool backward =
false) {
4226 template <
typename CALLABLE_PREDICATE>
4230 static int probe(
void *context,
MDBX_val *key,
MDBX_val *value,
void *arg)
noexcept {
4231 auto thunk =
static_cast<wrapper *
>(context);
4232 assert(thunk->is_clean());
4233 auto &predicate = *
static_cast<CALLABLE_PREDICATE *
>(arg);
4247 template <
typename CALLABLE_PREDICATE>
4251 static int probe(
void *context,
MDBX_val *key,
MDBX_val *value,
void *arg)
noexcept {
4252 auto thunk =
static_cast<wrapper *
>(context);
4253 assert(thunk->is_clean());
4254 auto &predicate = *
static_cast<CALLABLE_PREDICATE *
>(arg);
4269 return move_result(*
this, operation, throw_notfound);
4275 return move_result(*
this, operation, key, value, throw_notfound);
4278 return move(operation, &key, &value, throw_notfound);
4357 inline bool seek(
const slice &key);
4358 inline move_result find(
const slice &key,
bool throw_notfound =
true);
4359 inline move_result lower_bound(
const slice &key,
bool throw_notfound =
false);
4360 inline move_result upper_bound(
const slice &key,
bool throw_notfound =
false);
4363 inline size_t count_multivalue()
const;
4365 inline move_result find_multivalue(
const slice &key,
const slice &value,
bool throw_notfound =
true);
4366 inline move_result lower_bound_multivalue(
const slice &key,
const slice &value,
bool throw_notfound =
false);
4367 inline move_result upper_bound_multivalue(
const slice &key,
const slice &value,
bool throw_notfound =
false);
4385 inline bool eof()
const;
4386 inline bool on_first()
const;
4387 inline bool on_last()
const;
4388 inline bool on_first_multival()
const;
4389 inline bool on_last_multival()
const;
4392 inline estimate_result
estimate(move_operation operation)
const;
4407 inline ::mdbx::txn
txn()
const;
4410 inline operator ::mdbx::txn()
const {
return txn(); }
4411 inline operator ::mdbx::map_handle()
const {
return map(); }
4415 inline void insert(
const slice &key,
slice value);
4417 inline slice insert_reserve(
const slice &key,
size_t value_length);
4421 inline slice upsert_reserve(
const slice &key,
size_t value_length);
4439 inline bool erase(
bool whole_multivalue =
false);
4443 inline bool erase(
const slice &key,
bool whole_multivalue =
true);
4447 inline bool erase(
const slice &key,
const slice &value);
4449 inline size_t put_multiple_samelength(
const slice &key,
const size_t value_length,
const void *values_array,
4450 size_t values_count,
put_mode mode,
bool allow_partial =
false);
4451 template <
typename VALUE>
4453 bool allow_partial =
false) {
4454 static_assert(::std::is_standard_layout<VALUE>::value && !::std::is_pointer<VALUE>::value &&
4455 !::std::is_array<VALUE>::value,
4456 "Must be a standard layout type!");
4459 template <
typename VALUE>
4473 using inherited =
cursor;
4492 cursor_managed &
operator=(cursor_managed &&other)
noexcept {
4494 MDBX_CXX20_UNLIKELY {
4495 assert(
handle_ != other.handle_);
4518template <
class ALLOCATOR,
typename CAPACITY_POLICY>
4545#if defined(__cpp_lib_is_constant_evaluated) && __cpp_lib_is_constant_evaluated >= 201811L
4546 if (::std::is_constant_evaluated()) {
4547 for (
size_t i = 0; c_str; ++i)
4553#if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L
4554 return c_str ? ::std::string_view(c_str).length() : 0;
4556 return c_str ? ::std::strlen(c_str) : 0;
4561#if defined(__cpp_lib_is_constant_evaluated) && __cpp_lib_is_constant_evaluated >= 201811L
4562 if (::std::is_constant_evaluated()) {
4563 for (
size_t i = 0; i < bytes; ++i)
4564 static_cast<byte *
>(dest)[i] =
static_cast<const byte *
>(src)[i];
4568 return ::std::memcpy(dest, src, bytes);
4572#if defined(__cpp_lib_is_constant_evaluated) && __cpp_lib_is_constant_evaluated >= 201811L
4573 if (::std::is_constant_evaluated()) {
4574 for (
size_t i = 0; i < bytes; ++i) {
4575 const int diff = int(
static_cast<const byte *
>(a)[i]) - int(
static_cast<const byte *
>(b)[i]);
4582 return ::std::memcmp(a, b, bytes);
4592 return check_length(check_length(headroom) + check_length(payload));
4596 return check_length(check_length(headroom, payload) + check_length(tailroom));
4603 captured_ = ::std::current_exception();
4608 MDBX_CXX20_UNLIKELY ::std::rethrow_exception(captured_);
4666 MDBX_CXX20_UNLIKELY
panic(context_where, func_who);
4671 MDBX_CXX20_UNLIKELY
panic(context_where, func_who);
4676 MDBX_CXX20_UNLIKELY
error(error_code).throw_exception();
4685 error rc(error_code);
4690 switch (error_code) {
4726 : ::
MDBX_val({
const_cast<void *
>(ptr), check_length(
bytes)}) {}
4729 :
slice(begin, static_cast<const
byte *>(
end) - static_cast<const
byte *>(begin)) {}
4740 iov_base =
const_cast<void *
>(ptr);
4741 iov_len = check_length(
bytes);
4746 iov_base = src.iov_base;
4747 iov_len = src.iov_len;
4760 assign(src.iov_base, src.iov_len);
4761 src.iov_base =
nullptr;
4766 return assign(begin,
static_cast<const byte *
>(
end) -
static_cast<const byte *
>(begin));
4802 iov_len = check_length(
bytes);
4827 assert(n <=
size());
4828 iov_base =
static_cast<byte *
>(iov_base) + n;
4839 assert(n <=
size());
4850 return length() >= prefix.length() && memcmp(
data(), prefix.data(), prefix.length()) == 0;
4854 return length() >= suffix.length() &&
4855 memcmp(
byte_ptr() +
length() - suffix.length(), suffix.data(), suffix.length()) == 0;
4859 size_t h =
length() * 3977471;
4860 for (
size_t i = 0; i <
length(); ++i)
4861 h = (h ^
static_cast<const uint8_t *
>(
data())[i]) * 1664525 + 1013904223;
4862 return h ^ 3863194411 * (h >> 11);
4912 const intptr_t diff = intptr_t(a.length()) - intptr_t(b.length());
4914 :
MDBX_UNLIKELY(a.length() == 0 || a.data() == b.data()) ? 0
4915 : memcmp(a.data(), b.data(), a.length());
4919 const size_t shortest = ::std::min(a.length(), b.length());
4922 const intptr_t diff = memcmp(a.data(), b.data(), shortest);
4926 return intptr_t(a.length()) - intptr_t(b.length());
4953#if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L
4959template <
class ALLOCATOR>
4961 return to_hex(*
this, uppercase, wrap_width).
as_string<ALLOCATOR>(alloc);
4964template <
class ALLOCATOR>
4969template <
class ALLOCATOR>
4974template <
class ALLOCATOR,
class CAPACITY_POLICY>
4976 const ALLOCATOR &alloc)
const {
4977 return to_hex(*
this, uppercase, wrap_width).
as_buffer<ALLOCATOR, CAPACITY_POLICY>(alloc);
4980template <
class ALLOCATOR,
class CAPACITY_POLICY>
4985template <
class ALLOCATOR,
class CAPACITY_POLICY>
4990template <
class ALLOCATOR,
class CAPACITY_POLICY>
4992 return from_hex(*
this, ignore_spaces).
as_buffer<ALLOCATOR, CAPACITY_POLICY>(alloc);
4995template <
class ALLOCATOR,
class CAPACITY_POLICY>
5000template <
class ALLOCATOR,
class CAPACITY_POLICY>
5030 return a.key.length() == b.key.length() && a.value.length() == b.value.length() &&
5031 memcmp(a.key.data(), b.key.data(), a.key.length()) == 0 &&
5032 memcmp(a.value.data(), b.value.data(), a.value.length()) == 0;
5052 return a.key.length() != b.key.length() || a.value.length() != b.value.length() ||
5053 memcmp(a.key.data(), b.key.data(), a.key.length()) != 0 ||
5054 memcmp(a.value.data(), b.value.data(), a.value.length()) != 0;
5057#if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L
5065template <
class ALLOCATOR,
typename CAPACITY_POLICY>
5088 other.handle_ =
nullptr;
5139 return static_cast<size_t>(result);
5146 return static_cast<size_t>(result);
5157 return static_cast<size_t>(result);
5168 return static_cast<size_t>(result);
5181 return static_cast<size_t>(result);
5192 return static_cast<size_t>(result);
5201 return static_cast<size_t>(result);
5212 return static_cast<size_t>(result);
5223 return static_cast<size_t>(result);
5234 return static_cast<size_t>(result);
5245 return static_cast<size_t>(result);
5344 unsigned seconds_16dot16;
5346 return seconds_16dot16;
5355#if __cplusplus >= 201103L
5400 size_t retained) noexcept
5408 size_t used,
size_t retained)
noexcept {
5409 reader_visitor_thunk *thunk =
static_cast<reader_visitor_thunk *
>(ctx);
5410 assert(thunk->is_clean());
5421 reader_visitor_thunk thunk(visitor);
5423 thunk.rethrow_captured();
5430 assert(dead_count >= 0);
5431 return static_cast<unsigned>(dead_count);
5444 assert(ptr !=
nullptr);
5451 assert(ptr !=
nullptr);
5458 assert(ptr !=
nullptr);
5465 assert(ptr !=
nullptr);
5477 other.handle_ =
nullptr;
5567 assert(map.
dbi != 0);
5576 assert(map.
dbi != 0);
5583 assert(map.
dbi != 0);
5590 assert(map.
dbi != 0);
5599 assert(map.
dbi != 0);
5608 assert(map.
dbi != 0);
5692 return ::mdbx_dcmp(
handle_, map.
dbi, &a, &b);
5722 return value_at_absence;
5735 return value_at_absence;
5776 const int err =
put(map, key, &value ,
5789 slice result(
nullptr, value_length);
5796 slice result(
nullptr, value_length);
5797 const int err =
put(map, key, &result ,
5814 slice result(
nullptr, value_length);
5836 slice result(
nullptr, value_length);
5842 slice result(
nullptr, value_length);
5883template <
class ALLOCATOR,
typename CAPACITY_POLICY>
5887 typename buffer<ALLOCATOR, CAPACITY_POLICY>::data_preserver result(alloc);
5893template <
class ALLOCATOR,
typename CAPACITY_POLICY>
5897 typename buffer<ALLOCATOR, CAPACITY_POLICY>::data_preserver result(alloc);
5904template <
class ALLOCATOR,
typename CAPACITY_POLICY>
5908 typename buffer<ALLOCATOR, CAPACITY_POLICY>::data_preserver result(alloc);
5921 const void *values_array,
size_t values_count,
put_mode mode,
5922 bool allow_partial) {
5923 MDBX_val args[2] = {{
const_cast<void *
>(values_array), value_length}, {
nullptr, values_count}};
5936 return args[1].iov_len ;
5982 other.handle_ =
nullptr;
6022 bool throw_notfound)
6024 this->
done =
cursor.move(operation, &this->key, &this->value, throw_notfound);
6035 if (!throw_notfound)
6125 return ::mdbx::txn(
txn);
6162 slice result(
nullptr, value_length);
6169 slice result(
nullptr, value_length);
6170 const int err =
put(key, &result ,
6187 slice result(
nullptr, value_length);
6209 slice result(
nullptr, value_length);
6215 slice result(
nullptr, value_length);
6240 bool found =
seek(key);
6241 return found ?
erase(whole_multivalue) : found;
6250 size_t values_count,
put_mode mode,
bool allow_partial) {
6251 MDBX_val args[2] = {{
const_cast<void *
>(values_array), value_length}, {
nullptr, values_count}};
6264 return args[1].iov_len ;
6285template <
class ALLOCATOR,
typename CAPACITY_POLICY>
6286inline string to_string(const ::mdbx::buffer<ALLOCATOR, CAPACITY_POLICY> &buffer) {
6298inline string to_string(const ::mdbx::env::geometry &value) {
6304inline string to_string(const ::mdbx::env::operate_parameters &value) {
6316inline string to_string(const ::mdbx::env::durability &value) {
6322inline string to_string(const ::mdbx::env::reclaiming_options &value) {
6328inline string to_string(const ::mdbx::env::operate_options &value) {
6334inline string to_string(const ::mdbx::env_managed::create_parameters &value) {
6368template <>
struct hash<::
mdbx::env> :
public std::hash<const MDBX_env *> {
6370 size_t operator()(const ::mdbx::env &env)
const noexcept {
return inherited::operator()(env); }
6373template <>
struct hash<::
mdbx::txn> :
public std::hash<const MDBX_txn *> {
6375 size_t operator()(const ::mdbx::txn &txn)
const noexcept {
return inherited::operator()(txn); }
6378template <>
struct hash<::
mdbx::cursor> :
public std::hash<const MDBX_cursor *> {
6380 size_t operator()(const ::mdbx::cursor &cursor)
const noexcept {
return inherited::operator()(cursor); }
6383template <
class ALLOCATOR,
typename CAPACITY_POLICY>
struct hash<::
mdbx::buffer<ALLOCATOR, CAPACITY_POLICY>> {
6385 return buffer.hash_value();
6392#if defined(__LCC__) && __LCC__ >= 126
6393#pragma diagnostic pop
#define MDBX_CXX11_CONSTEXPR
Definition mdbx.h:439
#define MDBX_MAYBE_UNUSED
Definition mdbx.h:505
#define MDBX_CXX14_CONSTEXPR
Definition mdbx.h:458
#define MDBX_NOTHROW_PURE_FUNCTION
The 'pure nothrow' function attribute for optimization.
Definition mdbx.h:255
mode_t mdbx_mode_t
Definition mdbx.h:170
int(* MDBX_preserve_func)(void *context, MDBX_val *target, const void *src, size_t bytes)
Definition mdbx.h:5067
#define LIBMDBX_API
Definition mdbx.h:587
#define LIBMDBX_API_TYPE
Definition mdbx.h:602
struct iovec MDBX_val
Generic structure used for passing keys and data in and out of the table. .
Definition mdbx.h:762
LIBMDBX_API int mdbx_replace_ex(MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *key, MDBX_val *new_data, MDBX_val *old_data, MDBX_put_flags_t flags, MDBX_preserve_func preserver, void *preserver_context)
pthread_t mdbx_tid_t
Definition mdbx.h:169
struct MDBX_env MDBX_env
Opaque structure for a database environment.
Definition mdbx.h:694
int mdbx_filehandle_t
Definition mdbx.h:167
pid_t mdbx_pid_t
Definition mdbx.h:168
@ MDBX_MAX_PAGESIZE
Definition mdbx.h:776
@ MDBX_MAXDATASIZE
Definition mdbx.h:770
@ MDBX_MAX_DBI
Definition mdbx.h:767
@ MDBX_MIN_PAGESIZE
Definition mdbx.h:773
libmdbx build information
Definition mdbx.h:630
The fours integers markers (aka "canary") associated with the environment.
Definition mdbx.h:4436
Latency of commit stages in 1/65536 of seconds units.
Definition mdbx.h:4085
Information about the environment.
Definition mdbx.h:2808
Statistics for a table in the environment.
Definition mdbx.h:2762
Information about the transaction.
Definition mdbx.h:3987
libmdbx version information,
Definition mdbx.h:612
LIBMDBX_API int mdbx_cursor_del(MDBX_cursor *cursor, MDBX_put_flags_t flags)
Delete current key/data pair.
LIBMDBX_API int mdbx_dbi_sequence(MDBX_txn *txn, MDBX_dbi dbi, uint64_t *result, uint64_t increment)
Sequence generation for a table.
LIBMDBX_API int mdbx_get_equal_or_great(const MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key, MDBX_val *data)
Get equal or great item from a table.
LIBMDBX_API int mdbx_cursor_scan(MDBX_cursor *cursor, MDBX_predicate_func *predicate, void *context, MDBX_cursor_op start_op, MDBX_cursor_op turn_op, void *arg)
Сканирует таблицу с использованием передаваемого предиката, с уменьшением сопутствующих накладных рас...
LIBMDBX_API int mdbx_canary_put(MDBX_txn *txn, const MDBX_canary *canary)
Set integers markers (aka "canary") associated with the environment.
LIBMDBX_API int mdbx_canary_get(const MDBX_txn *txn, MDBX_canary *canary)
Returns fours integers markers (aka "canary") associated with the environment.
MDBX_put_flags_t
Data changing flags.
Definition mdbx.h:1630
LIBMDBX_API int mdbx_cursor_count(const MDBX_cursor *cursor, size_t *count)
Return count values (aka duplicates) for current key.
LIBMDBX_API int mdbx_cursor_scan_from(MDBX_cursor *cursor, MDBX_predicate_func *predicate, void *context, MDBX_cursor_op from_op, MDBX_val *from_key, MDBX_val *from_value, MDBX_cursor_op turn_op, void *arg)
int MDBX_cmp_func(const MDBX_val *a, const MDBX_val *b) noexcept
A callback function used to compare two keys in a table.
Definition mdbx.h:4496
LIBMDBX_API int mdbx_del(MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *key, const MDBX_val *data)
Delete items from a table.
LIBMDBX_API int mdbx_get_ex(const MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key, MDBX_val *data, size_t *values_count)
Get items from a table and optionally number of data items for a given key.
LIBMDBX_API int mdbx_cursor_put(MDBX_cursor *cursor, const MDBX_val *key, MDBX_val *data, MDBX_put_flags_t flags)
Store by cursor.
LIBMDBX_API int mdbx_put(MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *key, MDBX_val *data, MDBX_put_flags_t flags)
Store items into a table.
LIBMDBX_API int mdbx_drop(MDBX_txn *txn, MDBX_dbi dbi, bool del)
Empty or delete and close a table.
LIBMDBX_API int mdbx_cursor_get(MDBX_cursor *cursor, MDBX_val *key, MDBX_val *data, MDBX_cursor_op op)
Retrieve by cursor.
LIBMDBX_API int mdbx_get(const MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *key, MDBX_val *data)
Get items from a table.
@ MDBX_MULTIPLE
Definition mdbx.h:1667
@ MDBX_ALLDUPS
Definition mdbx.h:1650
@ MDBX_CURRENT
Definition mdbx.h:1645
@ MDBX_APPENDDUP
Definition mdbx.h:1663
@ MDBX_APPEND
Definition mdbx.h:1658
@ MDBX_UPSERT
Definition mdbx.h:1632
@ MDBX_RESERVE
Definition mdbx.h:1654
@ MDBX_NOOVERWRITE
Definition mdbx.h:1635
LIBMDBX_API int mdbx_cursor_on_first_dup(const MDBX_cursor *cursor)
Определяет стоит ли курсор на первом или единственном мульти-значении соответствующем ключу.
LIBMDBX_API int mdbx_cursor_open(MDBX_txn *txn, MDBX_dbi dbi, MDBX_cursor **cursor)
Create a cursor handle for the specified transaction and DBI handle.
LIBMDBX_API int mdbx_cursor_unbind(MDBX_cursor *cursor)
Unbind cursor from a transaction.
LIBMDBX_API MDBX_cursor * mdbx_cursor_create(void *context)
Create a cursor handle but not bind it to transaction nor DBI-handle.
LIBMDBX_API MDBX_dbi mdbx_cursor_dbi(const MDBX_cursor *cursor)
Return the cursor's table handle.
MDBX_cursor_op
Cursor operationsThis is the set of all operations for retrieving data using a cursor.
Definition mdbx.h:1711
LIBMDBX_API int mdbx_cursor_compare(const MDBX_cursor *left, const MDBX_cursor *right, bool ignore_multival)
Сравнивает позицию курсоров.
LIBMDBX_API int mdbx_cursor_on_last_dup(const MDBX_cursor *cursor)
Определяет стоит ли курсор на последнем или единственном мульти-значении соответствующем ключу.
LIBMDBX_API int mdbx_cursor_on_first(const MDBX_cursor *cursor)
Determines whether the cursor is pointed to the first key-value pair or not.
LIBMDBX_API int mdbx_cursor_bind(MDBX_txn *txn, MDBX_cursor *cursor, MDBX_dbi dbi)
Bind cursor to specified transaction and DBI-handle.
LIBMDBX_API int mdbx_txn_release_all_cursors_ex(const MDBX_txn *txn, bool unbind, size_t *count)
Unbind or closes all cursors of a given transaction and of all its parent transactions if ones are.
struct MDBX_cursor MDBX_cursor
Opaque structure for navigating through a table.
Definition mdbx.h:724
LIBMDBX_API int mdbx_cursor_set_userctx(MDBX_cursor *cursor, void *ctx)
Set application information associated with the cursor.
LIBMDBX_API int mdbx_cursor_eof(const MDBX_cursor *cursor)
Determines whether the cursor is pointed to a key-value pair or not, i.e. was not positioned or point...
LIBMDBX_API int mdbx_cursor_close2(MDBX_cursor *cursor)
Closes a cursor handle with returning error code.
LIBMDBX_API void * mdbx_cursor_get_userctx(const MDBX_cursor *cursor)
Get the application information associated with the MDBX_cursor.
LIBMDBX_API int mdbx_cursor_renew(MDBX_txn *txn, MDBX_cursor *cursor)
Renew a cursor handle for use within the given transaction.
LIBMDBX_API void mdbx_cursor_close(MDBX_cursor *cursor)
Closes a cursor handle without returning error code.
LIBMDBX_API MDBX_txn * mdbx_cursor_txn(const MDBX_cursor *cursor)
Return the cursor's transaction handle.
LIBMDBX_API int mdbx_cursor_on_last(const MDBX_cursor *cursor)
Determines whether the cursor is pointed to the last key-value pair or not.
LIBMDBX_API int mdbx_cursor_copy(const MDBX_cursor *src, MDBX_cursor *dest)
Copy cursor position and state.
@ MDBX_SEEK_AND_GET_MULTIPLE
Definition mdbx.h:1830
@ MDBX_GET_CURRENT
Definition mdbx.h:1726
@ MDBX_GET_BOTH
Definition mdbx.h:1719
@ MDBX_TO_KEY_EQUAL
Definition mdbx.h:1807
@ MDBX_GET_BOTH_RANGE
Definition mdbx.h:1723
@ MDBX_SET_KEY
Definition mdbx.h:1766
@ MDBX_FIRST_DUP
Definition mdbx.h:1716
@ MDBX_TO_KEY_LESSER_OR_EQUAL
Definition mdbx.h:1806
@ MDBX_GET_MULTIPLE
Definition mdbx.h:1731
@ MDBX_TO_EXACT_KEY_VALUE_GREATER_THAN
Definition mdbx.h:1817
@ MDBX_NEXT_NODUP
Definition mdbx.h:1751
@ MDBX_TO_EXACT_KEY_VALUE_LESSER_OR_EQUAL
Definition mdbx.h:1814
@ MDBX_TO_EXACT_KEY_VALUE_EQUAL
Definition mdbx.h:1815
@ MDBX_TO_PAIR_LESSER_OR_EQUAL
Definition mdbx.h:1822
@ MDBX_PREV_MULTIPLE
Definition mdbx.h:1774
@ MDBX_SET_RANGE
Definition mdbx.h:1769
@ MDBX_LAST_DUP
Definition mdbx.h:1737
@ MDBX_PREV
Definition mdbx.h:1754
@ MDBX_TO_PAIR_GREATER_OR_EQUAL
Definition mdbx.h:1824
@ MDBX_TO_PAIR_GREATER_THAN
Definition mdbx.h:1825
@ MDBX_LAST
Definition mdbx.h:1734
@ MDBX_TO_KEY_LESSER_THAN
Definition mdbx.h:1805
@ MDBX_PREV_DUP
Definition mdbx.h:1757
@ MDBX_TO_EXACT_KEY_VALUE_LESSER_THAN
Definition mdbx.h:1813
@ MDBX_SET
Definition mdbx.h:1763
@ MDBX_NEXT
Definition mdbx.h:1740
@ MDBX_TO_KEY_GREATER_OR_EQUAL
Definition mdbx.h:1808
@ MDBX_TO_PAIR_LESSER_THAN
Definition mdbx.h:1821
@ MDBX_NEXT_MULTIPLE
Definition mdbx.h:1748
@ MDBX_PREV_NODUP
Definition mdbx.h:1760
@ MDBX_TO_PAIR_EQUAL
Definition mdbx.h:1823
@ MDBX_NEXT_DUP
Definition mdbx.h:1743
@ MDBX_TO_EXACT_KEY_VALUE_GREATER_OR_EQUAL
Definition mdbx.h:1816
@ MDBX_TO_KEY_GREATER_THAN
Definition mdbx.h:1809
@ MDBX_FIRST
Definition mdbx.h:1713
LIBMDBX_API int mdbx_dbi_rename(MDBX_txn *txn, MDBX_dbi dbi, const char *name)
Переименовает таблицу по DBI-дескриптору
LIBMDBX_API int mdbx_dbi_rename2(MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *name)
Переименовает таблицу по DBI-дескриптору
LIBMDBX_API int mdbx_dbi_close(MDBX_env *env, MDBX_dbi dbi)
Close a table handle. Normally unnecessary.
LIBMDBX_API int mdbx_dbi_open(MDBX_txn *txn, const char *name, MDBX_db_flags_t flags, MDBX_dbi *dbi)
Open or Create a named table in the environment.
LIBMDBX_API int mdbx_dbi_open2(MDBX_txn *txn, const MDBX_val *name, MDBX_db_flags_t flags, MDBX_dbi *dbi)
Open or Create a named table in the environment.
uint32_t MDBX_dbi
A handle for an individual table (key-value spaces) in the environment.
Definition mdbx.h:717
MDBX_db_flags_t
Table flags.
Definition mdbx.h:1580
@ MDBX_INTEGERDUP
Definition mdbx.h:1604
@ MDBX_DB_ACCEDE
Definition mdbx.h:1622
@ MDBX_DB_DEFAULTS
Definition mdbx.h:1582
@ MDBX_REVERSEKEY
Definition mdbx.h:1585
@ MDBX_DUPFIXED
Definition mdbx.h:1599
@ MDBX_INTEGERKEY
Definition mdbx.h:1595
@ MDBX_REVERSEDUP
Definition mdbx.h:1607
@ MDBX_CREATE
Definition mdbx.h:1610
@ MDBX_DUPSORT
Definition mdbx.h:1588
MDBX_log_level_t
Definition mdbx.h:839
MDBX_debug_flags_t
Runtime debug flags.
Definition mdbx.h:898
LIBMDBX_API int mdbx_env_set_hsr(MDBX_env *env, MDBX_hsr_func *hsr_callback)
Sets a Handle-Slow-Readers callback to resolve database full/overflow issue due to a reader(s) which ...
int MDBX_hsr_func(const MDBX_env *env, const MDBX_txn *txn, mdbx_pid_t pid, mdbx_tid_t tid, uint64_t laggard, unsigned gap, size_t space, int retry) noexcept
A Handle-Slow-Readers callback function to resolve database full/overflow issue due to a reader(s) wh...
Definition mdbx.h:6294
MDBX_error_t
Errors and return codes.
Definition mdbx.h:1838
@ MDBX_FIRST_LMDB_ERRCODE
Definition mdbx.h:1852
@ MDBX_BAD_TXN
Definition mdbx.h:1917
@ MDBX_LAST_LMDB_ERRCODE
Definition mdbx.h:1931
@ MDBX_SUCCESS
Definition mdbx.h:1840
@ MDBX_NOTFOUND
Definition mdbx.h:1855
@ MDBX_RESULT_TRUE
Definition mdbx.h:1846
@ MDBX_BUSY
Definition mdbx.h:1935
@ MDBX_EINVAL
Definition mdbx.h:2008
@ MDBX_ENOMEM
Definition mdbx.h:2010
@ MDBX_FIRST_ADDED_ERRCODE
Definition mdbx.h:1938
@ MDBX_RESULT_FALSE
Definition mdbx.h:1843
@ MDBX_LAST_ADDED_ERRCODE
Definition mdbx.h:1987
@ MDBX_KEYEXIST
Definition mdbx.h:1849
MDBX_env_flags_t
Environment flags.
Definition mdbx.h:1021
LIBMDBX_API int mdbx_estimate_distance(const MDBX_cursor *first, const MDBX_cursor *last, ptrdiff_t *distance_items)
Estimates the distance between cursors as a number of elements.
LIBMDBX_API int mdbx_estimate_move(const MDBX_cursor *cursor, MDBX_val *key, MDBX_val *data, MDBX_cursor_op move_op, ptrdiff_t *distance_items)
Estimates the move distance.
LIBMDBX_API int mdbx_estimate_range(const MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *begin_key, const MDBX_val *begin_data, const MDBX_val *end_key, const MDBX_val *end_data, ptrdiff_t *distance_items)
Estimates the size of a range as a number of elements.
LIBMDBX_API int mdbx_env_get_option(const MDBX_env *env, const MDBX_option_t option, uint64_t *pvalue)
Gets the value of extra runtime options from an environment.
int mdbx_env_set_syncperiod(MDBX_env *env, unsigned seconds_16dot16)
Sets relative period since the last unsteady commit to force flush the data buffers to disk,...
Definition mdbx.h:3055
MDBX_option_t
MDBX environment extra runtime options.
Definition mdbx.h:2118
LIBMDBX_API int mdbx_env_set_geometry(MDBX_env *env, intptr_t size_lower, intptr_t size_now, intptr_t size_upper, intptr_t growth_step, intptr_t shrink_threshold, intptr_t pagesize)
Set all size-related parameters of environment, including page size and the min/max size of the memor...
int mdbx_env_set_syncbytes(MDBX_env *env, size_t threshold)
Sets threshold to force flush the data buffers to disk, even any of MDBX_SAFE_NOSYNC flag in the envi...
Definition mdbx.h:2994
LIBMDBX_API int mdbx_env_set_option(MDBX_env *env, const MDBX_option_t option, uint64_t value)
Sets the value of a extra runtime options for an environment.
LIBMDBX_API int mdbx_env_set_userctx(MDBX_env *env, void *ctx)
Sets application information (a context pointer) associated with the environment.
LIBMDBX_API int mdbx_env_set_flags(MDBX_env *env, MDBX_env_flags_t flags, bool onoff)
Set environment flags.
@ MDBX_opt_txn_dp_initial
Controls the in-process initial allocation size for dirty pages list of a write transaction....
Definition mdbx.h:2223
@ MDBX_opt_txn_dp_limit
Controls the in-process limit of dirty pages for a write transaction.
Definition mdbx.h:2219
@ MDBX_opt_prefault_write_enable
Controls prevention of page-faults of reclaimed and allocated pages in the MDBX_WRITEMAP mode by clea...
Definition mdbx.h:2323
@ MDBX_opt_max_db
Controls the maximum number of named tables for the environment.
Definition mdbx.h:2127
@ MDBX_opt_merge_threshold_16dot16_percent
Controls the in-process threshold of semi-empty pages merge.
Definition mdbx.h:2290
@ MDBX_opt_sync_bytes
Controls interprocess/shared threshold to force flush the data buffers to disk, if MDBX_SAFE_NOSYNC i...
Definition mdbx.h:2150
@ MDBX_opt_spill_min_denominator
Controls the in-process how minimal part of the dirty pages should be spilled when necessary.
Definition mdbx.h:2255
@ MDBX_opt_spill_parent4child_denominator
Controls the in-process how much of the parent transaction dirty pages will be spilled while start ea...
Definition mdbx.h:2278
@ MDBX_opt_loose_limit
Controls the in-process limit to grow a cache of dirty pages for reuse in the current transaction.
Definition mdbx.h:2190
@ MDBX_opt_rp_augment_limit
Controls the in-process limit to grow a list of reclaimed/recycled page's numbers for finding a seque...
Definition mdbx.h:2177
@ MDBX_opt_max_readers
Defines the maximum number of threads/reader slots for all processes interacting with the database.
Definition mdbx.h:2144
@ MDBX_opt_spill_max_denominator
Controls the in-process how maximal part of the dirty pages may be spilled when necessary.
Definition mdbx.h:2239
@ MDBX_opt_sync_period
Controls interprocess/shared relative period since the last unsteady commit to force flush the data b...
Definition mdbx.h:2156
@ MDBX_opt_dp_reserve_limit
Controls the in-process limit of a pre-allocated memory items for dirty pages.
Definition mdbx.h:2204
@ MDBX_opt_writethrough_threshold
Controls the choosing between use write-through disk writes and usual ones with followed flush by the...
Definition mdbx.h:2318
LIBMDBX_API int mdbx_dbi_stat(const MDBX_txn *txn, MDBX_dbi dbi, MDBX_stat *stat, size_t bytes)
Retrieve statistics for a table.
LIBMDBX_API uint64_t mdbx_txn_id(const MDBX_txn *txn)
Return the transaction's ID.
LIBMDBX_API intptr_t mdbx_limits_valsize_max(intptr_t pagesize, MDBX_db_flags_t flags)
Returns maximal data size in bytes for given page size and table flags, or -1 if pagesize is invalid.
LIBMDBX_API int mdbx_env_info_ex(const MDBX_env *env, const MDBX_txn *txn, MDBX_envinfo *info, size_t bytes)
Return information about the MDBX environment.
int mdbx_env_get_maxreaders(const MDBX_env *env, unsigned *readers)
Get the maximum number of threads/reader slots for the environment.
Definition mdbx.h:3691
int mdbx_env_get_syncperiod(const MDBX_env *env, unsigned *period_seconds_16dot16)
Get relative period since the last unsteady commit to force flush the data buffers to disk,...
Definition mdbx.h:3075
LIBMDBX_API int mdbx_env_get_maxkeysize_ex(const MDBX_env *env, MDBX_db_flags_t flags)
Returns the maximum size of keys can put.
LIBMDBX_API int mdbx_env_get_maxvalsize_ex(const MDBX_env *env, MDBX_db_flags_t flags)
Returns the maximum size of data we can put.
LIBMDBX_API int mdbx_env_stat_ex(const MDBX_env *env, const MDBX_txn *txn, MDBX_stat *stat, size_t bytes)
Return statistics about the MDBX environment.
LIBMDBX_API int mdbx_env_get_pairsize4page_max(const MDBX_env *env, MDBX_db_flags_t flags)
Returns maximal size of key-value pair to fit in a single page for specified table flags.
int mdbx_env_get_syncbytes(const MDBX_env *env, size_t *threshold)
Get threshold to force flush the data buffers to disk, even any of MDBX_SAFE_NOSYNC flag in the envir...
Definition mdbx.h:3012
LIBMDBX_API intptr_t mdbx_limits_valsize4page_max(intptr_t pagesize, MDBX_db_flags_t flags)
Returns maximal data size in bytes to fit in a leaf-page or single large/overflow-page with the given...
LIBMDBX_API intptr_t mdbx_limits_txnsize_max(intptr_t pagesize)
Returns maximal write transaction size (i.e. limit for summary volume of dirty pages) in bytes for gi...
LIBMDBX_API int mdbx_dbi_dupsort_depthmask(const MDBX_txn *txn, MDBX_dbi dbi, uint32_t *mask)
Retrieve depth (bitmask) information of nested dupsort (multi-value) B+trees for given table.
LIBMDBX_API int mdbx_txn_info(const MDBX_txn *txn, MDBX_txn_info *info, bool scan_rlt)
Return information about the MDBX transaction.
LIBMDBX_API int mdbx_is_dirty(const MDBX_txn *txn, const void *ptr)
Determines whether the given address is on a dirty database page of the transaction or not.
MDBX_dbi_state_t
DBI state bits returted by mdbx_dbi_flags_ex()
Definition mdbx.h:4767
LIBMDBX_API int mdbx_env_get_valsize4page_max(const MDBX_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 specified ...
LIBMDBX_API int mdbx_env_get_fd(const MDBX_env *env, mdbx_filehandle_t *fd)
Return the file descriptor for the given environment.
LIBMDBX_API void * mdbx_env_get_userctx(const MDBX_env *env)
Returns an application information (a context pointer) associated with the environment.
int mdbx_env_get_maxdbs(const MDBX_env *env, MDBX_dbi *dbs)
Get the maximum number of named tables for the environment.
Definition mdbx.h:3736
LIBMDBX_API intptr_t mdbx_limits_keysize_max(intptr_t pagesize, MDBX_db_flags_t flags)
Returns maximal key size in bytes for given page size and table flags, or -1 if pagesize is invalid.
LIBMDBX_API int mdbx_reader_list(const MDBX_env *env, MDBX_reader_list_func *func, void *ctx)
Enumerate the entries in the reader lock table.
LIBMDBX_API intptr_t mdbx_limits_pairsize4page_max(intptr_t pagesize, MDBX_db_flags_t flags)
Returns maximal size of key-value pair to fit in a single page with the given size and table flags,...
LIBMDBX_API intptr_t mdbx_limits_dbsize_max(intptr_t pagesize)
Returns maximal database size in bytes for given page size, or -1 if pagesize is invalid.
LIBMDBX_API intptr_t mdbx_limits_dbsize_min(intptr_t pagesize)
Returns minimal database size in bytes for given page size, or -1 if pagesize is invalid.
LIBMDBX_API int mdbx_env_get_flags(const MDBX_env *env, unsigned *flags)
Get environment flags.
LIBMDBX_API int mdbx_dbi_flags_ex(const MDBX_txn *txn, MDBX_dbi dbi, unsigned *flags, unsigned *state)
Retrieve the DB flags and status for a table handle.
LIBMDBX_API int mdbx_txn_break(MDBX_txn *txn)
Marks transaction as broken to prevent further operations.
LIBMDBX_API int mdbx_txn_set_userctx(MDBX_txn *txn, void *ctx)
Sets application information associated (a context pointer) with the transaction.
LIBMDBX_API int mdbx_txn_park(MDBX_txn *txn, bool autounpark)
Переводит читающую транзакцию в "припаркованное" состояние.
LIBMDBX_API int mdbx_txn_unpark(MDBX_txn *txn, bool restart_if_ousted)
Распарковывает ранее припаркованную читающую транзакцию.
MDBX_txn_flags_t
Definition mdbx.h:1482
LIBMDBX_API void * mdbx_txn_get_userctx(const MDBX_txn *txn)
Returns an application information (a context pointer) associated with the transaction.
int mdbx_txn_begin(MDBX_env *env, MDBX_txn *parent, MDBX_txn_flags_t flags, MDBX_txn **txn)
Create a transaction for use with the environment.
Definition mdbx.h:3956
struct MDBX_txn MDBX_txn
Opaque structure for a transaction handle.
Definition mdbx.h:705
LIBMDBX_API int mdbx_txn_reset(MDBX_txn *txn)
Reset a read-only transaction.
LIBMDBX_API int mdbx_txn_renew(MDBX_txn *txn)
Renew a read-only transaction.
LIBMDBX_API MDBX_txn_flags_t mdbx_txn_flags(const MDBX_txn *txn)
Return the transaction's flags.
@ MDBX_TXN_RDONLY
Definition mdbx.h:1493
@ MDBX_TXN_RDONLY_PREPARE
Definition mdbx.h:1502
@ MDBX_TXN_READWRITE
Definition mdbx.h:1487
@ MDBX_TXN_TRY
Definition mdbx.h:1508
buffer & assign(const void *begin, const void *end, bool make_reference=false)
Definition mdbx.h++:2326
friend class env
Definition mdbx.h++:4011
constexpr buffer(const ::std::basic_string_view< CHAR, T > &view, bool make_reference, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2039
MDBX_commit_latency commit_latency
Definition mdbx.h++:4045
env_managed(const char *pathname, const operate_parameters &, bool accede=true)
constexpr bool is_reference() const noexcept
Checks whether the buffer just refers to data located outside the buffer, rather than stores it.
Definition mdbx.h++:1912
::MDBX_txn_info info
Definition mdbx.h++:3706
cursor_managed(void *your_context=nullptr)
Creates a new managed cursor with underlying object.
Definition mdbx.h++:4480
::MDBX_stat map_stat
Definition mdbx.h++:3863
bool drop_map(const slice &name, bool throw_if_absent=false)
Drop key-value map.
txn & operator=(const txn &) noexcept=default
env & set_sync_period(const duration &period)
Sets relative period since the last unsteady commit to force flush the data buffers to disk,...
txn_managed start_nested()
Start nested write transaction.
extra_runtime_option
MDBX environment extra runtime options.
Definition mdbx.h++:3413
@ prefault_write_enable
Controls prevention of page-faults of reclaimed and allocated pages in the MDBX_WRITEMAP mode by clea...
Definition mdbx.h++:3447
@ spill_min_denominator
Controls the in-process how minimal part of the dirty pages should be spilled when necessary.
Definition mdbx.h++:3439
@ spill_parent4child_denominator
Controls the in-process how much of the parent transaction dirty pages will be spilled while start ea...
Definition mdbx.h++:3441
@ writethrough_threshold
Controls the choosing between use write-through disk writes and usual ones with followed flush by the...
Definition mdbx.h++:3445
@ sync_bytes
Controls interprocess/shared threshold to force flush the data buffers to disk, if MDBX_SAFE_NOSYNC i...
Definition mdbx.h++:3422
@ dp_limit
Controls the in-process limit of dirty pages for a write transaction.
Definition mdbx.h++:3433
@ dp_initial
Controls the in-process initial allocation size for dirty pages list of a write transaction....
Definition mdbx.h++:3435
@ spill_max_denominator
Controls the in-process how maximal part of the dirty pages may be spilled when necessary.
Definition mdbx.h++:3437
@ merge_threshold_16dot16_percent
Controls the in-process threshold of semi-empty pages merge.
Definition mdbx.h++:3443
@ rp_augment_limit
Controls the in-process limit to grow a list of reclaimed/recycled page's numbers for finding a seque...
Definition mdbx.h++:3427
@ loose_limit
Controls the in-process limit to grow a cache of dirty pages for reuse in the current transaction.
Definition mdbx.h++:3429
@ dp_reserve_limit
Controls the in-process limit of a pre-allocated memory items for dirty pages.
Definition mdbx.h++:3431
size_t operator()(::mdbx::buffer< ALLOCATOR, CAPACITY_POLICY > const &buffer) const noexcept
Definition mdbx.h++:6384
env_managed & operator=(env_managed &&other) noexcept
Definition mdbx.h++:3640
constexpr byte * byte_ptr() noexcept
Returns casted to pointer to byte an address of data.
Definition mdbx.h++:1939
constexpr buffer & set_end(const void *ptr)
Sets the length by specifying the end of the data.
Definition mdbx.h++:2004
constexpr allocator_type get_allocator() const
Definition mdbx.h++:1894
bool drop_map(const ::std::string_view &name, bool throw_if_absent=false)
Drop key-value map.
Definition mdbx.h++:3844
env_managed(const char *pathname, const create_parameters &, const operate_parameters &, bool accede=true)
map_handle(const map_handle &) noexcept=default
static buffer base64_decode(const slice &source, bool ignore_spaces=false, const allocator_type &alloc=allocator_type())
Decodes Base64 dump from the slice content to returned buffer.
Definition mdbx.h++:2181
void reserve_tailroom(size_t wanna_tailroom)
Reserves space after the payload.
Definition mdbx.h++:2222
::MDBX_db_flags_t flags
Definition mdbx.h++:2923
path get_path() const
Return the path that was used for opening the environment.
move_result to_exact_key_value_lesser_or_equal(const slice &key, const slice &value, bool throw_notfound=true)
Definition mdbx.h++:4325
move_result previous_multiple_samelength(bool throw_notfound=false)
Definition mdbx.h++:4381
static buffer key_from(const double *ieee754_64bit)
Definition mdbx.h++:2547
static buffer hex(const POD &pod, bool uppercase=false, unsigned wrap_width=0, const allocator_type &alloc=allocator_type())
Returns a new buffer with a hexadecimal dump of the given pod.
Definition mdbx.h++:2130
static bool remove(const ::std::wstring &pathname, const remove_mode mode=just_remove)
constexpr const char * end_char_ptr() const noexcept
Returns casted to const pointer to char an end of data.
Definition mdbx.h++:1955
constexpr buffer make_inplace_or_reference() const
Definition mdbx.h++:2253
constexpr const char * char_ptr() const noexcept
Returns casted to const pointer to char an address of data.
Definition mdbx.h++:1952
buffer & assign(const char *c_str, bool make_reference=false)
Definition mdbx.h++:2335
void reserve(size_t wanna_headroom, size_t wanna_tailroom)
Reserves storage space.
Definition mdbx.h++:2205
constexpr size_t tailroom() const noexcept
Returns the number of bytes that available in currently allocated storage after the currently data en...
Definition mdbx.h++:1927
constexpr buffer(const ::std::basic_string_view< CHAR, T > &view, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2066
buffer & assign(const struct slice &src, bool make_reference=false)
Definition mdbx.h++:2306
void reserve_headroom(size_t wanna_headroom)
Reserves space before the payload.
Definition mdbx.h++:2219
constexpr byte * end_byte_ptr() noexcept
Returns casted to pointer to byte an end of data.
Definition mdbx.h++:1946
constexpr txn() noexcept=default
constexpr map_handle() noexcept
Definition mdbx.h++:2892
buffer(size_t head_room, size_t tail_room, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2071
durability
Durability level.
Definition mdbx.h++:3070
@ lazy_weak_tail
Definition mdbx.h++:3073
@ robust_synchronous
Definition mdbx.h++:3071
@ whole_fragile
Definition mdbx.h++:3074
@ half_synchronous_weak_last
Definition mdbx.h++:3072
void commit_embark_read()
Commit all the operations of a transaction into the database and then start read transaction.
::std::allocator_traits< allocator_type > allocator_traits
Definition mdbx.h++:1479
constexpr buffer(const struct slice &src, bool make_reference, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2021
friend constexpr bool operator!=(const map_handle &a, const map_handle &b) noexcept
Definition mdbx.h++:2919
constexpr buffer & assign(size_t headroom, const buffer &src, size_t tailroom)
Definition mdbx.h++:2257
constexpr void * data() noexcept
Return a pointer to the beginning of the referenced data.
Definition mdbx.h++:1979
size_t dbsize_min() const
Returns the minimal database size in bytes for the environment.
Definition mdbx.h++:3240
buffer & append_decoded_hex(const struct slice &data, bool ignore_spaces=false)
Definition mdbx.h++:2436
map_handle & operator=(const map_handle &) noexcept=default
duration sync_period() const
Gets relative period since the last unsteady commit that used to force flush the data buffers to disk...
move_result seek_multiple_samelength(const slice &key, bool throw_notfound=true)
Definition mdbx.h++:4369
constexpr const void * end() const noexcept
Return a const pointer to the end of the referenced data.
Definition mdbx.h++:1975
buffer & append(const byte c)
Definition mdbx.h++:2390
buffer & assign_freestanding(const void *ptr, size_t bytes)
Definition mdbx.h++:2230
constexpr void swap(buffer &other) noexcept(swap_alloc::is_nothrow())
Definition mdbx.h++:2235
buffer & operator=(const buffer &src)
Definition mdbx.h++:2352
estimate_result estimate(move_operation operation, slice &key) const
buffer & append_u16(uint_fast16_t u16)
Definition mdbx.h++:2458
static bool remove(const char *pathname, const remove_mode mode=just_remove)
friend class cursor
Definition mdbx.h++:3663
constexpr size_t headroom() const noexcept
Returns the number of bytes that available in currently allocated storage ahead the currently beginni...
Definition mdbx.h++:1921
move_result to_pair_equal(const slice &key, const slice &value, bool throw_notfound=true)
Definition mdbx.h++:4344
::MDBX_canary canary
Definition mdbx.h++:3872
env & copy(const wchar_t *destination, bool compactify, bool force_dynamic_size=false)
bool is_readwrite() const
Checks whether the transaction is read-write.
Definition mdbx.h++:3704
map_handle open_map_accede(const ::std::string_view &name) const
Open existing key-value map.
move_result move(move_operation operation, const slice &key, const slice &value, bool throw_notfound)
Definition mdbx.h++:4274
constexpr const void * data() const noexcept
Return a const pointer to the beginning of the referenced data.
Definition mdbx.h++:1972
static buffer key_from(const ::std::basic_string< CHAR, T, A > &src, bool make_reference=false)
Definition mdbx.h++:2537
static buffer hex(const slice &source, bool uppercase=false, unsigned wrap_width=0, const allocator_type &alloc=allocator_type())
Returns a new buffer with a hexadecimal dump of the slice content.
Definition mdbx.h++:2112
void update_current(const slice &value)
Updates value associated with a key at the current cursor position.
env_managed(const wchar_t *pathname, const operate_parameters &, bool accede=true)
move_result to_pair_lesser_than(const slice &key, const slice &value, bool throw_notfound=true)
Definition mdbx.h++:4338
buffer base58_decode(bool ignore_spaces=false, const allocator_type &alloc=allocator_type()) const
Decodes Base58 dump from the buffer content to new returned buffer.
Definition mdbx.h++:2194
bool clear_map(const char *name, bool throw_if_absent=false)
buffer hex_decode(bool ignore_spaces=false, const allocator_type &alloc=allocator_type()) const
Decodes hexadecimal dump from the buffer content to new returned buffer.
Definition mdbx.h++:2188
static buffer wrap(const POD &pod, bool make_reference=false, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2107
constexpr env() noexcept=default
buffer & add_header(const void *src, size_t bytes)
Definition mdbx.h++:2400
buffer encode_hex(bool uppercase=false, unsigned wrap_width=0, const allocator_type &alloc=allocator_type()) const
Definition mdbx.h++:2150
move_result to_pair_exact(const slice &key, const slice &value, bool throw_notfound=true)
Definition mdbx.h++:4347
void rename_map(map_handle map, const ::std::string_view &new_name)
Переименовывает таблицу ключ-значение.
env & copy(filehandle fd, bool compactify, bool force_dynamic_size=false)
Copy an environment to the specified file descriptor.
buffer & assign(const ::std::basic_string< CHAR, T, A > &str, bool make_reference=false)
Definition mdbx.h++:2331
env_managed(const ::mdbx::filesystem::path &pathname, const operate_parameters &, bool accede=true)
Open existing database.
static buffer base58_decode(const slice &source, bool ignore_spaces=false, const allocator_type &alloc=allocator_type())
Decodes Base58 dump from the slice content to returned buffer.
Definition mdbx.h++:2174
friend constexpr bool operator<=(const map_handle &a, const map_handle &b) noexcept
Definition mdbx.h++:2913
static buffer key_from_jsonInteger(const int64_t json_integer)
Definition mdbx.h++:2557
static bool remove(const ::std::string &pathname, const remove_mode mode=just_remove)
constexpr map_handle(MDBX_dbi dbi) noexcept
Definition mdbx.h++:2893
buffer base64_decode(bool ignore_spaces=false, const allocator_type &alloc=allocator_type()) const
Decodes Base64 dump from the buffer content to new returned buffer.
Definition mdbx.h++:2200
void put(const pair &kv, put_mode mode)
Definition mdbx.h++:4433
static constexpr buffer invalid() noexcept
Build an invalid buffer which non-zero length and refers to null address.
Definition mdbx.h++:2104
move_result current(bool throw_notfound=true) const
Definition mdbx.h++:4292
env & copy(const char *destination, bool compactify, bool force_dynamic_size=false)
move_result to_previous_last_multi(bool throw_notfound=true)
Definition mdbx.h++:4283
allocation_aware_details::swap_alloc< struct silo, allocator_type > swap_alloc
Definition mdbx.h++:1889
static buffer key_from(const float ieee754_32bit)
Definition mdbx.h++:2563
static bool remove(const ::mdbx::filesystem::path &pathname, const remove_mode mode=just_remove)
Removes the environment's files in a proper and multiprocess-safe way.
bool drop_map(const char *name, bool throw_if_absent=false)
Drops key-value map using name.
cursor & operator=(const cursor &) noexcept=default
bool is_same_or_after_than(const cursor &other, bool ignore_nested=false) const
Definition mdbx.h++:4109
size_t unbind_all_cursors() const
Unbind all cursors.
Definition mdbx.h++:3751
void upsert(map_handle map, const pair &kv)
Definition mdbx.h++:3927
move_result to_key_greater_or_equal(const slice &key, bool throw_notfound=true)
Definition mdbx.h++:4315
static buffer base58(const POD &pod, unsigned wrap_width=0, const allocator_type &alloc=allocator_type())
Returns a new buffer with a Base58 dump of the given pod.
Definition mdbx.h++:2138
bool is_same_position(const cursor &other, bool ignore_nested=false) const
Definition mdbx.h++:4101
constexpr buffer & assign(buffer &&src) noexcept(allocation_aware_details::move_assign_alloc< silo, allocator_type >::is_nothrow())
Definition mdbx.h++:2294
bool is_after_than(const cursor &other, bool ignore_nested=false) const
Definition mdbx.h++:4105
buffer & operator=(const ::std::basic_string_view< CHAR, T > &view) noexcept
Definition mdbx.h++:2361
constexpr buffer() noexcept=default
static buffer key_from_double(const double ieee754_64bit)
Definition mdbx.h++:2543
env_managed & operator=(const env_managed &)=delete
map_handle create_map(const ::std::string_view &name, const ::mdbx::key_mode key_mode=::mdbx::key_mode::usual, const ::mdbx::value_mode value_mode=::mdbx::value_mode::single)
Create new or open existing key-value map.
Definition mdbx.h++:3836
size_t operator()(const ::mdbx::cursor &cursor) const noexcept
Definition mdbx.h++:6380
const slice & slice() const noexcept
Definition mdbx.h++:2575
buffer & assign(struct slice &&src, bool make_reference=false)
Definition mdbx.h++:2314
static size_t default_pagesize() noexcept
Returns default page size for current system/platform.
Definition mdbx.h++:3167
constexpr size_t operator()(const ::mdbx::map_handle &handle) const noexcept
Definition mdbx.h++:6365
move_result to_next_first_multi(bool throw_notfound=true)
Definition mdbx.h++:4299
buffer & assign(const void *ptr, size_t bytes, bool make_reference=false)
Definition mdbx.h++:2302
MDBX_cursor * withdraw_handle() noexcept
Definition mdbx.h++:4502
constexpr buffer(const buffer &src)
Definition mdbx.h++:2049
static buffer hex_decode(const slice &source, bool ignore_spaces=false, const allocator_type &alloc=allocator_type())
Decodes hexadecimal dump from the slice content to returned buffer.
Definition mdbx.h++:2167
void clear_and_reserve(size_t whole_capacity, size_t headroom=0) noexcept
Clears the contents and reserve storage.
Definition mdbx.h++:2375
MDBX_txn * handle_
Definition mdbx.h++:3664
void abort()
Abandon all the operations of the transaction instead of saving ones.
constexpr size_t length() const noexcept
Returns the number of bytes.
Definition mdbx.h++:1992
static buffer key_from_u64(const uint64_t unsigned_int64)
Definition mdbx.h++:2549
move_result move(move_operation operation, const slice &key, bool throw_notfound)
Definition mdbx.h++:4271
mode
Operation mode.
Definition mdbx.h++:3062
@ write_mapped_io
Definition mdbx.h++:3065
@ nested_transactions
Definition mdbx.h++:3066
@ readonly
Definition mdbx.h++:3063
@ write_file_io
Definition mdbx.h++:3064
constexpr friend void swap(buffer &left, buffer &right) noexcept(buffer::is_swap_nothrow())
Definition mdbx.h++:2245
move_result move(move_operation operation, bool throw_notfound)
Definition mdbx.h++:4268
bool scan_from(CALLABLE_PREDICATE predicate, slice &from, move_operation start=key_greater_or_equal, move_operation turn=next)
Definition mdbx.h++:4227
::MDBX_envinfo info
Information about the environment.
Definition mdbx.h++:3301
operator::mdbx::txn() const
Definition mdbx.h++:4410
buffer & append_base64(const struct slice &data, unsigned wrap_width=0)
Definition mdbx.h++:2432
MDBX_env * handle_
Definition mdbx.h++:2963
static buffer key_from(const ::std::basic_string_view< CHAR, T > &src, bool make_reference=false)
Definition mdbx.h++:2529
slice reverse_current(size_t value_length)
Reserves and returns the space to storing a value associated with a key at the current cursor positio...
buffer(size_t head_room, const slice &src, size_t tail_room, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2082
move_result to_exact_key_value_greater_or_equal(const slice &key, const slice &value, bool throw_notfound=true)
Definition mdbx.h++:4331
buffer & append_byte(uint_fast8_t byte)
Definition mdbx.h++:2456
constexpr bool is_inplace() const noexcept
Checks whether data chunk stored in place within the buffer instance itself, without reference outsid...
Definition mdbx.h++:1906
commit_latency commit_get_latency()
Commit all the operations of a transaction into the database and return latency information.
Definition mdbx.h++:4058
bool is_same_or_before_than(const cursor &other, bool ignore_nested=false) const
Definition mdbx.h++:4097
static buffer key_from_float(const float ieee754_32bit)
Definition mdbx.h++:2561
move_result to_first(bool throw_notfound=true)
Definition mdbx.h++:4281
move_result to_last(bool throw_notfound=true)
Definition mdbx.h++:4301
buffer & operator=(const struct slice &src)
Definition mdbx.h++:2356
void close()
Explicitly closes the cursor.
Definition mdbx.h++:4486
buffer & append_base58(const struct slice &data, unsigned wrap_width=0)
Definition mdbx.h++:2428
buffer(const char *c_str, bool make_reference, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2034
bool is_pristine() const
Returns true for a freshly created database, but false if at least one transaction was committed.
buffer(const txn &transaction, const slice &src, const allocator_type &alloc=allocator_type())
constexpr size_t operator()(const ::mdbx::slice &slice) const noexcept
Definition mdbx.h++:6361
move_result to_key_exact(const slice &key, bool throw_notfound=true)
Definition mdbx.h++:4312
static buffer key_from(buffer &&src) noexcept
Definition mdbx.h++:2541
bool is_readonly() const
Checks whether the transaction is read-only.
Definition mdbx.h++:3701
buffer encode_base64(unsigned wrap_width=0, const allocator_type &alloc=allocator_type()) const
Definition mdbx.h++:2162
buffer(size_t capacity, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2077
constexpr txn_managed() noexcept=default
buffer & assign(::MDBX_val &&src, bool make_reference=false)
Definition mdbx.h++:2320
bool clear_map(const slice &name, bool throw_if_absent=false)
constexpr bool is_freestanding() const noexcept
Checks whether data chunk stored inside the buffer, otherwise buffer just refers to data located outs...
Definition mdbx.h++:1898
static buffer key_from(const float *ieee754_32bit)
Definition mdbx.h++:2565
buffer & append_u48(uint_fast64_t u48)
Definition mdbx.h++:2491
move_result next_multiple_samelength(bool throw_notfound=false)
Definition mdbx.h++:4377
env_managed(const ::std::wstring &pathname, const operate_parameters &, bool accede=true)
void append(map_handle map, const pair &kv, bool multivalue_order_preserved=true)
Definition mdbx.h++:3975
cursor_managed & operator=(const cursor_managed &)=delete
default_capacity_policy reservation_policy
Definition mdbx.h++:1480
remove_mode
Deletion modes for remove().
Definition mdbx.h++:3271
@ ensure_unused
Make sure that the environment is not being used by other processes, or return an error otherwise.
Definition mdbx.h++:3281
@ wait_for_unused
Wait until other processes closes the environment before deletion.
Definition mdbx.h++:3283
@ just_remove
Just delete the environment's files and directory if any.
Definition mdbx.h++:3278
static buffer key_from(const int64_t signed_int64)
Definition mdbx.h++:2555
bool scan(CALLABLE_PREDICATE predicate, move_operation start=first, move_operation turn=next)
Definition mdbx.h++:4203
move_result to_current_first_multi(bool throw_notfound=true)
Definition mdbx.h++:4286
constexpr buffer(const void *ptr, size_t bytes, bool make_reference, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2028
buffer & operator=(struct slice &&src)
Definition mdbx.h++:2358
buffer & add_header(const struct slice &chunk)
Definition mdbx.h++:2408
buffer & append_u32(uint_fast32_t u32)
Definition mdbx.h++:2479
buffer & append_decoded_base58(const struct slice &data, bool ignore_spaces=false)
Definition mdbx.h++:2440
bool scan_from(CALLABLE_PREDICATE predicate, pair &from, move_operation start=pair_greater_or_equal, move_operation turn=next)
Definition mdbx.h++:4248
cursor_managed & operator=(cursor_managed &&other) noexcept
Definition mdbx.h++:4492
std::hash< const MDBX_txn * > inherited
Definition mdbx.h++:6374
::MDBX_dbi_state_t state
Definition mdbx.h++:2924
env_managed(env_managed &&)=default
bool poll_sync_to_disk()
Performs non-blocking polling of sync-to-disk thresholds.
Definition mdbx.h++:3470
void put_multiple_samelength(const slice &key, const ::std::vector< VALUE > &vector, put_mode mode)
Definition mdbx.h++:4460
cursor_managed(cursor_managed &&)=default
void commit(commit_latency &latency)
Commit all the operations of a transaction into the database and collect latency information.
Definition mdbx.h++:4053
static bool remove(const wchar_t *pathname, const remove_mode mode=just_remove)
size_t key_max(key_mode mode) const
Returns the maximal key size in bytes for specified keys mode.
Definition mdbx.h++:3246
static buffer base64(const POD &pod, unsigned wrap_width=0, const allocator_type &alloc=allocator_type())
Returns a new buffer with a Base64 dump of the given pod.
Definition mdbx.h++:2145
move_result to_pair_lesser_or_equal(const slice &key, const slice &value, bool throw_notfound=true)
Definition mdbx.h++:4341
env & copy(const ::mdbx::filesystem::path &destination, bool compactify, bool force_dynamic_size=false)
Make a copy (backup) of an existing environment to the specified path.
static buffer key_from_i32(const int32_t signed_int32)
Definition mdbx.h++:2571
move_result get_multiple_samelength(bool throw_notfound=false)
Definition mdbx.h++:4373
slice inherited
Definition mdbx.h++:1473
move_result to_key_lesser_than(const slice &key, bool throw_notfound=true)
Definition mdbx.h++:4303
move_result to_next(bool throw_notfound=true)
Definition mdbx.h++:4300
env_managed(const ::std::string &pathname, const operate_parameters &, bool accede=true)
operator::mdbx::map_handle() const
Definition mdbx.h++:4411
size_t dbsize_max() const
Returns the maximal database size in bytes for the environment.
Definition mdbx.h++:3242
friend constexpr bool operator>=(const map_handle &a, const map_handle &b) noexcept
Definition mdbx.h++:2916
static buffer key_from_u32(const uint32_t unsigned_int32)
Definition mdbx.h++:2567
size_t close_all_cursors() const
Close all cursors.
Definition mdbx.h++:3748
static buffer key_from(const uint32_t unsigned_int32)
Definition mdbx.h++:2569
buffer & assign_reference(const void *ptr, size_t bytes)
Definition mdbx.h++:2224
friend constexpr bool operator<(const map_handle &a, const map_handle &b) noexcept
Definition mdbx.h++:2907
void commit()
Commit all the operations of a transaction into the database.
move_result to_key_greater_than(const slice &key, bool throw_notfound=true)
Definition mdbx.h++:4318
size_t get_pagesize() const
Returns pagesize of this MDBX environment.
Definition mdbx.h++:3307
void make_freestanding()
Makes buffer owning the data.
Definition mdbx.h++:2012
void put(map_handle map, const pair &kv, put_mode mode)
Definition mdbx.h++:3924
env_managed(const ::std::string &pathname, const create_parameters &, const operate_parameters &, bool accede=true)
buffer & assign(const ::MDBX_val &src, bool make_reference=false)
Definition mdbx.h++:2310
friend int compare_position(const cursor &left, const cursor &right, bool ignore_nested)
Definition mdbx.h++:6008
void put_multiple_samelength(map_handle map, const slice &key, const ::std::vector< VALUE > &vector, put_mode mode)
Definition mdbx.h++:3991
env_managed(const wchar_t *pathname, const create_parameters &, const operate_parameters &, bool accede=true)
size_t transaction_size_max() const
Returns the maximal write transaction size (i.e. limit for summary volume of dirty pages) in bytes.
Definition mdbx.h++:3253
map_handle open_map(const ::std::string_view &name, const ::mdbx::key_mode key_mode=::mdbx::key_mode::usual, const ::mdbx::value_mode value_mode=::mdbx::value_mode::single) const
Open existing key-value map.
Definition mdbx.h++:3829
friend constexpr bool operator==(const map_handle &a, const map_handle &b) noexcept
Definition mdbx.h++:2904
allocation_aware_details::move_assign_alloc< silo, allocator_type > move_assign_alloc
Definition mdbx.h++:1887
size_t put_multiple_samelength(map_handle map, const slice &key, const VALUE *values_array, size_t values_count, put_mode mode, bool allow_partial=false)
Definition mdbx.h++:3983
allocation_aware_details::copy_assign_alloc< silo, allocator_type > copy_assign_alloc
Definition mdbx.h++:1888
constexpr char * char_ptr() noexcept
Returns casted to pointer to char an address of data.
Definition mdbx.h++:1959
friend constexpr bool operator>(const map_handle &a, const map_handle &b) noexcept
Definition mdbx.h++:2910
bool rename_map(const ::std::string &old_name, const ::std::string &new_name, bool throw_if_absent=false)
Переименовывает таблицу ключ-значение.
constexpr buffer & assign(const buffer &src, bool make_reference=false)
Definition mdbx.h++:2273
buffer & append(const struct slice &chunk)
Definition mdbx.h++:2398
bool is_empty() const
Checks whether the database is empty.
buffer & append_decoded_base64(const struct slice &data, bool ignore_spaces=false)
Definition mdbx.h++:2444
void close(bool dont_sync=false)
Explicitly closes the environment and release the memory map.
move_result to_pair_greater_than(const slice &key, const slice &value, bool throw_notfound=true)
Definition mdbx.h++:4353
constexpr char * end_char_ptr() noexcept
Returns casted to pointer to char an end of data.
Definition mdbx.h++:1966
env & copy(const ::std::string &destination, bool compactify, bool force_dynamic_size=false)
move_operation
Definition mdbx.h++:4119
@ multi_exactkey_lowerboundvalue
Definition mdbx.h++:4134
@ multi_exactkey_value_equal
Definition mdbx.h++:4151
@ pair_greater_or_equal
Definition mdbx.h++:4159
@ key_lesser_than
Definition mdbx.h++:4141
@ next
Definition mdbx.h++:4122
@ pair_exact
Definition mdbx.h++:4158
@ multi_exactkey_value_greater_or_equal
Definition mdbx.h++:4152
@ pair_lesser_or_equal
Definition mdbx.h++:4156
@ batch_samelength
Definition mdbx.h++:4162
@ seek_key
Definition mdbx.h++:4136
@ key_lowerbound
Definition mdbx.h++:4138
@ pair_lesser_than
Definition mdbx.h++:4155
@ pair_equal
Definition mdbx.h++:4157
@ key_greater_than
Definition mdbx.h++:4145
@ batch_samelength_next
Definition mdbx.h++:4163
@ multi_find_pair
Definition mdbx.h++:4133
@ key_greater_or_equal
Definition mdbx.h++:4144
@ key_exact
Definition mdbx.h++:4137
@ key_equal
Definition mdbx.h++:4143
@ multi_currentkey_prevvalue
Definition mdbx.h++:4128
@ key_lesser_or_equal
Definition mdbx.h++:4142
@ multi_nextkey_firstvalue
Definition mdbx.h++:4131
@ get_current
Definition mdbx.h++:4124
@ multi_exactkey_value_lesser_or_equal
Definition mdbx.h++:4150
@ multi_prevkey_lastvalue
Definition mdbx.h++:4126
@ previous
Definition mdbx.h++:4123
@ last
Definition mdbx.h++:4121
@ pair_greater_than
Definition mdbx.h++:4160
@ multi_exactkey_value_lesser_than
Definition mdbx.h++:4149
@ multi_currentkey_firstvalue
Definition mdbx.h++:4127
@ first
Definition mdbx.h++:4120
@ batch_samelength_previous
Definition mdbx.h++:4164
@ multi_currentkey_nextvalue
Definition mdbx.h++:4129
@ seek_and_batch_samelength
Definition mdbx.h++:4165
@ multi_exactkey_value_greater
Definition mdbx.h++:4153
@ multi_currentkey_lastvalue
Definition mdbx.h++:4130
virtual ~env_managed() noexcept
bool move(move_operation operation, slice &key, slice &value, bool throw_notfound)
Definition mdbx.h++:4277
static buffer key_from(const char(&text)[SIZE], bool make_reference=true)
Definition mdbx.h++:2523
void insert(const pair &kv)
Definition mdbx.h++:4434
bool is_dirty(const slice &item) const
Checks whether the given slice is on a dirty page.
Definition mdbx.h++:3698
buffer & append(const void *src, size_t bytes)
Definition mdbx.h++:2382
cursor_managed(const cursor_managed &)=delete
env & operator=(const env &) noexcept=default
env_managed(const ::std::wstring &pathname, const create_parameters &, const operate_parameters &, bool accede=true)
void upsert(const pair &kv)
Definition mdbx.h++:4436
move_result to_current_prev_multi(bool throw_notfound=true)
Definition mdbx.h++:4289
void shrink_to_fit()
Reduces memory usage by freeing unused storage space.
Definition mdbx.h++:2380
txn_managed & operator=(const txn_managed &)=delete
static buffer key_from(const int32_t signed_int32)
Definition mdbx.h++:2573
void clear() noexcept
Clears the contents and storage.
Definition mdbx.h++:2372
bool clear_map(const ::std::string_view &name, bool throw_if_absent=false)
Definition mdbx.h++:3849
move_result to_exact_key_value_equal(const slice &key, const slice &value, bool throw_notfound=true)
Definition mdbx.h++:4328
static buffer base64(const slice &source, unsigned wrap_width=0, const allocator_type &alloc=allocator_type())
Returns a new buffer with a Base64 dump of the slice content.
Definition mdbx.h++:2124
constexpr buffer(const void *ptr, size_t bytes, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2053
typename ::std::allocator_traits< default_allocator >::template rebind_alloc< uint64_t > allocator_type
Definition mdbx.h++:1475
bool rename_map(const char *old_name, const char *new_name, bool throw_if_absent=false)
Переименовывает таблицу ключ-значение.
env_managed(const env_managed &)=delete
static buffer key_from(const double ieee754_64bit)
Definition mdbx.h++:2545
constexpr const byte * byte_ptr() const noexcept
Returns casted to const pointer to byte an address of data.
Definition mdbx.h++:1932
move_result to_current_last_multi(bool throw_notfound=true)
Definition mdbx.h++:4296
value_result try_insert(const pair &kv)
Definition mdbx.h++:4435
size_t put_multiple_samelength(const slice &key, const VALUE *values_array, size_t values_count, put_mode mode, bool allow_partial=false)
Definition mdbx.h++:4452
constexpr cursor() noexcept=default
move_result to_key_lesser_or_equal(const slice &key, bool throw_notfound=true)
Definition mdbx.h++:4306
size_t operator()(const ::mdbx::env &env) const noexcept
Definition mdbx.h++:6370
static buffer key_from_i64(const int64_t signed_int64)
Definition mdbx.h++:2553
constexpr const byte * end_byte_ptr() const noexcept
Returns casted to const pointer to byte an end of data.
Definition mdbx.h++:1935
static buffer base58(const slice &source, unsigned wrap_width=0, const allocator_type &alloc=allocator_type())
Returns a new buffer with a Base58 dump of the slice content.
Definition mdbx.h++:2119
static buffer clone(const buffer &src, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2249
move_result to_pair_greater_or_equal(const slice &key, const slice &value, bool throw_notfound=true)
Definition mdbx.h++:4350
size_t value_max(value_mode mode) const
Returns the maximal value size in bytes for specified values mode.
Definition mdbx.h++:3250
constexpr buffer(const char *c_str, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2062
static constexpr bool is_swap_nothrow() noexcept
Definition mdbx.h++:1891
MDBX_cursor * handle_
Definition mdbx.h++:4073
buffer & append_u8(uint_fast8_t u8)
Definition mdbx.h++:2448
~cursor_managed() noexcept
Definition mdbx.h++:4510
buffer & append_u24(uint_fast32_t u24)
Definition mdbx.h++:2468
buffer(buffer &&src) noexcept(move_assign_alloc::is_nothrow())
Definition mdbx.h++:2089
MDBX_dbi dbi
Definition mdbx.h++:2891
buffer(const ::std::basic_string< CHAR, T, A > &&)=delete
move_result to_exact_key_value_lesser_than(const slice &key, const slice &value, bool throw_notfound=true)
Definition mdbx.h++:4322
static buffer key_from(const uint64_t unsigned_int64)
Definition mdbx.h++:2551
move_result to_current_next_multi(bool throw_notfound=true)
Definition mdbx.h++:4293
buffer encode_base58(unsigned wrap_width=0, const allocator_type &alloc=allocator_type()) const
Definition mdbx.h++:2157
buffer & append_u64(uint_fast64_t u64)
Definition mdbx.h++:2505
std::hash< const MDBX_env * > inherited
Definition mdbx.h++:6369
buffer(const ::std::basic_string< CHAR, T, A > &)=delete
buffer & append_hex(const struct slice &data, bool uppercase=false, unsigned wrap_width=0)
Definition mdbx.h++:2424
static constexpr buffer null() noexcept
Build a null buffer which zero length and refers to null address.
Definition mdbx.h++:2101
size_t size_max() const
Returns maximal write transaction size (i.e. limit for summary volume of dirty pages) in bytes.
Definition mdbx.h++:3712
buffer & operator=(buffer &&src) noexcept(move_assign_alloc::is_nothrow())
Definition mdbx.h++:2354
env & copy(const ::std::wstring &destination, bool compactify, bool force_dynamic_size=false)
move_result to_exact_key_value_greater_than(const slice &key, const slice &value, bool throw_notfound=true)
Definition mdbx.h++:4334
txn_managed(const txn_managed &)=delete
friend int compare_position_nothrow(const cursor &left, const cursor &right, bool ignore_nested) noexcept
Definition mdbx.h++:6004
std::hash< const MDBX_cursor * > inherited
Definition mdbx.h++:6379
::MDBX_stat stat
Statistics for a database in the MDBX environment.
Definition mdbx.h++:3298
size_t value_min(value_mode mode) const noexcept
Returns the minimal value size in bytes for specified values mode.
Definition mdbx.h++:3248
constexpr void * end() noexcept
Return a pointer to the end of the referenced data.
Definition mdbx.h++:1986
value_result try_insert(map_handle map, const pair &kv)
Definition mdbx.h++:3926
buffer & append_producer(PRODUCER &producer)
Definition mdbx.h++:2410
void insert(map_handle map, const pair &kv)
Definition mdbx.h++:3925
buffer & append_producer(const PRODUCER &producer)
Definition mdbx.h++:2417
constexpr buffer(const ::std::basic_string< CHAR, T, A > &str, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2057
env_managed(const ::mdbx::filesystem::path &pathname, const create_parameters &, const operate_parameters &, bool accede=true)
Create new or open existing database.
static buffer key_from(const char *src, bool make_reference=false)
Definition mdbx.h++:2534
bool rename_map(const ::std::string_view &old_name, const ::std::string_view &new_name, bool throw_if_absent=false)
Переименовывает таблицу ключ-значение.
Definition mdbx.h++:3857
move_result to_key_equal(const slice &key, bool throw_notfound=true)
Definition mdbx.h++:4309
@ pettiness_threshold
Definition mdbx.h++:1489
@ max_length
Definition mdbx.h++:1482
@ max_capacity
Definition mdbx.h++:1483
@ extra_inplace_storage
Definition mdbx.h++:1484
@ inplace_storage_size_rounding
Definition mdbx.h++:1485
bool rename_map(const slice &old_name, const slice &new_name, bool throw_if_absent=false)
Переименовывает таблицу ключ-значение.
move_result to_previous(bool throw_notfound=true)
Definition mdbx.h++:4282
friend class txn
Definition mdbx.h++:1493
bool is_before_than(const cursor &other, bool ignore_nested=false) const
Definition mdbx.h++:4093
constexpr buffer(const struct slice &src, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2045
size_t key_min(key_mode mode) const noexcept
Returns the minimal key size in bytes for specified keys mode.
Definition mdbx.h++:3244
size_t operator()(const ::mdbx::txn &txn) const noexcept
Definition mdbx.h++:6375
constexpr size_t capacity() const noexcept
Returns the number of bytes that can be held in currently allocated storage.
Definition mdbx.h++:1915
size_t size_current() const
Returns current write transaction size (i.e.summary volume of dirty pages) in bytes.
Definition mdbx.h++:3715
constexpr buffer & set_length(size_t bytes)
Set length of data.
Definition mdbx.h++:1997
constexpr env_managed() noexcept=default
bool fullscan(CALLABLE_PREDICATE predicate, bool backward=false)
Definition mdbx.h++:4222
The chunk of data stored inside the buffer or located outside it.
Definition mdbx.h++:1471
Unmanaged cursor.
Definition mdbx.h++:4071
Managed cursor.
Definition mdbx.h++:4472
Unmanaged database environment.
Definition mdbx.h++:2959
Managed database environment.
Definition mdbx.h++:3579
Unmanaged database transaction.
Definition mdbx.h++:3661
Managed database transaction.
Definition mdbx.h++:4009
static size_t key_min(MDBX_db_flags_t flags) noexcept
Returns the minimal key size in bytes for specified table flags.
Definition mdbx.h++:5149
static constexpr intptr_t compare_fast(const pair &a, const pair &b) noexcept
Three-way fast non-lexicographically length-based comparison.
Definition mdbx.h++:5019
constexpr slice & set_end(const void *ptr)
Sets the length by specifying the end of the slice data.
Definition mdbx.h++:4806
polymorphic_allocator default_allocator
Definition mdbx.h++:356
constexpr size_t size() const noexcept
Returns the number of bytes.
Definition mdbx.h++:4815
constexpr slice safe_tail(size_t n) const
Returns the last "n" bytes of the slice.
Definition mdbx.h++:4897
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.
Definition mdbx.h++:4981
env & set_HandleSlowReaders(MDBX_hsr_func *)
Sets a Handle-Slow-Readers callback to resolve database full/overflow issue due to a reader(s) which ...
Definition mdbx.h++:5434
void * get_context() const noexcept
Returns the application context associated with the transaction.
Definition mdbx.h++:5499
static 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.
Definition mdbx.h++:5177
static constexpr intptr_t compare_fast(const slice &a, const slice &b) noexcept
Three-way fast non-lexicographically length-based comparison.
Definition mdbx.h++:4911
constexpr MDBX_error_t code() const noexcept
Returns error code.
Definition mdbx.h++:4634
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.
Definition mdbx.h++:5878
void renew(::mdbx::txn &txn)
Renew/bind a cursor with a new transaction and previously used key-value map handle.
Definition mdbx.h++:6115
value_mode
Kind of the values and sorted multi-values with corresponding comparison.
Definition mdbx.h++:2805
constexpr const void * end() const noexcept
Return a pointer to the ending of the referenced data.
Definition mdbx.h++:4793
MDBX_CXX11_CONSTEXPR_ENUM mdbx::key_mode key_mode() const noexcept
Definition mdbx.h++:5074
constexpr slice safe_head(size_t n) const
Returns the first "n" bytes of the slice.
Definition mdbx.h++:4891
void reset_reading()
Reset read-only transaction.
Definition mdbx.h++:5532
constexpr const char * char_ptr() const noexcept
Returns casted to pointer to char an address of data.
Definition mdbx.h++:4783
void success_or_panic(const char *context_where, const char *func_who) const noexcept
Definition mdbx.h++:4669
void rethrow_captured() const
Definition mdbx.h++:4606
constexpr const void * data() const noexcept
Return a pointer to the beginning of the referenced data.
Definition mdbx.h++:4791
move_result find_multivalue(const slice &key, const slice &value, bool throw_notfound=true)
Definition mdbx.h++:6073
ptrdiff_t estimate(move_operation operation, MDBX_val *key, MDBX_val *value) const
Definition mdbx.h++:6049
static size_t dbsize_max(intptr_t pagesize)
Returns the maximal database size in bytes for specified page size.
Definition mdbx.h++:5142
geometry & make_dynamic(intptr_t lower=default_value, intptr_t upper=default_value) noexcept
Definition mdbx.h++:5116
value_result try_update_reserve(map_handle map, const slice &key, size_t value_length)
Definition mdbx.h++:5841
value_result try_insert_reserve(map_handle map, const slice &key, size_t value_length)
Definition mdbx.h++:5795
void close_map(const map_handle &)
Close a key-value map (aka table) handle. Normally unnecessary.
Definition mdbx.h++:5396
env & set_sync_threshold(size_t bytes)
Sets threshold to force flush the data buffers to disk, for non-sync durability modes.
Definition mdbx.h++:5327
move_result(const cursor &cursor, bool throw_notfound)
Definition mdbx.h++:6017
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.
Definition mdbx.h++:4960
constexpr bool is_null() const noexcept
Checks whether the slice data pointer is nullptr.
Definition mdbx.h++:4813
ptrdiff_t estimate_from_first(map_handle map, const slice &to) const
Definition mdbx.h++:5951
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.
Definition mdbx.h++:4986
void remove_suffix(size_t n) noexcept
Drops the last "n" bytes from this slice.
Definition mdbx.h++:4838
slice & assign(const void *ptr, size_t bytes)
Definition mdbx.h++:4739
void unbind()
Unbind cursor from a transaction.
Definition mdbx.h++:6121
::std::chrono::duration< unsigned, ::std::ratio< 1, 65536 > > duration
Duration in 1/65536 units of second.
Definition mdbx.h++:423
slice insert_reserve(map_handle map, const slice &key, size_t value_length)
Definition mdbx.h++:5788
constexpr cursor(MDBX_cursor *ptr) noexcept
Definition mdbx.h++:5965
void rename_map(map_handle map, const char *new_name)
Переименовывает таблицу ключ-значение.
Definition mdbx.h++:5616
void throw_on_failure() const
Definition mdbx.h++:4646
bool try_update(const slice &key, const slice &value)
Definition mdbx.h++:6196
void update(const slice &key, const slice &value)
Definition mdbx.h++:6192
constexpr info(map_handle::flags flags, map_handle::state state) noexcept
Definition mdbx.h++:5071
int compare_keys(map_handle map, const slice &a, const slice &b) const noexcept
Compare two keys according to a particular key-value map (aka table).
Definition mdbx.h++:5687
constexpr slice & set_length(size_t bytes)
Set slice length.
Definition mdbx.h++:4801
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.
Definition mdbx.h++:4975
txn & set_context(void *your_context)
Sets the application context associated with the transaction.
Definition mdbx.h++:5501
txn_managed start_write(txn &parent)
Starts write (read-write) transaction.
Definition mdbx.h++:5462
int compare_position_nothrow(const cursor &left, const cursor &right, bool ignore_nested=false) noexcept
Definition mdbx.h++:6004
constexpr bool operator>(const slice &a, const slice &b) noexcept
Definition mdbx.h++:4937
env::durability get_durability() const
Returns current durability mode.
Definition mdbx.h++:5260
uint64_t sequence(map_handle map) const
Reads sequence generator associated with a key-value map (aka table).
Definition mdbx.h++:5675
void upsert(const slice &key, const slice &value)
Definition mdbx.h++:6182
bool is_clean() const noexcept
Definition mdbx.h++:4599
MDBX_CXX01_CONSTEXPR_ENUM bool is_reverse(key_mode mode) noexcept
Definition mdbx.h++:2798
static bool boolean_or_throw(int error_code)
Definition mdbx.h++:4689
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.
Definition mdbx.h++:4965
env::operate_parameters get_operation_parameters() const
Returns current operation parameters.
Definition mdbx.h++:5250
MDBX_CXX01_CONSTEXPR_ENUM bool is_msgpack(key_mode mode) noexcept
Definition mdbx.h++:2802
::std::basic_string< char, ::std::char_traits< char >, ALLOCATOR > string
Default single-byte string.
Definition mdbx.h++:379
MDBX_env_flags_t get_flags() const
Returns environment flags.
Definition mdbx.h++:5302
static size_t dbsize_min(intptr_t pagesize)
Returns the minimal database size in bytes for specified page size.
Definition mdbx.h++:5135
constexpr slice tail(size_t n) const noexcept
Returns the last "n" bytes of the slice.
Definition mdbx.h++:4881
constexpr error(MDBX_error_t error_code) noexcept
Definition mdbx.h++:4613
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.
Definition mdbx.h++:4991
constexpr const version_info & get_version() noexcept
Returns libmdbx version information.
Definition mdbx.h++:4541
buffer< ALLOCATOR, CAPACITY_POLICY > replace_reserve(map_handle map, const slice &key, slice &new_value, const typename buffer< ALLOCATOR, CAPACITY_POLICY >::allocator_type &alloc=buffer< ALLOCATOR, CAPACITY_POLICY >::allocator_type())
Definition mdbx.h++:5906
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
Definition mdbx.h++:5399
void insert(const slice &key, slice value)
Definition mdbx.h++:6143
move_result lower_bound_multivalue(const slice &key, const slice &value, bool throw_notfound=false)
Definition mdbx.h++:6077
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.
Definition mdbx.h++:5571
::std::pmr::string::allocator_type polymorphic_allocator
Default polymorphic allocator for modern code.
Definition mdbx.h++:355
MDBX_CXX01_CONSTEXPR_ENUM bool is_usual(key_mode mode) noexcept
Definition mdbx.h++:2786
MDBX_hsr_func * get_HandleSlowReaders() const noexcept
Returns the current Handle-Slow-Readers callback used to resolve database full/overflow issue due to ...
Definition mdbx.h++:5439
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.
Definition mdbx.h++:5001
constexpr slice() noexcept
Create an empty slice.
Definition mdbx.h++:4723
cursor_managed clone(void *your_context=nullptr) const
Definition mdbx.h++:5967
~cursor() noexcept
Definition mdbx.h++:5988
~txn() noexcept
Definition mdbx.h++:5483
size_t sync_threshold() const
Gets threshold used to force flush the data buffers to disk, for non-sync durability modes.
Definition mdbx.h++:5332
move_result upper_bound(const slice &key, bool throw_notfound=false)
Definition mdbx.h++:6069
uint64_t txnid
Transaction ID and MVCC-snapshot number.
Definition mdbx.h++:372
constexpr void invalidate() noexcept
Depletes content of slice and make it invalid.
Definition mdbx.h++:4819
inline ::mdbx::txn txn() const
Returns the cursor's transaction.
Definition mdbx.h++:6123
value_result try_insert_reserve(const slice &key, size_t value_length)
Definition mdbx.h++:6168
static env::operate_options options_from_flags(MDBX_env_flags_t flags) noexcept
Definition mdbx.h++:5127
map_handle map() const
Definition mdbx.h++:6128
unsigned sync_period__seconds_16dot16() const
Controls interprocess/shared relative period since the last unsteady commit to force flush the data b...
Definition mdbx.h++:5343
MDBX_CXX11_CONSTEXPR_ENUM mdbx::value_mode value_mode() const noexcept
Definition mdbx.h++:5078
move_result find(const slice &key, bool throw_notfound=true)
Definition mdbx.h++:6061
map_handle open_map_accede(const char *name) const
Open existing key-value map.
Definition mdbx.h++:5587
move_result upper_bound_multivalue(const slice &key, const slice &value, bool throw_notfound=false)
Definition mdbx.h++:6081
MDBX_CXX01_CONSTEXPR_ENUM bool is_multi(value_mode mode) noexcept
Definition mdbx.h++:2866
void success_or_throw() const
Definition mdbx.h++:4651
void renew_reading()
Renew read-only transaction.
Definition mdbx.h++:5536
constexpr bool ends_with(const slice &suffix) const noexcept
Checks if the data ends with the given suffix.
Definition mdbx.h++:4853
bool sync_to_disk(bool force=true, bool nonblock=false)
Flush the environment data buffers.
Definition mdbx.h++:5383
constexpr bool operator<=(const slice &a, const slice &b) noexcept
Definition mdbx.h++:4941
int compare_position(const cursor &left, const cursor &right, bool ignore_nested=false)
Definition mdbx.h++:6008
size_t count_multivalue() const
Return count of duplicates for current key.
Definition mdbx.h++:6087
constexpr bool starts_with(const slice &prefix) const noexcept
Checks if the data starts with the given prefix.
Definition mdbx.h++:4849
static size_t pagesize_max() noexcept
Returns the maximal database page size in bytes.
Definition mdbx.h++:5133
constexpr size_t hash_value() const noexcept
Returns the hash value of referenced data.
Definition mdbx.h++:4858
bool is_dirty(const void *ptr) const
Checks whether the given data is on a dirty page.
Definition mdbx.h++:5506
slice upsert_reserve(const slice &key, size_t value_length)
Definition mdbx.h++:6186
env::mode get_mode() const
Returns current operation mode.
Definition mdbx.h++:5258
MDBX_CXX01_CONSTEXPR_ENUM bool is_samelength(key_mode mode) noexcept
Definition mdbx.h++:2794
void capture() noexcept
Definition mdbx.h++:4601
inline ::mdbx::env env() const noexcept
Returns the transaction's environment.
Definition mdbx.h++:5518
uint32_t get_tree_deepmask(map_handle map) const
Returns depth (bitmask) information of nested dupsort (multi-value) B+trees for given table.
Definition mdbx.h++:5652
bool try_update(map_handle map, const slice &key, const slice &value)
Definition mdbx.h++:5823
void safe_remove_prefix(size_t n)
Drops the first "n" bytes from this slice.
Definition mdbx.h++:4832
comparator default_comparator(key_mode mode) noexcept
Definition mdbx.h++:2937
slice insert_reserve(const slice &key, size_t value_length)
Definition mdbx.h++:6161
static 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 size and table flags.
Definition mdbx.h++:5197
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,...
Definition mdbx.h++:5338
ptrdiff_t estimate(map_handle map, const pair &from, const pair &to) const
Definition mdbx.h++:5939
env::reclaiming_options get_reclaiming() const
Returns current reclaiming options.
Definition mdbx.h++:5264
void drop_map(map_handle map)
Drops key-value map using handle.
Definition mdbx.h++:5612
ptrdiff_t estimate_to_last(map_handle map, const slice &from) const
Definition mdbx.h++:5957
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 preser...
Definition mdbx.h++:5915
env::operate_options get_options() const
Returns current operate options.
Definition mdbx.h++:5268
void park_reading(bool autounpark=true)
Park read-only transaction.
Definition mdbx.h++:5538
constexpr bool operator>=(const slice &a, const slice &b) noexcept
Definition mdbx.h++:4945
cursor & set_context(void *your_context)
Sets the application context associated with the cursor.
Definition mdbx.h++:5975
map_stat get_map_stat(map_handle map) const
Returns statistics for a table.
Definition mdbx.h++:5646
bool move(move_operation operation, MDBX_val *key, MDBX_val *value, bool throw_notfound) const
Definition mdbx.h++:6027
static size_t value_min(MDBX_db_flags_t flags) noexcept
Returns the minimal values size in bytes for specified table flags.
Definition mdbx.h++:5173
int compare_values(map_handle map, const slice &a, const slice &b) const noexcept
Compare two values according to a particular key-value map (aka table).
Definition mdbx.h++:5691
static env::reclaiming_options reclaiming_from_flags(MDBX_env_flags_t flags) noexcept
Definition mdbx.h++:5123
txn & put_canary(const canary &)
Set integers markers (aka "canary") associated with the environment.
Definition mdbx.h++:5664
slice upsert_reserve(map_handle map, const slice &key, size_t value_length)
Definition mdbx.h++:5813
constexpr slice head(size_t n) const noexcept
Returns the first "n" bytes of the slice.
Definition mdbx.h++:4876
string to_string(const ::mdbx::slice &value)
Definition mdbx.h++:6279
constexpr bool is_result_false() const noexcept
Definition mdbx.h++:4628
env & set_sync_period__seconds_double(double seconds)
Sets relative period since the last unsteady commit to force flush the data buffers to disk,...
Definition mdbx.h++:5349
constexpr slice safe_middle(size_t from, size_t n) const
Returns the middle "n" bytes of the slice.
Definition mdbx.h++:4903
constexpr const byte * byte_ptr() const noexcept
Returns casted to pointer to byte an address of data.
Definition mdbx.h++:4775
bool on_first() const
Definition mdbx.h++:6095
::MDBX_version_info version_info
libmdbx version information,
Definition mdbx.h++:332
constexpr bool empty() const noexcept
Checks whether the slice is empty.
Definition mdbx.h++:4811
bool eof() const
Definition mdbx.h++:6093
void make_broken()
Marks transaction as broken to prevent further operations.
Definition mdbx.h++:5534
MDBX_txn_flags_t flags() const
Returns transaction's flags.
Definition mdbx.h++:5520
void * get_context() const noexcept
Returns the application context associated with the environment.
Definition mdbx.h++:5320
MDBX_error_t put(const slice &key, slice *value, MDBX_put_flags_t flags) noexcept
Definition mdbx.h++:6135
txn_managed prepare_read() const
Creates but not start read transaction.
Definition mdbx.h++:5448
::MDBX_build_info build_info
libmdbx build information
Definition mdbx.h++:336
constexpr txn(MDBX_txn *ptr) noexcept
Definition mdbx.h++:5473
void safe_remove_suffix(size_t n)
Drops the last "n" bytes from this slice.
Definition mdbx.h++:4843
bool seek(const slice &key)
Definition mdbx.h++:6085
env & alter_flags(MDBX_env_flags_t flags, bool on_off)
Alter environment flags.
Definition mdbx.h++:5372
env & set_context(void *your_context)
Sets the application context associated with the environment.
Definition mdbx.h++:5322
constexpr byte operator[](size_t n) const noexcept
Returns the nth byte in the referenced data.
Definition mdbx.h++:4865
static 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 fo...
Definition mdbx.h++:5241
void clear_map(map_handle map)
Clear key-value map.
Definition mdbx.h++:5614
env & set_extra_option(extra_runtime_option option, uint64_t value)
Sets the value of a extra runtime options for an environment.
Definition mdbx.h++:5361
bool is_base64(bool ignore_spaces=false) const noexcept
Checks whether the content of the slice is a Base64 dump.
Definition mdbx.h++:5013
void remove_prefix(size_t n) noexcept
Drops the first "n" bytes from this slice.
Definition mdbx.h++:4826
value_result try_insert(const slice &key, slice value)
Definition mdbx.h++:6148
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)
Definition mdbx.h++:6249
static void throw_on_nullptr(const void *ptr, MDBX_error_t error_code)
Definition mdbx.h++:4674
constexpr bool operator!=(const error &a, const error &b) noexcept
Definition mdbx.h++:4622
::MDBX_cmp_func * comparator
Definition mdbx.h++:2936
put_mode
Key-value pairs put mode.
Definition mdbx.h++:2945
static constexpr intptr_t compare_lexicographically(const pair &a, const pair &b) noexcept
Three-way lexicographically comparison.
Definition mdbx.h++:5024
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.
Definition mdbx.h++:4996
double sync_period__seconds_double() const
Controls interprocess/shared relative period since the last unsteady commit to force flush the data b...
Definition mdbx.h++:5353
::mdbx_filehandle_t filehandle
Definition mdbx.h++:381
static 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 ...
Definition mdbx.h++:5219
constexpr env(MDBX_env *ptr) noexcept
Definition mdbx.h++:5084
constexpr bool operator<(const slice &a, const slice &b) noexcept
Definition mdbx.h++:4933
char8_t byte
Definition mdbx.h++:316
canary get_canary() const
Returns fours integers markers (aka "canary") associated with the environment.
Definition mdbx.h++:5669
bool erase(bool whole_multivalue=false)
Removes single key-value pair or all multi-values at the current cursor position.
Definition mdbx.h++:6227
stat get_stat() const
Returns snapshot statistics about the MDBX environment.
Definition mdbx.h++:5272
uint64_t id() const
Return the transaction's ID.
Definition mdbx.h++:5526
value_result try_insert(map_handle map, const slice &key, slice value)
Definition mdbx.h++:5775
::std::string::allocator_type legacy_allocator
Legacy allocator but it is recommended to use polymorphic_allocator.
Definition mdbx.h++:350
constexpr bool is_mdbx_error() const noexcept
Returns true for MDBX's errors.
Definition mdbx.h++:4636
ptrdiff_t estimate(const cursor &from, const cursor &to)
Definition mdbx.h++:6055
static constexpr intptr_t compare_lexicographically(const slice &a, const slice &b) noexcept
Three-way lexicographically comparison.
Definition mdbx.h++:4918
slice update_reserve(map_handle map, const slice &key, size_t value_length)
Definition mdbx.h++:5835
bool is_base58(bool ignore_spaces=false) const noexcept
Checks whether the content of the slice is a Base58 dump.
Definition mdbx.h++:5009
~env() noexcept
Definition mdbx.h++:5094
loop_control
Loop control constants for readers enumeration functor and other cases.
Definition mdbx.h++:2767
slice get(map_handle map, const slice &key) const
Get value by key from a key-value map (aka table).
Definition mdbx.h++:5703
constexpr bool is_failure() const noexcept
Definition mdbx.h++:4630
constexpr void clear() noexcept
Makes the slice empty and referencing to nothing.
Definition mdbx.h++:4821
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)
Definition mdbx.h++:5920
void update(map_handle map, const slice &key, const slice &value)
Definition mdbx.h++:5819
constexpr byte at(size_t n) const
Returns the nth byte in the referenced data with bounds checking.
Definition mdbx.h++:4870
key_mode
Kinds of the keys and corresponding modes of comparing it.
Definition mdbx.h++:2770
txn_managed start_read() const
Starts read (read-only) transaction.
Definition mdbx.h++:5441
::mdbx::filesystem::path path
Definition mdbx.h++:405
bool on_last_multival() const
Definition mdbx.h++:6101
unsigned max_maps() const
Returns the maximum number of named tables for the environment.
Definition mdbx.h++:5314
void insert(map_handle map, const slice &key, slice value)
Definition mdbx.h++:5770
unsigned max_readers() const
Returns the maximum number of threads/reader slots for the environment.
Definition mdbx.h++:5308
static 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.
Definition mdbx.h++:5153
int enumerate_readers(VISITOR &visitor)
Enumerate readers.
Definition mdbx.h++:5404
void * get_context() const noexcept
Returns the application context associated with the cursor.
Definition mdbx.h++:5973
static size_t max_map_handles(void)
Returns the maximum opened map handles, aka DBI-handles.
Definition mdbx.h++:5248
cursor_managed open_cursor(map_handle map) const
Opens cursor for specified key-value map handle.
Definition mdbx.h++:5550
MDBX_CXX01_CONSTEXPR_ENUM bool is_ordinal(key_mode mode) noexcept
Definition mdbx.h++:2790
bool unpark_reading(bool restart_if_ousted=true)
Resume parked read-only transaction.
Definition mdbx.h++:5540
uint64_t extra_option(extra_runtime_option option) const
Gets the value of extra runtime options from an environment.
Definition mdbx.h++:5366
constexpr const build_info & get_build() noexcept
Returns libmdbx build information.
Definition mdbx.h++:4542
bool on_first_multival() const
Definition mdbx.h++:6099
MDBX_error_t put(map_handle map, const slice &key, slice *value, MDBX_put_flags_t flags) noexcept
Definition mdbx.h++:5762
void panic_on_failure(const char *context_where, const char *func_who) const noexcept
Definition mdbx.h++:4664
constexpr slice middle(size_t from, size_t n) const noexcept
Returns the middle "n" bytes of the slice.
Definition mdbx.h++:4886
info get_info() const
Return snapshot information about the MDBX environment.
Definition mdbx.h++:5284
void upsert(map_handle map, const slice &key, const slice &value)
Definition mdbx.h++:5809
static size_t pagesize_min() noexcept
Returns the minimal database page size in bytes.
Definition mdbx.h++:5131
string< ALLOCATOR > as_base64_string(unsigned wrap_width=0, const ALLOCATOR &alloc=ALLOCATOR()) const
Returns a string with a Base58 dump of the slice content.
Definition mdbx.h++:4970
slice update_reserve(const slice &key, size_t value_length)
Definition mdbx.h++:6208
move_result lower_bound(const slice &key, bool throw_notfound=false)
Definition mdbx.h++:6065
constexpr const byte * end_byte_ptr() const noexcept
Returns casted to pointer to byte an end of data.
Definition mdbx.h++:4777
constexpr size_t length() const noexcept
Returns the number of bytes.
Definition mdbx.h++:4799
unsigned check_readers()
Checks for stale readers in the lock table and return number of cleared slots.
Definition mdbx.h++:5427
bool erase(map_handle map, const slice &key)
Removes all values for given key.
Definition mdbx.h++:5854
constexpr bool is_result_true() const noexcept
Definition mdbx.h++:4626
bool on_last() const
Definition mdbx.h++:6097
buffer< ALLOCATOR, CAPACITY_POLICY > extract(map_handle map, const slice &key, const typename buffer< ALLOCATOR, CAPACITY_POLICY >::allocator_type &alloc=buffer< ALLOCATOR, CAPACITY_POLICY >::allocator_type())
Removes and return a value of the key.
Definition mdbx.h++:5885
#define MDBX_STD_FILESYSTEM_PATH
Defined if mdbx::filesystem::path is available.
Definition mdbx.h++:401
filehandle get_filehandle() const
Returns the file descriptor for the DXB file of MDBX environment.
Definition mdbx.h++:5296
env & set_geometry(const geometry &size)
Set all size-related parameters of environment.
Definition mdbx.h++:5377
map_handle::info get_handle_info(map_handle map) const
Returns information about key-value map (aka table) handle.
Definition mdbx.h++:5658
void bind(::mdbx::txn &txn, ::mdbx::map_handle map_handle)
Bind/renew a cursor with a new transaction and specified key-value map handle.
Definition mdbx.h++:6117
geometry & make_fixed(intptr_t size) noexcept
Definition mdbx.h++:5110
size_t release_all_cursors(bool unbind) const
Unbind or close all cursors.
Definition mdbx.h++:5556
constexpr bool operator==(const error &a, const error &b) noexcept
Definition mdbx.h++:4620
constexpr bool is_success() const noexcept
Definition mdbx.h++:4624
value_result try_update_reserve(const slice &key, size_t value_length)
Definition mdbx.h++:6214
buffer< default_allocator, default_capacity_policy > default_buffer
Default buffer.
Definition mdbx.h++:375
txn_managed try_start_write()
Tries to start write (read-write) transaction without blocking.
Definition mdbx.h++:5469
bool is_hex(bool ignore_spaces=false) const noexcept
Checks whether the content of the slice is a hexadecimal dump.
Definition mdbx.h++:5005
info get_info(bool scan_reader_lock_table=false) const
Returns information about the MDBX transaction.
Definition mdbx.h++:5544
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.
Definition mdbx.h++:5603
pair_result get_equal_or_great(map_handle map, const slice &key) const
Get value for equal or great key from a table.
Definition mdbx.h++:5741
constexpr const char * end_char_ptr() const noexcept
Returns casted to pointer to char an end of data.
Definition mdbx.h++:4785
@ multi_reverse_samelength
Definition mdbx.h++:2838
@ multi_samelength
Definition mdbx.h++:2823
@ multi_ordinal
Definition mdbx.h++:2830
@ msgpack
Definition mdbx.h++:2853
@ single
Definition mdbx.h++:2806
@ multi
Definition mdbx.h++:2808
@ multi_reverse
Definition mdbx.h++:2815
@ upsert
Insert or update.
Definition mdbx.h++:2947
@ update
Update existing, don't insert new.
Definition mdbx.h++:2948
@ insert_unique
Insert only unique keys.
Definition mdbx.h++:2946
@ continue_loop
Definition mdbx.h++:2767
@ exit_loop
Definition mdbx.h++:2767
@ usual
Definition mdbx.h++:2771
@ ordinal
Definition mdbx.h++:2776
@ reverse
Definition mdbx.h++:2773
@ msgpack
Definition mdbx.h++:2781
A handle for an individual table (aka key-value space, maps or sub-database) in the environment.
Definition mdbx.h++:2890
buffer< ALLOCATOR, CAPACITY_POLICY > as_buffer(const ALLOCATOR &alloc=ALLOCATOR()) const
Returns a buffer with a Base58 dump of a passed slice.
Definition mdbx.h++:1264
buffer< ALLOCATOR, CAPACITY_POLICY > as_buffer(const ALLOCATOR &alloc=ALLOCATOR()) const
Returns a buffer with a hexadecimal dump of a passed slice.
Definition mdbx.h++:1216
constexpr ::std::span< byte > bytes()
Definition mdbx.h++:698
static constexpr slice wrap(const char(&text)[SIZE])
Definition mdbx.h++:711
buffer< ALLOCATOR, CAPACITY_POLICY > as_buffer(const ALLOCATOR &alloc=ALLOCATOR()) const
Returns a buffer with a Base64 dump of a passed slice.
Definition mdbx.h++:1310
constexpr slice(const ::std::span< POD > &span)
Definition mdbx.h++:674
constexpr slice(const ::std::basic_string< CHAR, T, A > &str)
Create a slice that refers to the contents of "str".
Definition mdbx.h++:665
buffer_pair_spec(const txn &transacton, const slice &key, const slice &value, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2722
const slice source
Definition mdbx.h++:1293
bool is_erroneous() const noexcept
Checks whether the content of a passed slice is a valid Base58 dump, and therefore there could be dec...
slice & assign(::std::basic_string_view< CHAR, T > &&view)
Definition mdbx.h++:733
int8_t as_int8_adapt() const
buffer< ALLOCATOR, CAPACITY_POLICY > buffer_type
Definition mdbx.h++:2689
constexpr uint16_t as_uint16() const
Definition mdbx.h++:1029
constexpr size_t envisage_result_length() const noexcept
Returns the buffer size in bytes needed for Base58 dump of passed slice.
Definition mdbx.h++:1270
slice & operator=(::std::basic_string_view< CHAR, T > &&view)
Definition mdbx.h++:751
static constexpr slice null() noexcept
Build a null slice which zero length and refers to null address.
Definition mdbx.h++:1010
constexpr uint32_t as_uint32() const
Definition mdbx.h++:1028
buffer_pair_spec(buffer_pair_spec &&pair) noexcept(buffer_type::move_assign_alloc::is_nothrow())
Definition mdbx.h++:2730
constexpr int64_t as_int64() const
Definition mdbx.h++:1035
const bool ignore_spaces
Definition mdbx.h++:1385
void swap(::std::basic_string_view< CHAR, T > &view) noexcept
Definition mdbx.h++:855
value_result & operator=(const value_result &) noexcept=default
buffer_type value
Definition mdbx.h++:2694
bool is_printable(bool disable_utf8=false) const noexcept
Checks whether the content of the slice is printable.
int128_t as_int128_adapt() const
char * write_bytes(char *dest, size_t dest_size) const
Fills the destination with data decoded from Base64 dump from a passed slice.
constexpr ::std::basic_string< CHAR, T, ALLOCATOR > as_string(const ALLOCATOR &alloc=ALLOCATOR()) const
Definition mdbx.h++:768
buffer_pair_spec(const buffer_type &key, const buffer_type &value, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2700
constexpr int16_t as_int16() const
Definition mdbx.h++:1037
slice value
Definition mdbx.h++:2630
::std::ostream & output(::std::ostream &out) const
Output Base64 dump of passed slice to the std::ostream.
buffer_pair_spec(const buffer_type &key, const buffer_type &value, bool make_reference, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2702
constexpr bool is_reference() const noexcept
Definition mdbx.h++:2740
bool is_empty() const noexcept
Checks whether a passed slice is empty, and therefore there will be no output bytes.
Definition mdbx.h++:1237
slice value
Definition mdbx.h++:2644
::std::pair< buffer_type, buffer_type > stl_pair
Definition mdbx.h++:2693
::std::ostream & output(::std::ostream &out) const
Output hexadecimal dump of passed slice to the std::ostream.
pair_result(const pair_result &) noexcept=default
buffer< ALLOCATOR, CAPACITY_POLICY > as_buffer(const ALLOCATOR &alloc=ALLOCATOR()) const
Decodes Base64 dump from a passed slice to returned buffer.
Definition mdbx.h++:1444
const slice source
Definition mdbx.h++:1384
buffer_pair_spec(const slice &key, const slice &value, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2711
const slice source
Definition mdbx.h++:1200
constexpr size_t envisage_result_length() const noexcept
Returns the number of bytes needed for conversion hexadecimal dump from a passed slice to decoded dat...
Definition mdbx.h++:1367
const unsigned wrap_width
Definition mdbx.h++:1202
slice & assign(const ::std::basic_string< CHAR, T, ALLOCATOR > &str)
Definition mdbx.h++:725
constexpr bool is_freestanding() const noexcept
Definition mdbx.h++:2735
const bool ignore_spaces
Definition mdbx.h++:1347
constexpr POD as_pod() const
Definition mdbx.h++:1012
char * write_bytes(char *dest, size_t dest_size) const
Fills the destination with data decoded from Base58 dump from a passed slice.
constexpr pair_result() noexcept
Definition mdbx.h++:2677
pair & operator=(const pair &) noexcept=default
bool is_empty() const noexcept
Checks whether a passed slice is empty, and therefore there will be no output bytes.
Definition mdbx.h++:1459
buffer_pair_spec(const stl_pair &pair, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2706
constexpr uint128_t as_uint128() const
Definition mdbx.h++:1025
uint16_t as_uint16_adapt() const
buffer< ALLOCATOR, CAPACITY_POLICY > as_buffer(const ALLOCATOR &alloc=ALLOCATOR()) const
Decodes hexadecimal dump from a passed slice to returned buffer.
Definition mdbx.h++:1361
constexpr to_hex(const slice &source, bool uppercase=false, unsigned wrap_width=0) noexcept
Definition mdbx.h++:1203
buffer_pair_spec(const stl_pair &pair, bool make_reference, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2708
static constexpr size_t advise(const size_t current, const size_t wanna, const size_t inplace)
Definition mdbx.h++:1176
slice & operator=(const ::std::basic_string_view< CHAR, T > &view)
Definition mdbx.h++:747
std::pair< slice, slice > stl_pair
Definition mdbx.h++:2643
value_result(const value_result &) noexcept=default
constexpr slice(const slice &) noexcept=default
@ pettiness_threshold
Definition mdbx.h++:1164
@ extra_inplace_storage
Definition mdbx.h++:1162
@ max_reserve
Definition mdbx.h++:1165
@ inplace_storage_size_rounding
Definition mdbx.h++:1163
constexpr ::std::span< POD > as_span()
Definition mdbx.h++:688
constexpr from_base58(const slice &source, bool ignore_spaces=false) noexcept
Definition mdbx.h++:1386
buffer_type key
Definition mdbx.h++:2694
constexpr int8_t as_int8() const
Definition mdbx.h++:1038
constexpr ::std::span< char > chars()
Definition mdbx.h++:700
constexpr slice(size_t invalid_length) noexcept
Definition mdbx.h++:1057
constexpr size_t envisage_result_length() const noexcept
Returns the buffer size in bytes needed for Base64 dump of passed slice.
Definition mdbx.h++:1316
static constexpr size_t round(const size_t value)
Definition mdbx.h++:1168
bool is_empty() const noexcept
Checks whether a passed slice is empty, and therefore there will be no output bytes.
Definition mdbx.h++:1284
constexpr size_t envisage_result_length() const noexcept
Returns the number of bytes needed for conversion Base64 dump from a passed slice to decoded data.
Definition mdbx.h++:1450
value_result(const slice &value, bool done) noexcept
Definition mdbx.h++:2632
bool is_empty() const noexcept
Checks whether a passed slice is empty, and therefore there will be no output bytes.
Definition mdbx.h++:1417
const slice source
Definition mdbx.h++:1247
constexpr pair(const stl_pair &couple) noexcept
Definition mdbx.h++:2646
constexpr ::std::span< const char > chars() const
Definition mdbx.h++:699
constexpr from_base64(const slice &source, bool ignore_spaces=false) noexcept
Definition mdbx.h++:1429
bool is_erroneous() const noexcept
Checks whether the content of a passed slice is a valid data and could be encoded or unexpectedly not...
Definition mdbx.h++:1241
uint8_t as_uint8_adapt() const
constexpr ::std::span< const POD > as_span() const
Definition mdbx.h++:679
string< ALLOCATOR > as_string(const ALLOCATOR &alloc=ALLOCATOR()) const
Decodes Base64 dump from a passed slice to returned string.
Definition mdbx.h++:1437
constexpr size_t envisage_result_length() const noexcept
Returns the number of bytes needed for conversion Base58 dump from a passed slice to decoded data.
Definition mdbx.h++:1407
slice & assign(const ::std::basic_string_view< CHAR, T > &view)
Definition mdbx.h++:730
constexpr ::std::basic_string_view< CHAR, T > string_view() const noexcept
Return a string_view that references the same data as this slice.
Definition mdbx.h++:755
bool is_empty() const noexcept
Checks whether a passed slice is empty, and therefore there will be no output bytes.
Definition mdbx.h++:1374
int32_t as_int32_adapt() const
@ max_length
Definition mdbx.h++:644
constexpr pair_result(const slice &key, const slice &value, bool done) noexcept
Definition mdbx.h++:2678
constexpr from_hex(const slice &source, bool ignore_spaces=false) noexcept
Definition mdbx.h++:1348
char * write_bytes(char *dest, size_t dest_size) const
Fills the buffer by hexadecimal dump of a passed slice.
static constexpr pair invalid() noexcept
Definition mdbx.h++:2654
bool done
Definition mdbx.h++:2676
::std::ostream & output(::std::ostream &out) const
Output Base58 dump of passed slice to the std::ostream.
bool is_erroneous() const noexcept
Checks whether the content of a passed slice is a valid data and could be encoded or unexpectedly not...
Definition mdbx.h++:1287
constexpr ::std::span< const byte > bytes() const
Definition mdbx.h++:697
static constexpr slice wrap(const POD &pod)
Definition mdbx.h++:713
string< ALLOCATOR > as_string(const ALLOCATOR &alloc=ALLOCATOR()) const
Returns a string with a hexadecimal dump of a passed slice.
Definition mdbx.h++:1210
const bool uppercase
Definition mdbx.h++:1201
string< ALLOCATOR > as_string(const ALLOCATOR &alloc=ALLOCATOR()) const
Decodes hexadecimal dump from a passed slice to returned string.
Definition mdbx.h++:1355
string< ALLOCATOR > as_string(const ALLOCATOR &alloc=ALLOCATOR()) const
Returns a string with a Base58 dump of a passed slice.
Definition mdbx.h++:1257
string< ALLOCATOR > as_string(const ALLOCATOR &alloc=ALLOCATOR()) const
Returns a string with a Base64 dump of a passed slice.
Definition mdbx.h++:1303
string< ALLOCATOR > as_string(const ALLOCATOR &alloc=ALLOCATOR()) const
Decodes Base58 dump from a passed slice to returned string.
Definition mdbx.h++:1394
buffer_pair_spec(const pair &pair, bool make_reference, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2719
void make_freestanding()
Definition mdbx.h++:2746
const bool ignore_spaces
Definition mdbx.h++:1428
constexpr to_base64(const slice &source, unsigned wrap_width=0) noexcept
Definition mdbx.h++:1296
pair(const pair &) noexcept=default
static constexpr slice invalid() noexcept
Build an invalid slice which non-zero length and refers to null address.
Definition mdbx.h++:1005
bool is_erroneous() const noexcept
Checks whether the content of a passed slice is a valid Base64 dump, and therefore there could be dec...
slice & operator=(const slice &) noexcept=default
uint128_t as_uint128_adapt() const
constexpr int128_t as_int128() const
Definition mdbx.h++:1033
slice key
Definition mdbx.h++:2644
constexpr pair(const slice &key, const slice &value) noexcept
Definition mdbx.h++:2645
buffer_pair_spec(const txn &transaction, const pair &pair, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2725
const slice source
Definition mdbx.h++:1427
pair_result & operator=(const pair_result &) noexcept=default
bool is_empty() const noexcept
Checks whether a passed slice is empty, and therefore there will be no output bytes.
Definition mdbx.h++:1333
typename buffer_type::allocator_traits allocator_traits
Definition mdbx.h++:2691
char * write_bytes(char *dest, size_t dest_size) const
Fills the destination with data decoded from hexadecimal dump from a passed slice.
constexpr int32_t as_int32() const
Definition mdbx.h++:1036
int64_t as_int64_adapt() const
buffer_pair_spec(const pair &pair, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2717
constexpr uint8_t as_uint8() const
Definition mdbx.h++:1030
CAPACITY_POLICY reservation_policy
Definition mdbx.h++:2692
constexpr uint64_t as_uint64() const
Definition mdbx.h++:1027
buffer_pair_spec(const slice &key, const slice &value, bool make_reference, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2713
bool is_erroneous() const noexcept
Checks whether the content of a passed slice is a valid hexadecimal dump, and therefore there could b...
const unsigned wrap_width
Definition mdbx.h++:1248
const unsigned wrap_width
Definition mdbx.h++:1294
buffer< ALLOCATOR, CAPACITY_POLICY > as_buffer(const ALLOCATOR &alloc=ALLOCATOR()) const
Decodes Base58 dump from a passed slice to returned buffer.
Definition mdbx.h++:1401
uint32_t as_uint32_adapt() const
constexpr bool is_valid() const noexcept
Checks the slice is not refers to null address or has zero length.
Definition mdbx.h++:1002
char * write_bytes(char *dest, size_t dest_size) const
Fills the buffer by Base64 dump of passed slice.
buffer_pair_spec(buffer_type &&key, buffer_type &&value) noexcept(buffer_type::move_assign_alloc::is_nothrow())
Definition mdbx.h++:2728
constexpr slice(const ::std::basic_string_view< CHAR, T > &sv)
Create a slice that refers to the same contents as "string_view".
Definition mdbx.h++:706
int16_t as_int16_adapt() const
typename buffer_type::allocator_type allocator_type
Definition mdbx.h++:2690
bool is_erroneous() const noexcept
Checks whether the content of a passed slice is a valid data and could be encoded or unexpectedly not...
Definition mdbx.h++:1337
uint64_t as_uint64_adapt() const
constexpr buffer_pair_spec() noexcept=default
constexpr to_base58(const slice &source, unsigned wrap_width=0) noexcept
Definition mdbx.h++:1250
slice(::std::basic_string_view< CHAR, T > &&sv)
Definition mdbx.h++:708
constexpr size_t envisage_result_length() const noexcept
Returns the buffer size in bytes needed for hexadecimal dump of a passed slice.
Definition mdbx.h++:1222
bool done
Definition mdbx.h++:2631
char * write_bytes(char *dest, size_t dest_size) const
Fills the buffer by Base58 dump of passed slice.
const slice source
Definition mdbx.h++:1346
buffer< ALLOCATOR, CAPACITY_POLICY > make_buffer(PRODUCER &producer, const ALLOCATOR &alloc=ALLOCATOR())
Definition mdbx.h++:2579
string< ALLOCATOR > make_string(PRODUCER &producer, const ALLOCATOR &alloc=ALLOCATOR())
Definition mdbx.h++:2601
buffer_pair< default_buffer > default_buffer_pair
Default pair of buffers.
Definition mdbx.h++:2759
inline ::std::ostream & operator<<(::std::ostream &out, const to_hex &wrapper)
Definition mdbx.h++:1340
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.
Definition mdbx.h++:2756
Type tag for delivered buffer template classes.
Definition mdbx.h++:1468
Base58 decoder which satisfy SliceTranscoder concept.
Definition mdbx.h++:1383
Base64 decoder which satisfy SliceTranscoder concept.
Definition mdbx.h++:1426
Hexadecimal decoder which satisfy SliceTranscoder concept.
Definition mdbx.h++:1345
Combines pair of slices for key and value to represent result of certain operations.
Definition mdbx.h++:2642
Combines pair of slices for key and value with boolean flag to represent result of certain operations...
Definition mdbx.h++:2675
References a data located outside the slice.
Definition mdbx.h++:639
Base58 encoder which satisfy SliceTranscoder concept.
Definition mdbx.h++:1246
Base64 encoder which satisfy SliceTranscoder concept.
Definition mdbx.h++:1292
Hexadecimal encoder which satisfy SliceTranscoder concept.
Definition mdbx.h++:1199
Combines data slice with boolean flag to represent result of certain operations.
Definition mdbx.h++:2629
incompatible_operation(const ::mdbx::error &)
fatal(exception &&src) noexcept
Definition mdbx.h++:521
remote_media(const ::mdbx::error &)
dangling_map_id(const ::mdbx::error &)
constexpr friend bool operator!=(const error &a, const error &b) noexcept
Definition mdbx.h++:4622
fatal(const ::mdbx::error &) noexcept
reader_slot_busy(const ::mdbx::error &)
exception(const exception &)=default
::std::string message() const
Returns message for any errors.
not_found(const ::mdbx::error &)
operation_not_permitted(const ::mdbx::error &)
key_exists(const ::mdbx::error &)
permission_denied_or_not_writeable(const ::mdbx::error &)
void throw_exception() const
fatal(const exception &src) noexcept
Definition mdbx.h++:520
no_data(const ::mdbx::error &)
transaction_full(const ::mdbx::error &)
exception(exception &&)=default
db_too_large(const ::mdbx::error &)
bad_map_id(const ::mdbx::error &)
transaction_overlapping(const ::mdbx::error &)
void panic(const char *context_where_when, const char *func_who_what) const noexcept
Panics on unrecoverable errors inside destructors etc.
static void success_or_throw(int error_code)
Definition mdbx.h++:489
db_full(const ::mdbx::error &)
duplicated_lck_file(const ::mdbx::error &)
const ::mdbx::error error() const noexcept
Definition mdbx.h++:511
error(const error &)=default
virtual ~fatal() noexcept
something_busy(const ::mdbx::error &)
fatal & operator=(fatal &&)=default
const char * what() const noexcept
Returns message for MDBX's errors only and "SYSTEM" for others.
fatal(const fatal &src) noexcept
Definition mdbx.h++:522
transaction_ousted(const ::mdbx::error &)
key_mismatch(const ::mdbx::error &)
db_invalid(const ::mdbx::error &)
exception & operator=(exception &&)=default
db_wanna_write_for_recovery(const ::mdbx::error &)
error & operator=(error &&)=default
bad_transaction(const ::mdbx::error &)
internal_problem(const ::mdbx::error &)
multivalue(const ::mdbx::error &)
fatal(fatal &&src) noexcept
Definition mdbx.h++:523
fatal & operator=(const fatal &)=default
max_readers_reached(const ::mdbx::error &)
db_version_mismatch(const ::mdbx::error &)
exception_thunk() noexcept=default
exception & operator=(const exception &)=default
exception(const ::mdbx::error &) noexcept
db_unable_extend(const ::mdbx::error &)
constexpr friend bool operator==(const error &a, const error &b) noexcept
Definition mdbx.h++:4620
error & operator=(const error &)=default
virtual ~exception() noexcept
thread_mismatch(const ::mdbx::error &)
db_corrupted(const ::mdbx::error &)
internal_page_full(const ::mdbx::error &)
mvcc_retarded(const ::mdbx::error &)
max_maps_reached(const ::mdbx::error &)
bad_value_size(const ::mdbx::error &)
Implements error information and throwing corresponding exceptions.
Definition mdbx.h++:448
Transfers C++ exceptions thru C callbacks.
Definition mdbx.h++:433
LIBMDBX_API void throw_allocators_mismatch()
#define MDBX_DECLARE_EXCEPTION(NAME)
Definition mdbx.h++:529
LIBMDBX_API void throw_incomparable_cursors()
LIBMDBX_API void throw_out_range()
LIBMDBX_API void throw_bad_value_size()
LIBMDBX_API void throw_max_length_exceeded()
LIBMDBX_API void throw_too_small_target_buffer()
uint64_t mdbx_key_from_int64(const int64_t i64)
Definition mdbx.h:4706
LIBMDBX_API uint32_t mdbx_key_from_ptrfloat(const float *const ieee754_32bit)
LIBMDBX_API uint64_t mdbx_key_from_double(const double ieee754_64bit)
LIBMDBX_API uint32_t mdbx_key_from_float(const float ieee754_32bit)
LIBMDBX_API uint64_t mdbx_key_from_ptrdouble(const double *const ieee754_64bit)
uint32_t mdbx_key_from_int32(const int32_t i32)
Definition mdbx.h:4710
LIBMDBX_API uint64_t mdbx_key_from_jsonInteger(const int64_t json_integer)
#define MDBX_CXX20_CONSTEXPR
Definition mdbx.h++:172
#define MDBX_CXX17_FALLTHROUGH
Definition mdbx.h++:230
#define MDBX_EXTERN_API_TEMPLATE(API_ATTRIBUTES, API_TYPENAME)
Definition mdbx.h++:110
#define MDBX_ASSERT_CXX20_CONCEPT_SATISFIED(CONCEPT, TYPE)
Definition mdbx.h++:270
#define MDBX_LIKELY(cond)
Definition mdbx.h++:205
#define MDBX_CXX11_CONSTEXPR_ENUM
Definition mdbx.h++:182
#define MDBX_UNLIKELY(cond)
Definition mdbx.h++:213
#define MDBX_CXX17_CONSTEXPR
Definition mdbx.h++:161
#define MDBX_CONSTEXPR_ASSERT(expr)
Definition mdbx.h++:200
#define MDBX_IF_CONSTEXPR
Definition mdbx.h++:221
#define MDBX_CXX01_CONSTEXPR_ENUM
Definition mdbx.h++:181
#define MDBX_CXX20_LIKELY
Definition mdbx.h++:236
The libmdbx C API header file.
constexpr bool allocator_is_always_equal() noexcept
Definition mdbx.h++:1064
The libmdbx C++ API namespace.
Definition mdbx.h++:303
byte buffer_[inplace_size - sizeof(byte)]
Definition mdbx.h++:1561
constexpr inplace_flag_holder(byte signature)
Definition mdbx.h++:1563
byte lastbyte_
Definition mdbx.h++:1562
estimate_result(const cursor &cursor, move_operation operation)
Definition mdbx.h++:4186
estimate_result & operator=(const estimate_result &) noexcept=default
ptrdiff_t approximate_quantity
Definition mdbx.h++:4185
estimate_result(const estimate_result &) noexcept=default
estimate_result(const cursor &cursor, move_operation operation, const slice &key)
Definition mdbx.h++:4188
move_result & operator=(const move_result &) noexcept=default
move_result(const move_result &) noexcept=default
move_result(cursor &cursor, move_operation operation, const slice &key, bool throw_notfound)
Definition mdbx.h++:4176
move_result(cursor &cursor, move_operation operation, bool throw_notfound)
Definition mdbx.h++:4174
Tagged type for output to std::ostream.
Definition mdbx.h++:3011
intptr_t bytes
Definition mdbx.h++:3012
constexpr size(intptr_t bytes) noexcept
Definition mdbx.h++:3013
Database geometry for size management.
Definition mdbx.h++:2987
constexpr geometry(const geometry &) noexcept=default
intptr_t size_upper
The upper bound of database size in bytes.
Definition mdbx.h++:3035
intptr_t pagesize
The database page size for new database creation or default_value otherwise.
Definition mdbx.h++:3047
@ GB
bytes (0x3B9A_CA00)
Definition mdbx.h++:2994
@ minimal_value
Means "minimal acceptable".
Definition mdbx.h++:2990
@ MB
bytes (0x000F_4240)
Definition mdbx.h++:2993
@ GiB
bytes (0x4000_0000)
Definition mdbx.h++:3002
@ maximal_value
Means "maximal acceptable".
Definition mdbx.h++:2991
@ default_value
Means "keep current or use default".
Definition mdbx.h++:2989
@ kB
bytes (0x03E8)
Definition mdbx.h++:2992
@ MiB
bytes (0x0010_0000)
Definition mdbx.h++:3001
@ KiB
bytes (0x0400)
Definition mdbx.h++:3000
constexpr geometry() noexcept
Definition mdbx.h++:3051
intptr_t growth_step
The growth step in bytes, must be greater than zero to allow the database to grow.
Definition mdbx.h++:3038
intptr_t size_now
The size in bytes to setup the database size for now.
Definition mdbx.h++:3023
intptr_t shrink_threshold
The shrink threshold in bytes, must be greater than zero to allow the database to shrink.
Definition mdbx.h++:3041
intptr_t size_lower
The lower bound of database size in bytes.
Definition mdbx.h++:3018
constexpr geometry(intptr_t size_lower, intptr_t size_now=default_value, intptr_t size_upper=default_value, intptr_t growth_step=default_value, intptr_t shrink_threshold=default_value, intptr_t pagesize=default_value) noexcept
Definition mdbx.h++:3054
Operate options.
Definition mdbx.h++:3091
bool disable_readahead
Definition mdbx.h++:3100
bool enable_validation
Definition mdbx.h++:3104
bool no_sticky_threads
Definition mdbx.h++:3093
constexpr operate_options() noexcept
Definition mdbx.h++:3105
bool disable_clear_memory
Definition mdbx.h++:3102
constexpr operate_options & operator=(const operate_options &) noexcept=default
bool exclusive
Definition mdbx.h++:3098
constexpr operate_options(const operate_options &) noexcept=default
bool nested_write_transactions
Разрешает вложенные транзакции ценой отключения MDBX_WRITEMAP и увеличением накладных расходов.
Definition mdbx.h++:3096
operate_options(MDBX_env_flags_t) noexcept
Operate parameters.
Definition mdbx.h++:3113
env::durability durability
Definition mdbx.h++:3121
env::operate_options options
Definition mdbx.h++:3123
constexpr operate_parameters(const unsigned max_maps, const unsigned max_readers=0, const env::mode mode=env::mode::write_mapped_io, env::durability durability=env::durability::robust_synchronous, const env::reclaiming_options &reclaiming=env::reclaiming_options(), const env::operate_options &options=env::operate_options()) noexcept
Definition mdbx.h++:3127
static env::mode mode_from_flags(MDBX_env_flags_t) noexcept
constexpr operate_parameters & operator=(const operate_parameters &) noexcept=default
unsigned max_readers
The maximum number of threads/reader slots for the environment. Zero means default value.
Definition mdbx.h++:3119
constexpr operate_parameters(const operate_parameters &) noexcept=default
env::reclaiming_options reclaiming
Definition mdbx.h++:3122
env::mode mode
Definition mdbx.h++:3120
static env::durability durability_from_flags(MDBX_env_flags_t) noexcept
unsigned max_maps
The maximum number of named tables/maps for the environment. Zero means default value.
Definition mdbx.h++:3116
constexpr operate_parameters() noexcept
Definition mdbx.h++:3125
MDBX_env_flags_t make_flags(bool accede=true, bool use_subdirectory=false) const
Reader information.
Definition mdbx.h++:3493
mdbx_tid_t thread
The reader thread ID.
Definition mdbx.h++:3496
uint64_t transaction_lag
Definition mdbx.h++:3499
size_t bytes_used
Definition mdbx.h++:3503
uint64_t transaction_id
Definition mdbx.h++:3497
int slot
The reader lock table slot number.
Definition mdbx.h++:3494
mdbx_pid_t pid
The reader process ID.
Definition mdbx.h++:3495
size_t bytes_retained
Definition mdbx.h++:3506
Garbage reclaiming options.
Definition mdbx.h++:3078
constexpr reclaiming_options(const reclaiming_options &) noexcept=default
bool coalesce
Definition mdbx.h++:3082
reclaiming_options(MDBX_env_flags_t) noexcept
constexpr reclaiming_options & operator=(const reclaiming_options &) noexcept=default
constexpr reclaiming_options() noexcept
Definition mdbx.h++:3083
bool lifo
Definition mdbx.h++:3080
Additional parameters for creating a new database.
Definition mdbx.h++:3602
mdbx_mode_t file_mode_bits
Definition mdbx.h++:3604
constexpr create_parameters() noexcept=default
bool use_subdirectory
Definition mdbx.h++:3605
env::geometry geometry
Definition mdbx.h++:3603
map_handle::state state
Definition mdbx.h++:2927
info(const info &) noexcept=default
map_handle::flags flags
Definition mdbx.h++:2926
info & operator=(const info &) noexcept=default
capacity_holder capacity_
Definition mdbx.h++:1567
constexpr byte * make_allocated(const ::std::pair< allocator_pointer, size_t > &pair) noexcept
Definition mdbx.h++:1600
constexpr bool is_inplace() const noexcept
Definition mdbx.h++:1579
static constexpr size_t advise_capacity(const size_t current, const size_t wanna)
Definition mdbx.h++:1620
static constexpr bool is_suitable_for_inplace(size_t capacity_bytes) noexcept
Definition mdbx.h++:1571
constexpr bool is_allocated() const noexcept
Definition mdbx.h++:1586
inplace_flag_holder inplace_
Definition mdbx.h++:1568
static constexpr size_t inplace_capacity() noexcept
Definition mdbx.h++:1570
allocator_pointer allocated_ptr_
Definition mdbx.h++:1566
size_t stub_capacity_bytes_
Definition mdbx.h++:1543
constexpr size_t capacity() const noexcept
Definition mdbx.h++:1639
byte pad_[inplace_size - sizeof(allocator_pointer)]
Definition mdbx.h++:1556
size_t bytes_
Definition mdbx.h++:1557
constexpr const byte * address() const noexcept
Definition mdbx.h++:1633
constexpr bin() noexcept
Definition mdbx.h++:1614
@ inplace_size
Definition mdbx.h++:1551
@ inplace_signature_limit
Definition mdbx.h++:1548
@ inplace_size_rounding
Definition mdbx.h++:1550
constexpr byte * address() noexcept
Definition mdbx.h++:1636
@ lastbyte_poison
Definition mdbx.h++:1546
@ lastbyte_inplace_signature
Definition mdbx.h++:1546
constexpr bool is_inplace(const void *ptr) const noexcept
Definition mdbx.h++:1629
constexpr byte * make_inplace() noexcept
Definition mdbx.h++:1588
allocator_pointer ptr_
Definition mdbx.h++:1542