44#if defined(__SIZEOF_INT128__) && !defined(__GLIBCXX_TYPE_INT_N_0) && defined(__clang__) && __clang_major__ < 4
45#define __GLIBCXX_BITSIZE_INT_N_0 128
46#define __GLIBCXX_TYPE_INT_N_0 __int128
49#if !defined(__cplusplus) || __cplusplus < 201103L
50#if !defined(_MSC_VER) || _MSC_VER < 1900
51#error "C++11 compiler or better is required"
53#error "Please add `/Zc:__cplusplus` to MSVC compiler options to enforce it conform ISO C++"
57#if (defined(_WIN32) || defined(_WIN64)) && MDBX_WITHOUT_MSVC_CRT && !defined(__CODEGEARC__)
58#error "CRT is required for C++ API, the MDBX_WITHOUT_MSVC_CRT option must be disabled"
62#define __has_include(header) (0)
65#if __has_include(<version>)
87#if defined(__cpp_lib_memory_resource) && __cpp_lib_memory_resource >= 201603L
88#include <memory_resource>
91#if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L
95#ifndef MDBX_USING_CXX_EXPERIMENTAL_FILESYSTEM
96#ifdef MDBX_USING_CXX_EXPERIMETAL_FILESYSTEM
98#define MDBX_USING_CXX_EXPERIMENTAL_FILESYSTEM MDBX_USING_CXX_EXPERIMETAL_FILESYSTEM
99#elif defined(INCLUDE_STD_FILESYSTEM_EXPERIMENTAL)
100#define MDBX_USING_CXX_EXPERIMENTAL_FILESYSTEM 1
101#elif defined(__cpp_lib_filesystem) && __cpp_lib_filesystem >= 201703L && __cplusplus >= 201703L
102#define MDBX_USING_CXX_EXPERIMENTAL_FILESYSTEM 0
103#elif (!defined(_MSC_VER) || __cplusplus >= 201403L || \
104 (defined(_MSC_VER) && defined(_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING) && __cplusplus >= 201403L))
105#if defined(__cpp_lib_experimental_filesystem) && __cpp_lib_experimental_filesystem >= 201406L
106#define MDBX_USING_CXX_EXPERIMENTAL_FILESYSTEM 1
107#elif defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L && __has_include(<experimental/filesystem>)
108#define MDBX_USING_CXX_EXPERIMENTAL_FILESYSTEM 1
110#define MDBX_USING_CXX_EXPERIMENTAL_FILESYSTEM 0
113#define MDBX_USING_CXX_EXPERIMENTAL_FILESYSTEM 0
117#if MDBX_USING_CXX_EXPERIMENTAL_FILESYSTEM
118#include <experimental/filesystem>
119#elif defined(__cpp_lib_filesystem) && __cpp_lib_filesystem >= 201703L
123#if defined(__cpp_lib_span) && __cpp_lib_span >= 202002L
127#if !defined(_MSC_VER)
128#define MDBX_EXTERN_API_TEMPLATE(API_ATTRIBUTES, ...) extern template class API_ATTRIBUTES __VA_ARGS__
129#define MDBX_INSTALL_API_TEMPLATE(API_ATTRIBUTES, ...) template class __VA_ARGS__
131#define MDBX_EXTERN_API_TEMPLATE(API_ATTRIBUTES, ...) extern template class __VA_ARGS__
132#define MDBX_INSTALL_API_TEMPLATE(API_ATTRIBUTES, ...) template class API_ATTRIBUTES __VA_ARGS__
135#if defined(_MSC_VER) && _MSC_VER >= 1900
136#define MDBX_MSVC_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
138#define MDBX_MSVC_DECLSPEC_EMPTY_BASES
141#if __cplusplus >= 201103L
148#if (defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L) || \
149 (defined(__cpp_lib_endian) && __cpp_lib_endian >= 201907L) || \
150 (defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L) || \
151 (defined(__cpp_lib_int_pow2) && __cpp_lib_int_pow2 >= 202002L)
153#elif !(defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__))
154#if defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && defined(__BIG_ENDIAN)
155#define __ORDER_LITTLE_ENDIAN__ __LITTLE_ENDIAN
156#define __ORDER_BIG_ENDIAN__ __BIG_ENDIAN
157#define __BYTE_ORDER__ __BYTE_ORDER
158#elif defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN)
159#define __ORDER_LITTLE_ENDIAN__ _LITTLE_ENDIAN
160#define __ORDER_BIG_ENDIAN__ _BIG_ENDIAN
161#define __BYTE_ORDER__ _BYTE_ORDER
163#define __ORDER_LITTLE_ENDIAN__ 1234
164#define __ORDER_BIG_ENDIAN__ 4321
165#if defined(__LITTLE_ENDIAN__) || (defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)) || defined(__ARMEL__) || \
166 defined(__THUMBEL__) || defined(__AARCH64EL__) || defined(__MIPSEL__) || defined(_MIPSEL) || defined(__MIPSEL) || \
167 defined(_M_ARM) || defined(_M_ARM64) || defined(__e2k__) || defined(__elbrus_4c__) || defined(__elbrus_8c__) || \
168 defined(__bfin__) || defined(__BFIN__) || defined(__ia64__) || defined(_IA64) || defined(__IA64__) || \
169 defined(__ia64) || defined(_M_IA64) || defined(__itanium__) || defined(__ia32__) || defined(__CYGWIN__) || \
170 defined(_WIN64) || defined(_WIN32) || defined(__TOS_WIN__) || defined(__WINDOWS__)
171#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
172#elif defined(__BIG_ENDIAN__) || (defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)) || defined(__ARMEB__) || \
173 defined(__THUMBEB__) || defined(__AARCH64EB__) || defined(__MIPSEB__) || defined(_MIPSEB) || defined(__MIPSEB) || \
174 defined(__m68k__) || defined(M68000) || defined(__hppa__) || defined(__hppa) || defined(__HPPA__) || \
175 defined(__sparc__) || defined(__sparc) || defined(__370__) || defined(__THW_370__) || defined(__s390__) || \
176 defined(__s390x__) || defined(__SYSC_ZARCH__)
177#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
184#define MDBX_CXX17_CONSTEXPR constexpr
185#elif defined(__cpp_constexpr) && __cpp_constexpr >= 201603L && \
186 ((defined(_MSC_VER) && _MSC_VER >= 1915) || (defined(__clang__) && __clang_major__ > 5) || \
187 (defined(__GNUC__) && __GNUC__ > 7) || (!defined(__GNUC__) && !defined(__clang__) && !defined(_MSC_VER)))
188#define MDBX_CXX17_CONSTEXPR constexpr
190#define MDBX_CXX17_CONSTEXPR inline
195#define MDBX_CXX20_CONSTEXPR constexpr
196#elif defined(__cpp_lib_is_constant_evaluated) && __cpp_lib_is_constant_evaluated >= 201811L && \
197 defined(__cpp_lib_constexpr_string) && __cpp_lib_constexpr_string >= 201907L
198#define MDBX_CXX20_CONSTEXPR constexpr
200#define MDBX_CXX20_CONSTEXPR inline
203#if MDBX_CONSTEXPR_ENUM_FLAGS_OPERATIONS || defined(DOXYGEN)
204#define MDBX_CXX01_CONSTEXPR_ENUM MDBX_CXX01_CONSTEXPR
205#define MDBX_CXX11_CONSTEXPR_ENUM MDBX_CXX11_CONSTEXPR
206#define MDBX_CXX14_CONSTEXPR_ENUM MDBX_CXX14_CONSTEXPR
207#define MDBX_CXX17_CONSTEXPR_ENUM MDBX_CXX17_CONSTEXPR
208#define MDBX_CXX20_CONSTEXPR_ENUM MDBX_CXX20_CONSTEXPR
210#define MDBX_CXX01_CONSTEXPR_ENUM inline
211#define MDBX_CXX11_CONSTEXPR_ENUM inline
212#define MDBX_CXX14_CONSTEXPR_ENUM inline
213#define MDBX_CXX17_CONSTEXPR_ENUM inline
214#define MDBX_CXX20_CONSTEXPR_ENUM inline
218#if defined(CONSTEXPR_ASSERT)
219#define MDBX_CONSTEXPR_ASSERT(expr) CONSTEXPR_ASSERT(expr)
220#elif defined(NDEBUG) && (!defined(MDBX_CHECKING) || !MDBX_CHECKING) && (!defined(MDBX_DEBUG) || !MDBX_DEBUG)
221#define MDBX_CONSTEXPR_ASSERT(expr) void(0)
223#define MDBX_CONSTEXPR_ASSERT(expr) ((expr) ? void(0) : [] { assert(!#expr); }())
228#define MDBX_IF_CONSTEXPR constexpr
229#elif defined(__cpp_if_constexpr) && __cpp_if_constexpr >= 201606L
230#define MDBX_IF_CONSTEXPR constexpr
232#define MDBX_IF_CONSTEXPR
235#if defined(DOXYGEN) || (__has_cpp_attribute(fallthrough) && (!defined(__clang__) || __clang__ > 4)) || \
236 __cplusplus >= 201703L
237#define MDBX_CXX17_FALLTHROUGH [[fallthrough]]
239#define MDBX_CXX17_FALLTHROUGH
242#if defined(DOXYGEN) || (__has_cpp_attribute(likely) >= 201803L && (!defined(__GNUC__) || __GNUC__ > 9))
243#define MDBX_CXX20_LIKELY [[likely]]
245#define MDBX_CXX20_LIKELY
248#ifndef MDBX_CXX20_UNLIKELY
249#if defined(DOXYGEN) || (__has_cpp_attribute(unlikely) >= 201803L && (!defined(__GNUC__) || __GNUC__ > 9))
250#define MDBX_CXX20_UNLIKELY [[unlikely]]
252#define MDBX_CXX20_UNLIKELY
257#ifndef MDBX_NODISCARD
258#if defined(DOXYGEN) || __cplusplus >= 201703L
259#define MDBX_NODISCARD [[nodiscard]]
261#define MDBX_NODISCARD
265#ifndef MDBX_HAVE_CXX20_CONCEPTS
266#if defined(__cpp_concepts) && __cpp_concepts >= 202002L && defined(__cpp_lib_concepts) && __cpp_lib_concepts >= 202002L
268#define MDBX_HAVE_CXX20_CONCEPTS 1
269#elif defined(DOXYGEN)
270#define MDBX_HAVE_CXX20_CONCEPTS 1
272#define MDBX_HAVE_CXX20_CONCEPTS 0
276#ifndef MDBX_CXX20_CONCEPT
277#if MDBX_HAVE_CXX20_CONCEPTS || defined(DOXYGEN)
278#define MDBX_CXX20_CONCEPT(CONCEPT, NAME) CONCEPT NAME
280#define MDBX_CXX20_CONCEPT(CONCEPT, NAME) typename NAME
284#ifndef MDBX_ASSERT_CXX20_CONCEPT_SATISFIED
285#if MDBX_HAVE_CXX20_CONCEPTS || defined(DOXYGEN)
286#define MDBX_ASSERT_CXX20_CONCEPT_SATISFIED(CONCEPT, TYPE) static_assert(CONCEPT<TYPE>)
288#define MDBX_ASSERT_CXX20_CONCEPT_SATISFIED(CONCEPT, NAME) \
289 static_assert(true, MDBX_STRINGIFY(CONCEPT) "<" MDBX_STRINGIFY(TYPE) ">")
294#pragma warning(push, 4)
295#pragma warning(disable : 4127)
296#pragma warning(disable : 4251)
298#pragma warning(disable : 4275)
303#pragma warning(disable : 4702)
306#if defined(__LCC__) && __LCC__ >= 126
307#pragma diagnostic push
309#pragma diag_suppress 3058
311#pragma diag_suppress 3060
341#if defined(DOXYGEN) || (defined(__cpp_char8_t) && __cpp_char8_t >= 201811)
345using byte =
unsigned char;
348#if defined(__cpp_lib_endian) && __cpp_lib_endian >= 201907L
349using endian = ::std::endian;
350#elif defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__)
351enum class endian { little = __ORDER_LITTLE_ENDIAN__, big = __ORDER_BIG_ENDIAN__, native = __BYTE_ORDER__ };
353#error "Please use a C++ compiler provides byte order information or C++20 support"
380#define MDBX_CXX_HAS_POLYMORPHIC_ALLOCATOR 1
381#elif !defined(MDBX_CXX_HAS_POLYMORPHIC_ALLOCATOR)
382#if defined(__cpp_lib_memory_resource) && __cpp_lib_memory_resource >= 201603L && \
383 (!defined(_GLIBCXX_USE_CXX11_ABI) || _GLIBCXX_USE_CXX11_ABI)
384#define MDBX_CXX_HAS_POLYMORPHIC_ALLOCATOR 1
386#define MDBX_CXX_HAS_POLYMORPHIC_ALLOCATOR 0
390#if defined(DOXYGEN) || MDBX_CXX_HAS_POLYMORPHIC_ALLOCATOR
400template <
class ALLOCATOR = default_allocator,
class CAPACITY_POLICY = default_capacity_policy>
413template <
class ALLOCATOR = default_allocator>
414using string = ::std::basic_string<char, ::std::char_traits<char>, ALLOCATOR>;
417#if MDBX_USING_CXX_EXPERIMETAL_FILESYSTEM
419namespace filesystem = ::std::experimental::filesystem::v1;
421namespace filesystem = ::std::experimental::filesystem;
423#define MDBX_STD_FILESYSTEM_PATH ::mdbx::filesystem::path
424#elif defined(DOXYGEN) || \
425 (defined(__cpp_lib_filesystem) && __cpp_lib_filesystem >= 201703L && defined(__cpp_lib_string_view) && \
426 __cpp_lib_string_view >= 201606L && \
427 (!defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500) && \
428 (!defined(__IPHONE_OS_VERSION_MIN_REQUIRED) || __IPHONE_OS_VERSION_MIN_REQUIRED >= 130100)) && \
429 (!defined(_MSC_VER) || __cplusplus >= 201703L)
430namespace filesystem = ::std::filesystem;
436#define MDBX_STD_FILESYSTEM_PATH ::mdbx::filesystem::path
439#ifdef MDBX_STD_FILESYSTEM_PATH
442#elif defined(_WIN32) || defined(_WIN64)
443using path = ::std::wstring;
446using path = ::std::string;
451#if defined(__SIZEOF_INT128__) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 128)
452#ifndef MDBX_U128_TYPE
453#define MDBX_U128_TYPE __uint128_t
455#ifndef MDBX_I128_TYPE
456#define MDBX_I128_TYPE __int128_t
460#if __cplusplus >= 201103L || defined(DOXYGEN)
462using duration = ::std::chrono::duration<unsigned, ::std::ratio<1, 65536>>;
473 ::std::exception_ptr captured_;
481 inline
bool is_clean() const noexcept;
482 inline
void capture() noexcept;
510 const
char *
what() const noexcept;
526 static inline void throw_on_failure(
int error_code);
527 static inline bool boolean_or_throw(
int error_code);
528 static inline void success_or_throw(
int error_code,
const exception_thunk &);
529 static inline bool boolean_or_throw(
int error_code,
const exception_thunk &);
535 using base = ::std::runtime_error;
553 fatal(const ::mdbx::error &)
noexcept;
563#define MDBX_DECLARE_EXCEPTION(NAME) \
564 struct LIBMDBX_API_TYPE NAME : public exception { \
565 NAME(const ::mdbx::error &); \
566 virtual ~NAME() noexcept; \
601#undef MDBX_DECLARE_EXCEPTION
617 return check_length(check_length(headroom) + check_length(payload));
621 return check_length(check_length(headroom, payload) + check_length(tailroom));
663 template <
class CHAR,
class T,
class A>
672#if defined(DOXYGEN) || (defined(__cpp_lib_span) && __cpp_lib_span >= 202002L)
674 static_assert(::std::is_standard_layout<POD>::value && !::std::is_pointer<POD>::value,
675 "Must be a standard layout type!");
678 template <
typename POD> MDBX_CXX14_CONSTEXPR ::std::span<const POD>
as_span()
const {
679 static_assert(::std::is_standard_layout<POD>::value && !::std::is_pointer<POD>::value,
680 "Must be a standard layout type!");
683 return ::std::span<const POD>(
static_cast<const POD *
>(
data()),
size() /
sizeof(POD));
687 template <
typename POD> MDBX_CXX14_CONSTEXPR ::std::span<POD>
as_span() {
688 static_assert(::std::is_standard_layout<POD>::value && !::std::is_pointer<POD>::value,
689 "Must be a standard layout type!");
692 return ::std::span<POD>(
static_cast<POD *
>(
data()),
size() /
sizeof(POD));
702#if defined(DOXYGEN) || (defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L)
704 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.size() *
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.data(), view.size() *
sizeof(CHAR));
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);
926 inline
void remove_prefix(
size_t n) noexcept;
930 inline
void remove_suffix(
size_t n) noexcept;
934 inline
void safe_remove_prefix(
size_t n);
938 inline
void safe_remove_suffix(
size_t n);
984 return middle(pos, (::std::min)(count,
size() - pos));
1002 size_t pos = 0) const noexcept;
1009 size_t pos = npos) const noexcept;
1016 size_t pos = 0) const noexcept;
1023 size_t pos = npos) const noexcept;
1072 const
slice &b) noexcept;
1079#if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L
1090 return slice( ~
size_t(0));
1097 static_assert(::std::is_standard_layout<POD>::value && !::std::is_pointer<POD>::value,
1098 "Must be a standard layout type!");
1102 memcpy(&_as_pod_local,
data(),
sizeof(_as_pod_local));
1103 return _as_pod_local;
1108#ifdef MDBX_U128_TYPE
1116#ifdef MDBX_I128_TYPE
1124#ifdef MDBX_U128_TYPE
1132#ifdef MDBX_I128_TYPE
1167 key.assign(std::move(couple.key));
1168 value.assign(std::move(couple.value));
1178 key.assign(couple.first);
1179 value.assign(couple.second);
1183 key.assign(std::move(couple.first));
1184 value.assign(std::move(couple.second));
1193 const pair &b)
noexcept;
1200#if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L
1227 return ::mdbx_key_from_jsonInteger(json_integer);
1230inline uint64_t
key_from_double(
double ieee754_64bit)
noexcept { return ::mdbx_key_from_double(ieee754_64bit); }
1233 return ::mdbx_key_from_ptrdouble(ieee754_64bit);
1236inline uint32_t
key_from_float(
float ieee754_32bit)
noexcept { return ::mdbx_key_from_float(ieee754_32bit); }
1239 return ::mdbx_key_from_ptrfloat(ieee754_32bit);
1242inline uint64_t
key_from_int64(int64_t i64)
noexcept { return ::mdbx_key_from_int64(i64); }
1244inline uint32_t
key_from_int32(int32_t i32)
noexcept { return ::mdbx_key_from_int32(i32); }
1266 ::std::string result(value.
length() * 2 + 4,
'\0');
1267 const char *
const ptr =
::mdbx_dump_val(&value, &result[0], result.size());
1274#if MDBX_HAVE_CXX20_CONCEPTS || defined(DOXYGEN)
1279template <
typename T>
1281 { a.is_empty() } -> std::same_as<bool>;
1282 { a.envisage_result_length() } -> std::same_as<size_t>;
1283 { a.write_bytes(&array[0],
size_t(42)) } -> std::same_as<char *>;
1289template <
typename T>
1291 { a.is_empty() } -> std::same_as<bool>;
1292 { a.envisage_result_length() } -> std::same_as<size_t>;
1293 { a.write_bytes(&array[0],
size_t(42)) } -> std::same_as<char *>;
1299template <
typename T>
1302 { a.is_erroneous() } -> std::same_as<bool>;
1318 template <
class ALLOCATOR = default_allocator>
1322 template <
class ALLOCATOR = default_allocator,
typename CAPACITY_POLICY = default_capacity_policy>
1328 const size_t bytes =
source.length() << 1;
1338 ::std::ostream &
output(::std::ostream &out)
const;
1361 template <
class ALLOCATOR = default_allocator>
1366 template <
class ALLOCATOR = default_allocator,
typename CAPACITY_POLICY = default_capacity_policy>
1372 const size_t bytes = (
source.length() * 11 + 7) / 8;
1382 ::std::ostream &
output(::std::ostream &out)
const;
1404 template <
class ALLOCATOR = default_allocator>
1409 template <
class ALLOCATOR = default_allocator,
typename CAPACITY_POLICY = default_capacity_policy>
1415 const size_t bytes = (
source.length() + 2) / 3 * 4;
1427 ::std::ostream &
output(::std::ostream &out)
const;
1448 template <
class ALLOCATOR = default_allocator>
1452 template <
class ALLOCATOR = default_allocator,
typename CAPACITY_POLICY = default_capacity_policy>
1483 template <
class ALLOCATOR = default_allocator>
1488 template <
class ALLOCATOR = default_allocator,
typename CAPACITY_POLICY = default_capacity_policy>
1523 template <
class ALLOCATOR = default_allocator>
1528 template <
class ALLOCATOR = default_allocator,
typename CAPACITY_POLICY = default_capacity_policy>
1553#if defined(__cpp_lib_allocator_traits_is_always_equal) && __cpp_lib_allocator_traits_is_always_equal >= 201411L
1554 return ::std::allocator_traits<A>::is_always_equal::value;
1556 return ::std::is_empty<A>::value;
1560template <
typename T,
typename A =
typename T::allocator_type,
1561 bool PoCMA = ::std::allocator_traits<A>::propagate_on_container_move_assignment::value>
1566 static constexpr bool is_nothrow() noexcept {
return is_always_equal(); }
1571 return target->get_allocator() == source.get_allocator();
1576template <
typename T,
typename A>
struct move_assign_alloc<T, A, true> {
1577 static constexpr bool is_always_equal() noexcept {
return allocator_is_always_equal<A>(); }
1578 static constexpr bool is_nothrow() noexcept { return ::std::is_nothrow_move_assignable<A>::value; }
1579 static constexpr bool is_moveable(T *, T &)
noexcept {
return true; }
1582 target->get_allocator() = ::std::move(source.get_allocator());
1586template <
typename T,
typename A =
typename T::allocator_type,
1587 bool PoCCA = ::std::allocator_traits<A>::propagate_on_container_copy_assignment::value>
1592 static constexpr bool is_nothrow() noexcept {
return false; }
1596template <
typename T,
typename A>
struct copy_assign_alloc<T, A, true> {
1597 static constexpr bool is_always_equal() noexcept {
return allocator_is_always_equal<A>(); }
1598 static constexpr bool is_nothrow() noexcept {
1599 return is_always_equal() || ::std::is_nothrow_copy_assignable<A>::value;
1601 static MDBX_CXX20_CONSTEXPR void propagate(T *target,
const T &source)
noexcept(is_nothrow()) {
1603 if (
MDBX_UNLIKELY(target->get_allocator() != source.get_allocator())) {
1605 MDBX_CXX20_UNLIKELY target->get_allocator() = source.get_allocator();
1615template <
typename T,
typename A =
typename T::allocator_type,
1616 bool PoCS = ::std::allocator_traits<A>::propagate_on_container_swap::value>
1619template <
typename T,
typename A>
struct swap_alloc<T, A, false> {
1621 static constexpr bool is_nothrow() noexcept {
return is_always_equal(); }
1624 if (
MDBX_UNLIKELY(left.get_allocator() != right.get_allocator()))
1634template <
typename T,
typename A>
struct swap_alloc<T, A, true> {
1635 static constexpr bool is_always_equal() noexcept {
return allocator_is_always_equal<A>(); }
1636 static constexpr bool is_nothrow() noexcept {
1637 return is_always_equal() ||
1638#if defined(__cpp_lib_is_swappable) && __cpp_lib_is_swappable >= 201603L
1639 ::std::is_nothrow_swappable<A>() ||
1641 (::std::is_nothrow_move_constructible<A>::value && ::std::is_nothrow_move_assignable<A>::value);
1645#if !defined(__cpp_if_constexpr) || __cpp_if_constexpr < 201606L
1649 ::std::swap(left.get_allocator(), right.get_allocator());
1670 static_assert(
pettiness_threshold >=
sizeof(uint64_t),
"pettiness_threshold must be > 7");
1679 if (wanna <= inplace && (current <= inplace || current >= std::max(inplace + inplace,
size_t(
pettiness_threshold))))
1682 if (wanna > current)
1686 if (current - wanna >
1690 return round(wanna);
1701template <
class ALLOCATOR,
typename CAPACITY_POLICY>
1705#if !defined(_MSC_VER) || _MSC_VER > 1900
1706 using allocator_type = typename ::std::allocator_traits<ALLOCATOR>::template rebind_alloc<uint64_t>;
1708 using allocator_type =
typename ALLOCATOR::template rebind<uint64_t>::other;
1718 ?
alignof(max_align_t) * 2
1732 using allocator_pointer =
typename allocator_traits::pointer;
1733 using allocator_const_pointer =
typename allocator_traits::const_pointer;
1734 using move_assign_alloc = allocation_aware_details::move_assign_alloc<silo, allocator_type>;
1735 using copy_assign_alloc = allocation_aware_details::copy_assign_alloc<silo, allocator_type>;
1736 using swap_alloc = allocation_aware_details::swap_alloc<silo, allocator_type>;
1738 MDBX_CXX20_CONSTEXPR ::std::pair<allocator_pointer, size_t> allocate_storage(
size_t bytes) {
1740 constexpr size_t unit =
sizeof(
typename allocator_type::value_type);
1741 static_assert((unit & (unit - 1)) == 0,
"size of ALLOCATOR::value_type should be a power of 2");
1742 static_assert(unit > 0,
"size of ALLOCATOR::value_type must be > 0");
1743 const size_t n = (bytes + unit - 1) / unit;
1744 return ::std::make_pair(allocator_traits::allocate(get_allocator(), n), n * unit);
1748 constexpr size_t unit =
sizeof(
typename allocator_type::value_type);
1750 allocator_traits::deallocate(get_allocator(), ptr, bytes / unit);
1753 MDBX_CXX20_CONSTEXPR ::std::pair<allocator_pointer, size_t> provide_storage(
size_t bytes) {
1754 const size_t capacity = bin::advise_capacity(0, bytes);
1755 return bin::is_suitable_for_inplace(capacity) ? ::std::pair<allocator_pointer, size_t>(
nullptr, capacity)
1756 : allocate_storage(capacity);
1760#if defined(__cpp_lib_to_address) && __cpp_lib_to_address >= 201711L
1761 return static_cast<void *
>(::std::to_address(ptr));
1763 return static_cast<void *
>(::std::addressof(*ptr));
1768#if defined(__cpp_lib_to_address) && __cpp_lib_to_address >= 201711L
1769 return static_cast<const void *
>(::std::to_address(ptr));
1771 return static_cast<const void *
>(::std::addressof(*ptr));
1776#pragma warning(push)
1777#pragma warning(disable : 4324)
1780 union alignas(max_align_t)
bin {
1791 << (
sizeof(
size_t ) - 1) * CHAR_BIT,
1814 static_assert((size_t(reservation_policy::inplace_storage_size_rounding) &
1815 (size_t(reservation_policy::inplace_storage_size_rounding) - 1)) == 0,
1816 "CAPACITY_POLICY::inplace_storage_size_rounding must be power of 2");
1823 static_assert(std::numeric_limits<size_t>::max() - (std::numeric_limits<size_t>::max() >> CHAR_BIT) ==
1849 if (::std::is_trivial<allocator_pointer>::value)
1858 const size_t advised = reservation_policy::advise(current, wanna,
inplace_capacity());
1880 constexpr bool is_inplace(
const void *ptr)
const noexcept {
return bin_.is_inplace(ptr); }
1883 if (bin_.is_allocated()) {
1884 deallocate_storage(bin_.allocated_ptr_, bin_.capacity_.bytes_);
1886 bin_.allocated_ptr_.~allocator_pointer();
1887 bin_.inplace_.lastbyte_ = bin::lastbyte_inplace_signature;
1891 template <
bool external_content>
1893 const void *
const content,
const size_t length) {
1895 const size_t old_capacity = bin_.capacity();
1896 const size_t new_capacity = bin::advise_capacity(old_capacity, wanna_capacity);
1900 byte *
const new_place = bin_.address() + wanna_headroom;
1903 if (external_content)
1905 ::std::memmove(new_place, content, length);
1907 const size_t old_headroom = bin_.address() -
static_cast<const byte *
>(content);
1910 MDBX_CXX20_UNLIKELY ::std::memmove(new_place, content, length);
1916 if (bin::is_suitable_for_inplace(new_capacity)) {
1918 const auto old_allocated = bin_.allocated_ptr_;
1919 byte *
const new_place = bin_.make_inplace() + wanna_headroom;
1922 deallocate_storage(old_allocated, old_capacity);
1926 if (bin_.is_inplace()) {
1927 const auto pair = allocate_storage(new_capacity);
1929 byte *
const new_place =
static_cast<byte *
>(to_address(pair.first)) + wanna_headroom;
1934 bin_.make_allocated(pair);
1938 auto pair = allocate_storage(new_capacity);
1939 std::swap(bin_.allocated_ptr_, pair.first);
1940 bin_.capacity_.bytes_ = pair.second;
1941 auto new_place = bin_.address() + wanna_headroom;
1944 deallocate_storage(pair.first, old_capacity);
1950 return bin_.address() + offset;
1954 return bin_.address() + offset;
1958 return static_cast<byte *
>(memcpy(get(offset), ptr, length));
1963 MDBX_CXX20_CONSTEXPR silo(
const allocator_type &alloc = allocator_type()) noexcept : allocator_type(alloc) {}
1964 MDBX_CXX20_CONSTEXPR silo(
size_t capacity,
const allocator_type &alloc = allocator_type()) : silo(alloc) {
1965 if (!bin::is_suitable_for_inplace(capacity))
1966 bin_.make_allocated(provide_storage(capacity));
1969 silo(silo &&other) =
delete;
1971 silo(silo &&other,
bool is_reference =
false) noexcept(::std::is_nothrow_move_constructible<allocator_type>::value)
1972 : allocator_type(::std::move(other.get_allocator())) {
1973 if (!is_reference) {
1974 if (other.bin_.is_inplace()) {
1975 memcpy(&bin_, &other.bin_,
sizeof(bin));
1979 new (&bin_.allocated_ptr_) allocator_pointer(::std::move(other.bin_.allocated_ptr_));
1981 bin_.capacity_.bytes_ = other.bin_.capacity_.bytes_;
1989 other.bin_.allocated_ptr_.~allocator_pointer();
1990 other.bin_.inplace_.lastbyte_ = bin::lastbyte_inplace_signature;
1997 switch (other_modality) {
1998 case modality::inplace:
1999 memcpy(&bin_, &other.bin_,
sizeof(bin));
2002 case modality::allocated:
2003 new (&bin_.allocated_ptr_) allocator_pointer(::std::move(other.bin_.allocated_ptr_));
2004 bin_.capacity_.bytes_ = other.bin_.capacity_.bytes_;
2012 other.bin_.allocated_ptr_.~allocator_pointer();
2013 other.bin_.inplace_.lastbyte_ = bin::lastbyte_inplace_signature;
2023 exchange(silo &left,
const modality left_modality, silo &right,
2024 const modality right_modality)
noexcept(swap_alloc::is_nothrow()) {
2025 swap_alloc::propagate(left, right);
2026 bool left_need_fixup =
false, right_need_fixup =
false;
2027 if (left_modality == modality::reference || right_modality == modality::reference) {
2032 left_need_fixup = left.move_content(right, right_modality);
2033 right_need_fixup = right.move_content(left, left_modality);
2035 silo temp(std::move(left),
false);
2036 left_need_fixup = left.move_content(right, right_modality);
2037 right_need_fixup = right.move_content(temp, left_modality);
2039 return std::make_pair(left_need_fixup, right_need_fixup);
2043 const allocator_type &alloc = allocator_type())
2044 : silo(capacity, alloc) {
2047 put(headroom, ptr, length);
2050 MDBX_CXX20_CONSTEXPR silo(
const void *ptr,
size_t length,
const allocator_type &alloc = allocator_type())
2051 : silo(length, 0, ptr, length, alloc) {}
2053 ~silo() { release(); }
2057 MDBX_CXX20_CONSTEXPR void *assign(
size_t headroom,
const void *ptr,
size_t length,
size_t tailroom) {
2058 return reshape<true>(headroom + length + tailroom, headroom, ptr, length);
2061 MDBX_CXX20_CONSTEXPR void *assign(
const void *ptr,
size_t length) {
return assign(0, ptr, length, 0); }
2065 return reshape<false>(whole_capacity, headroom,
nullptr, 0);
2076 auto ptr = inherited::byte_ptr();
2077 if (src.is_inplace(ptr)) {
2079 intptr_t offset = &silo_.bin_.inplace_.buffer_[0] - &src.inplace_.buffer_[0];
2080 iov_base = ptr + offset;
2089 iov_base = silo_.assign(iov_base, iov_len);
2093 return static_cast<const byte *
>(silo_.data());
2097 return silo_begin() + silo_.capacity();
2100 struct data_preserver :
public exception_thunk {
2102 data_preserver(
const allocator_type &alloc) : data(alloc) {}
2103 static int callback(
void *context,
MDBX_val *target,
const void *src,
size_t bytes)
noexcept {
2104 auto self =
static_cast<data_preserver *
>(context);
2105 assert(self->is_clean());
2106 assert(&self->data == target);
2109 self->data.assign(src, bytes,
false);
2138 return size_t(begin_ptr - silo_begin()) < silo_.capacity();
2289#if defined(DOXYGEN) || (defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L)
2290 template <
class CHAR,
class T>
2308 template <
class CHAR,
class T,
class A>
2313 template <
class CHAR,
class T,
class A>
2318 template <
class CHAR,
class T,
class A>
2328#if defined(DOXYGEN) || (defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L)
2329 template <
class CHAR,
class T>
2336 : silo_(check_length(head_room, tail_room), alloc) {
2337 iov_base = silo_.get(head_room);
2342 iov_base = silo_.get();
2347 : silo_(check_length(head_room, src.
length(), tail_room), alloc) {
2349 iov_base = memcpy(silo_.get(head_room), src.
data(), iov_len);
2354 buffer(
buffer &&src)
noexcept(::std::is_nothrow_move_constructible<allocator_type>::value)
2361 fixup_imported_inplace(src.silo_.bin_);
2372 template <
typename POD>
2378 static buffer hex(
const slice &source,
bool uppercase =
false,
unsigned wrap_width = 0,
2395 template <
typename POD>
2396 static buffer hex(
const POD &pod,
bool uppercase =
false,
unsigned wrap_width = 0,
2403 template <
typename POD>
2410 template <
typename POD>
2455 return hex_decode(*
this, ignore_spaces, alloc);
2471 void reserve(
size_t wanna_headroom,
size_t wanna_tailroom) {
2472 wanna_headroom = ::std::min(
2473 ::std::max(
headroom(), wanna_headroom),
2475 wanna_tailroom = ::std::min(
2476 ::std::max(
tailroom(), wanna_tailroom),
2478 const size_t wanna_capacity = check_length(wanna_headroom,
length(), wanna_tailroom);
2481 iov_base = silo_.template reshape<false>(wanna_capacity, wanna_headroom, iov_base, iov_len);
2482 else if (wanna_capacity > iov_len)
2483 iov_base = silo_.template reshape<true>(wanna_capacity, wanna_headroom, iov_base, iov_len);
2515 const auto pair = silo::exchange(silo_,
content_modality(), other.silo_, other.content_modality());
2518 fixup_imported_inplace(other.silo_.bin_);
2520 other.fixup_imported_inplace(silo_.bin_);
2533 allocator_traits::select_on_container_copy_construction(
get_allocator()));
2541 copy_assign_alloc::propagate(&silo_, src.silo_);
2542 iov_base = silo_.template reshape<true>(whole_capacity,
headroom, src.
data(), src.
length());
2554 copy_assign_alloc::propagate(&silo_, src.silo_);
2555 if (make_reference) {
2557 iov_base = src.iov_base;
2559 iov_base = silo_.template reshape<true>(src.
length(), 0, src.
data(), src.
length());
2572 const auto src_headroom = src.
headroom();
2574 const auto src_length = src.
length();
2576 if (!move_assign_alloc::is_moveable(&silo_, src.silo_) && kind == modality::allocated) {
2577 iov_base = silo_.template reshape<true>(src.silo_.capacity(), src_headroom, src_data, src_length);
2580 move_assign_alloc::propagate(&silo_, src.silo_);
2581 if (silo_.move_content(src.silo_, kind))
2582 fixup_imported_inplace(src.silo_.bin_);
2596 return assign(src.iov_base, src.iov_len, make_reference);
2606 assign(src.iov_base, src.iov_len, make_reference);
2607 src.iov_base =
nullptr;
2612 return assign(
begin,
static_cast<const byte *
>(
end) -
static_cast<const byte *
>(
begin), make_reference);
2615 template <
class CHAR,
class T,
class A>
2616 buffer &
assign(const ::std::basic_string<CHAR, T, A> &str,
bool make_reference =
false) {
2617 return assign(str.data(), str.length() *
sizeof(CHAR), make_reference);
2621 return assign(c_str, strlen(c_str), make_reference);
2624#if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L
2625 template <
class CHAR,
class T>
2626 buffer &assign(const ::std::basic_string_view<CHAR, T> &view,
bool make_reference =
false) {
2627 return assign(inherited(view), make_reference);
2630 template <
class CHAR,
class T> buffer &assign(::std::basic_string_view<CHAR, T> &&view,
bool make_reference =
false) {
2631 assign(inherited(view), make_reference);
2645#if defined(DOXYGEN) || (defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L)
2646 template <
class CHAR,
class T>
buffer &
operator=(const ::std::basic_string_view<CHAR, T> &view)
noexcept {
2650 template <
class CHAR,
class T>
buffer &
append(const ::std::basic_string_view<CHAR, T> &view) {
2651 return append(view.begin(), view.end());
2655 template <
class CHAR,
class T,
class A>
2660 template <
class CHAR,
class T,
class A>
buffer &
append(const ::std::basic_string<CHAR, T, A> &str) {
2675 iov_base = silo_.template reshape<false>(iov_len, 0, iov_base, iov_len);
2682 const auto src_ptr =
static_cast<const byte *
>(src);
2686 const size_t src_offset = aliased ? size_t(src_ptr - begin_ptr) : 0;
2709 const auto src_ptr =
static_cast<const byte *
>(src);
2713 const size_t src_offset = aliased ? size_t(src_ptr - begin_ptr) : 0;
2725 const size_t wanna_bytes = producer.envisage_result_length();
2736 const size_t wanna_bytes = producer.envisage_result_length();
2784 ptr[0] = uint8_t(u16);
2785 ptr[1] = uint8_t(u16 >> 8);
2794 ptr[0] = uint8_t(u24);
2795 ptr[1] = uint8_t(u24 >> 8);
2796 ptr[2] = uint8_t(u24 >> 16);
2805 ptr[0] = uint8_t(u32);
2806 ptr[1] = uint8_t(u32 >> 8);
2807 ptr[2] = uint8_t(u32 >> 16);
2808 ptr[3] = uint8_t(u32 >> 24);
2817 ptr[0] = uint8_t(u48);
2818 ptr[1] = uint8_t(u48 >> 8);
2819 ptr[2] = uint8_t(u48 >> 16);
2820 ptr[3] = uint8_t(u48 >> 24);
2821 ptr[4] = uint8_t(u48 >> 32);
2822 ptr[5] = uint8_t(u48 >> 40);
2831 ptr[0] = uint8_t(u64);
2832 ptr[1] = uint8_t(u64 >> 8);
2833 ptr[2] = uint8_t(u64 >> 16);
2834 ptr[3] = uint8_t(u64 >> 24);
2835 ptr[4] = uint8_t(u64 >> 32);
2836 ptr[5] = uint8_t(u64 >> 40);
2837 ptr[6] = uint8_t(u64 >> 48);
2838 ptr[7] = uint8_t(u64 >> 56);
2845 template <
size_t SIZE>
static buffer key_from(
const char (&text)[SIZE],
bool make_reference =
true) {
2849#if defined(DOXYGEN) || (defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L)
2850 template <
class CHAR,
class T>
2851 static buffer key_from(const ::std::basic_string_view<CHAR, T> &src,
bool make_reference =
false) {
2852 return buffer(src, make_reference);
2858 template <
class CHAR,
class T,
class A>
2859 static buffer key_from(const ::std::basic_string<CHAR, T, A> &src,
bool make_reference =
false) {
2860 return buffer(src, make_reference);
2905 using stl_pair = ::std::pair<buffer_type, buffer_type>;
2948 key.assign(std::move(src.key));
2949 value.assign(std::move(src.value));
2959 key.assign(std::move(src.key));
2960 value.assign(std::move(src.value));
2964 key.assign(src.first);
2965 value.assign(src.second);
2969 key.assign(std::move(src.first));
2970 value.assign(std::move(src.second));
2977 return key.is_freestanding() &&
value.is_freestanding();
2982 return key.is_reference() ||
value.is_reference();
2988 key.make_freestanding();
2989 value.make_freestanding();
3038 mdbx::memcpy(
this, &ce,
sizeof(*
this));
3043 return a.trunk_txnid == b.trunk_txnid && a.last_confirmed_txnid == b.last_confirmed_txnid &&
3044 a.offset == b.offset && a.length == b.length;
3102#if MDBX_CONSTEXPR_ENUM_FLAGS_OPERATIONS || defined(DOXYGEN)
3184 operator bool() const noexcept {
return dbi != 0; }
3187#if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L
3189 return a.dbi <=> b.dbi;
3193 return a.dbi == b.dbi;
3196 return a.dbi < b.dbi;
3199 return a.dbi > b.dbi;
3202 return a.dbi <= b.dbi;
3205 return a.dbi >= b.dbi;
3208 return a.dbi != b.dbi;
3256 env &operator=(const
env &) noexcept = default;
3257 inline
env &operator=(
env &&) noexcept;
3258 inline
env(
env &&) noexcept;
3259 inline ~
env() noexcept;
3284#if INTPTR_MAX > 0x7fffFFFFl
3292#if INTPTR_MAX > 0x7fffFFFFl
3376#if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L
3393 nested_transactions = write_file_io
3399 half_synchronous_weak_last,
3415#if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L
3419 return lifo == other.lifo;
3460#if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L
3556#if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L
3569 bool use_subdirectory =
false
3614 static inline
size_t dbsize_min(intptr_t pagesize);
3616 static inline
size_t dbsize_max(intptr_t pagesize);
3695#ifdef MDBX_STD_FILESYSTEM_PATH
3698#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
3699 env &
copy(const ::std::wstring &destination,
bool compactify,
bool force_dynamic_size =
false);
3700 env &
copy(
const wchar_t *destination,
bool compactify,
bool force_dynamic_size =
false);
3702 env &
copy(const ::std::string &destination,
bool compactify,
bool force_dynamic_size =
false);
3703 env &
copy(
const char *destination,
bool compactify,
bool force_dynamic_size =
false);
3725#ifdef MDBX_STD_FILESYSTEM_PATH
3728#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
3749#ifdef MDBX_STD_FILESYSTEM_PATH
3753#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
3767 inline info get_info()
const;
3770 inline stat get_stat(
const txn &)
const;
3773 inline info get_info(
const txn &)
const;
3798 inline unsigned max_readers()
const;
3802 inline unsigned max_maps()
const;
3805 inline void *get_context() const noexcept;
3808 inline
env &set_context(
void *your_context);
3825 inline
env &set_sync_threshold(
size_t bytes);
3832 inline
size_t sync_threshold() const;
3834#if __cplusplus >= 201103L || defined(DOXYGEN)
3938 inline env &set_extra_option(extra_runtime_option option, uint64_t value);
3941 inline uint64_t extra_option(extra_runtime_option option)
const;
3952 inline bool sync_to_disk(
bool force =
true,
bool nonblock =
false);
4001 size_t used,
size_t retained)
noexcept;
4034#if !defined(_WIN32) && !defined(_WIN64) || defined(DOXYGEN)
4072 unsigned timeout_seconds_16dot16 = 0)
const;
4124 inline
bool txn_lock(
bool dont_wait = false);
4141 template <
typename VISITOR>
4180 inline defrag_result defrag(VISITOR &visitor,
size_t defrag_atleast = 0,
size_t time_atleast_dot16 = 0,
4181 size_t defrag_enough = 0,
size_t time_limit_dot16 = 0,
4182 intptr_t acceptable_backlash = -1, intptr_t preferred_batch = 0);
4204 inline defrag_result defrag(
size_t defrag_atleast = 0,
size_t time_atleast_dot16 = 0,
size_t defrag_enough = 0,
4205 size_t time_limit_dot16 = 0, intptr_t acceptable_backlash = -1,
4206 intptr_t preferred_batch = 0);
4218 using inherited =
env;
4227#ifdef MDBX_STD_FILESYSTEM_PATH
4230#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
4254#if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L
4266#ifdef MDBX_STD_FILESYSTEM_PATH
4268 bool accede =
true);
4270#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
4272 bool accede =
true);
4274 bool accede =
true);
4299 static env_managed
open_for_recovery(const ::std::string &pathname,
unsigned target_meta,
bool writeable,
4301#ifdef MDBX_STD_FILESYSTEM_PATH
4305#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
4308 static env_managed
open_for_recovery(const ::std::wstring &pathname,
unsigned target_meta,
bool writeable,
4348inline ::std::string
ratio2digits(uint64_t numerator, uint64_t denominator,
int precision) {
4350 return ::mdbx_ratio2digits(numerator, denominator, precision,
buffer,
sizeof(
buffer));
4357 return ::mdbx_ratio2percents(value, whole,
buffer,
sizeof(
buffer));
4363 return ::mdbx_is_readahead_reasonable(volume, redundancy) != 0;
4378 return ::mdbx_setup_debug(log_level, debug_flags, logger);
4387 return ::mdbx_setup_debug_nofmt(log_level, debug_flags, logger, logger_buffer, logger_buffer_size);
4410 txn &operator=(const
txn &) noexcept = default;
4411 inline
txn &operator=(
txn &&) noexcept;
4412 inline
txn(
txn &&) noexcept;
4413 inline ~
txn() noexcept;
4424 inline ::mdbx::env
env() const noexcept;
4428 inline uint64_t
id() const;
4431 inline
void *get_context() const noexcept;
4434 inline
txn &set_context(
void *your_context);
4437 inline
bool is_dirty(const
void *ptr) const;
4450 inline info get_info(
bool scan_reader_lock_table =
false)
const;
4459 return size_t(
get_info().txn_space_dirty);
4465 inline void reset_reading();
4468 inline void renew_reading();
4479 inline bool refresh();
4482 inline txn_managed clone(
void *context =
nullptr)
const;
4485 inline void clone(
txn_managed &txn_for_renew_into_clone,
void *context =
nullptr)
const;
4492 inline void copy(
const char *destination,
bool compactify,
bool force_dynamic_size =
false);
4494 inline void copy(const ::std::string &destination,
bool compactify,
bool force_dynamic_size =
false);
4495#ifdef MDBX_STD_FILESYSTEM_PATH
4499#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
4501 inline void copy(
const wchar_t *destination,
bool compactify,
bool force_dynamic_size =
false);
4503 inline void copy(const ::std::wstring &destination,
bool compactify,
bool force_dynamic_size =
false);
4508 inline void copy(
filehandle fd,
bool compactify,
bool force_dynamic_size =
false);
4549 inline map_handle open_map_accede(
const char *name)
const;
4551 inline map_handle open_map_accede(const ::std::string &name)
const;
4570 bool drop_map(
const char *name,
bool throw_if_absent =
false);
4574 inline bool drop_map(const ::std::string &name,
bool throw_if_absent =
false);
4584 bool clear_map(
const char *name,
bool throw_if_absent =
false);
4587 inline bool clear_map(const ::std::string &name,
bool throw_if_absent =
false);
4601 bool rename_map(
const char *old_name,
const char *new_name,
bool throw_if_absent =
false);
4605 bool rename_map(const ::std::string &old_name, const ::std::string &new_name,
bool throw_if_absent =
false);
4611#if defined(DOXYGEN) || (defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L)
4629 bool drop_map(const ::std::string_view &name,
bool throw_if_absent =
false) {
4634 bool clear_map(const ::std::string_view &name,
bool throw_if_absent =
false) {
4642 bool rename_map(const ::std::string_view &old_name, const ::std::string_view &new_name,
4643 bool throw_if_absent =
false) {
4669 template <
typename VISITOR>
inline int enumerate_tables(VISITOR &visitor)
const;
4796 template <
class BUFFER,
class ALLOCATOR =
typename BUFFER::allocator_type>
4797 inline BUFFER extract(
map_handle map,
const slice &key,
const ALLOCATOR &alloc = ALLOCATOR());
4800 template <
class BUFFER,
class ALLOCATOR =
typename BUFFER::allocator_type>
4801 inline BUFFER replace(
map_handle map,
const slice &key,
const slice &new_value,
const ALLOCATOR &alloc = ALLOCATOR());
4803 template <
class BUFFER,
class ALLOCATOR =
typename BUFFER::allocator_type>
4804 inline BUFFER replace_reserve(
map_handle map,
const slice &key,
size_t length,
slice &new_value_reservation,
4805 const ALLOCATOR &alloc = ALLOCATOR());
4823 inline void append(
map_handle map,
const slice &key,
const slice &value,
bool multivalue_order_preserved =
true);
4825 return append(map, kv.
key, kv.
value, multivalue_order_preserved);
4828 inline size_t put_multiple_samelength(
map_handle map,
const slice &key,
const size_t value_length,
4829 const void *values_array,
size_t values_count,
put_mode mode,
4830 bool allow_partial =
false);
4831 template <
typename VALUE>
4833 put_mode mode,
bool allow_partial =
false) {
4834 static_assert(::std::is_standard_layout<VALUE>::value && !::std::is_pointer<VALUE>::value &&
4835 !::std::is_array<VALUE>::value,
4836 "Must be a standard layout type!");
4839 template <
typename VALUE>
4846 inline ptrdiff_t estimate_from_first(
map_handle map,
const slice &to)
const;
4847 inline ptrdiff_t estimate_to_last(
map_handle map,
const slice &from)
const;
4859 using inherited =
txn;
4867 txn_managed(txn_managed &&) = default;
4868 txn_managed &operator=(txn_managed &&other) noexcept;
4869 txn_managed(const txn_managed &) = delete;
4870 txn_managed &operator=(const txn_managed &) = delete;
4915 return std::make_pair(result, latency);
4954 inline ~
cursor() noexcept;
4963 return a.handle_ == b.handle_;
4966 return a.handle_ != b.handle_;
4993 inline void *get_context() const noexcept;
4996 inline
cursor &set_context(
void *your_context);
5058 bool throw_notfound);
5081 template <
typename CALLABLE_PREDICATE>
5084 static int probe(
void *context,
MDBX_val *key,
MDBX_val *value,
void *arg)
noexcept {
5085 auto thunk =
static_cast<wrapper *
>(context);
5086 assert(thunk->is_clean());
5087 auto &predicate = *
static_cast<CALLABLE_PREDICATE *
>(arg);
5101 template <
typename CALLABLE_PREDICATE>
bool fullscan(CALLABLE_PREDICATE predicate,
bool backward =
false) {
5105 template <
typename CALLABLE_PREDICATE>
5109 static int probe(
void *context,
MDBX_val *key,
MDBX_val *value,
void *arg)
noexcept {
5110 auto thunk =
static_cast<wrapper *
>(context);
5111 assert(thunk->is_clean());
5112 auto &predicate = *
static_cast<CALLABLE_PREDICATE *
>(arg);
5126 template <
typename CALLABLE_PREDICATE>
5130 static int probe(
void *context,
MDBX_val *key,
MDBX_val *value,
void *arg)
noexcept {
5131 auto thunk =
static_cast<wrapper *
>(context);
5132 assert(thunk->is_clean());
5133 auto &predicate = *
static_cast<CALLABLE_PREDICATE *
>(arg);
5148 return move_result(*
this, operation, throw_notfound);
5154 return move_result(*
this, operation, key, value, throw_notfound);
5157 return move(operation, &key, &value, throw_notfound);
5236 inline bool seek(
const slice &key);
5237 inline move_result find(
const slice &key,
bool throw_notfound =
true);
5238 inline move_result lower_bound(
const slice &key,
bool throw_notfound =
false);
5239 inline move_result upper_bound(
const slice &key,
bool throw_notfound =
false);
5242 inline size_t count_multivalue()
const;
5245 inline size_t count_multivalue(
MDBX_stat *stat)
const;
5262 inline ::std::vector<pair> get_batch(
size_t max_pairs, move_operation op,
bool *is_last =
nullptr)
const;
5270 inline void ignore_key_order();
5272 inline move_result find_multivalue(
const slice &key,
const slice &value,
bool throw_notfound =
true);
5273 inline move_result lower_bound_multivalue(
const slice &key,
const slice &value,
bool throw_notfound =
false);
5274 inline move_result upper_bound_multivalue(
const slice &key,
const slice &value,
bool throw_notfound =
false);
5292 inline bool eof()
const;
5293 inline bool on_first()
const;
5294 inline bool on_last()
const;
5295 inline bool on_first_multival()
const;
5296 inline bool on_last_multival()
const;
5299 inline estimate_result
estimate(move_operation operation)
const;
5300 inline estimate_result
estimate(move_operation operation,
const slice &key)
const;
5302 static inline ptrdiff_t distance_between(
const cursor from,
const cursor to,
5303 unsigned deepness = 42);
5305 unsigned deepness = 42)
const {
5318 inline bool scroll(intptr_t distable,
unsigned deepness = 42,
5319 bool throw_notfound =
true);
5321 static inline bool distribute(
const cursor from,
const cursor to,
cursor *cursors_array, intptr_t cursors_array_size,
5322 unsigned deepness = 42);
5324 static inline bool distribute(
const cursor from,
const cursor to,
const std::vector<cursor> &cursors,
5325 unsigned deepness = 42);
5327 static inline bool distribute(
const cursor from,
const cursor to,
const std::vector<cursor_managed> &cursors,
5328 unsigned deepness = 42);
5339 inline void unbind();
5342 inline ::mdbx::txn
txn()
const;
5345 inline operator ::mdbx::txn()
const {
return txn(); }
5346 inline operator ::mdbx::map_handle()
const {
return map(); }
5350 inline void insert(
const slice &key,
slice value);
5352 inline slice insert_reserve(
const slice &key,
size_t value_length);
5356 inline slice upsert_reserve(
const slice &key,
size_t value_length);
5366 inline bool try_update(
const slice &key,
const slice &value);
5367 inline slice update_reserve(
const slice &key,
size_t value_length);
5376 inline bool erase(
bool whole_multivalue =
false);
5380 inline bool erase(
const slice &key,
bool whole_multivalue =
true);
5384 inline bool erase(
const slice &key,
const slice &value);
5409 inline size_t erase_bunch(bunch_delete action);
5420 inline size_t erase_range(
const cursor &end,
bool end_including);
5428 inline void reset();
5430 inline size_t put_multiple_samelength(
const slice &key,
const size_t value_length,
const void *values_array,
5431 size_t values_count,
put_mode mode,
bool allow_partial =
false);
5432 template <
typename VALUE>
5434 bool allow_partial =
false) {
5435 static_assert(::std::is_standard_layout<VALUE>::value && !::std::is_pointer<VALUE>::value &&
5436 !::std::is_array<VALUE>::value,
5437 "Must be a standard layout type!");
5440 template <
typename VALUE>
5454 using inherited =
cursor;
5494#if defined(__cpp_lib_is_constant_evaluated) && __cpp_lib_is_constant_evaluated >= 201811L
5495 if (::std::is_constant_evaluated()) {
5503#if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L
5504 return c_str ? ::std::string_view(c_str).length() : 0;
5506 return c_str ? ::std::strlen(c_str) : 0;
5511#if defined(__cpp_lib_is_constant_evaluated) && __cpp_lib_is_constant_evaluated >= 201811L
5512 if (::std::is_constant_evaluated()) {
5513 for (
size_t i = 0; i < bytes; ++i)
5514 static_cast<byte *
>(dest)[i] =
static_cast<const byte *
>(src)[i];
5518 return ::std::memcpy(dest, src, bytes);
5522#if defined(__cpp_lib_is_constant_evaluated) && __cpp_lib_is_constant_evaluated >= 201811L
5523 if (::std::is_constant_evaluated()) {
5524 for (
size_t i = 0; i < bytes; ++i) {
5525 const int diff = int(
static_cast<const byte *
>(a)[i]) - int(
static_cast<const byte *
>(b)[i]);
5532 return bytes ? ::std::memcmp(a, b, bytes) : 0;
5552 captured_ = ::std::current_exception();
5557 MDBX_CXX20_UNLIKELY ::std::rethrow_exception(captured_);
5615 MDBX_CXX20_UNLIKELY
error(error_code).throw_exception();
5624 error rc(error_code);
5629 switch (error_code) {
5653 : ::
MDBX_val({
const_cast<void *
>(ptr), check_length(
bytes)}) {}
5667 iov_base =
const_cast<void *
>(ptr);
5668 iov_len = check_length(
bytes);
5673 iov_base = src.iov_base;
5674 iov_len = src.iov_len;
5687 assign(src.iov_base, src.iov_len);
5688 src.iov_base =
nullptr;
5729 iov_len = check_length(
bytes);
5754 assert(n <=
size());
5755 iov_base =
static_cast<byte *
>(iov_base) + n;
5766 assert(n <=
size());
5777 return length() >= prefix.length() && memcmp(
data(), prefix.data(), prefix.length()) == 0;
5781 return length() >= suffix.length() &&
5782 memcmp(
byte_ptr() +
length() - suffix.length(), suffix.data(), suffix.length()) == 0;
5786 size_t h =
length() * 3977471;
5787 for (
size_t i = 0; i <
length(); ++i)
5788 h = (h ^
static_cast<const uint8_t *
>(
data())[i]) * 1664525 + 1013904223;
5789 return h ^ 3863194411 * (h >> 11);
5825 if (needle.length() >
length() || pos >
length() - needle.length())
5827 for (
size_t i = pos;; ++i) {
5830 if (i ==
length() - needle.length())
5845 if (needle.length() >
length())
5847 if (pos >
length() - needle.length())
5848 pos =
length() - needle.length();
5849 for (
size_t i = pos + 1; i > 0; --i) {
5861 size_t pos)
const noexcept {
5864 for (
size_t i = pos; i <
length(); ++i) {
5880 for (
size_t i = pos + 1; i > 0; --i) {
5892 size_t pos)
const noexcept {
5893 for (
size_t i = pos; i <
length(); ++i) {
5905 size_t pos)
const noexcept {
5910 for (
size_t i = pos + 1; i > 0; --i) {
5942 const intptr_t diff = intptr_t(a.length()) - intptr_t(b.length());
5944 :
MDBX_UNLIKELY(a.length() == 0 || a.data() == b.data()) ? 0
5945 : memcmp(a.data(), b.data(), a.length());
5949 const size_t shortest = ::std::min(a.length(), b.length());
5952 const intptr_t diff = memcmp(a.data(), b.data(), shortest);
5956 return intptr_t(a.length()) - intptr_t(b.length());
5983#if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L
5986 return (cmp < 0) ? std::strong_ordering::less
5987 : (cmp > 0) ? std::strong_ordering::greater
5988 :
std::strong_ordering::equal;
5992template <
class ALLOCATOR,
typename CAPACITY_POLICY>
5996 if (!make_reference)
6000template <
class ALLOCATOR,
typename CAPACITY_POLICY>
6003 :
buffer(src, !transaction.is_dirty(src.
data()), alloc) {}
6005template <
class ALLOCATOR,
typename CAPACITY_POLICY>
6010#if !(defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__)) || defined(LIBMDBX_EXPORTS)
6013#if MDBX_CXX_HAS_POLYMORPHIC_ALLOCATOR
6023template <
class ALLOCATOR,
class CAPACITY_POLICY, MDBX_CXX20_CONCEPT(MutableByteProducer, PRODUCER)>
6034template <
class ALLOCATOR,
class CAPACITY_POLICY, MDBX_CXX20_CONCEPT(ImmutableByteProducer, PRODUCER)>
6045template <
class ALLOCATOR, MDBX_CXX20_CONCEPT(MutableByteProducer, PRODUCER)>
6050 result.resize(producer.envisage_result_length());
6051 result.resize(producer.write_bytes(
const_cast<char *
>(result.data()), result.capacity()) - result.data());
6056template <
class ALLOCATOR, MDBX_CXX20_CONCEPT(ImmutableByteProducer, PRODUCER)>
6061 result.resize(producer.envisage_result_length());
6062 result.resize(producer.write_bytes(
const_cast<char *
>(result.data()), result.capacity()) - result.data());
6071template <
class ALLOCATOR,
typename CAPACITY_POLICY>
6080template <
class ALLOCATOR,
typename CAPACITY_POLICY>
6089template <
class ALLOCATOR,
typename CAPACITY_POLICY>
6098template <
class ALLOCATOR,
typename CAPACITY_POLICY>
6107template <
class ALLOCATOR,
typename CAPACITY_POLICY>
6116template <
class ALLOCATOR,
typename CAPACITY_POLICY>
6121template <
class ALLOCATOR>
6123 return to_hex(*
this, uppercase, wrap_width).
as_string<ALLOCATOR>(alloc);
6126template <
class ALLOCATOR>
6131template <
class ALLOCATOR>
6136template <
class ALLOCATOR,
class CAPACITY_POLICY>
6138 const ALLOCATOR &alloc)
const {
6139 return to_hex(*
this, uppercase, wrap_width).
as_buffer<ALLOCATOR, CAPACITY_POLICY>(alloc);
6142template <
class ALLOCATOR,
class CAPACITY_POLICY>
6147template <
class ALLOCATOR,
class CAPACITY_POLICY>
6152template <
class ALLOCATOR,
class CAPACITY_POLICY>
6154 return from_hex(*
this, ignore_spaces).
as_buffer<ALLOCATOR, CAPACITY_POLICY>(alloc);
6157template <
class ALLOCATOR,
class CAPACITY_POLICY>
6162template <
class ALLOCATOR,
class CAPACITY_POLICY>
6180 return a.key.length() == b.key.length() && a.value.length() == b.value.length() &&
6181 memcmp(a.key.data(), b.key.data(), a.key.length()) == 0 &&
6182 memcmp(a.value.data(), b.value.data(), a.value.length()) == 0;
6202 return a.key.length() != b.key.length() || a.value.length() != b.value.length() ||
6203 memcmp(a.key.data(), b.key.data(), a.key.length()) != 0 ||
6204 memcmp(a.value.data(), b.value.data(), a.value.length()) != 0;
6207#if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L
6214template <
typename BUFFER>
6243 if (
this != &other) {
6245 other.handle_ =
nullptr;
6253#if (defined(MDBX_CHECKING) && MDBX_CHECKING > 0) || (defined(MDBX_DEBUG) && MDBX_DEBUG > 0)
6416 options.nested_transactions = value;
6428 options.no_sticky_threads = value;
6440 options.disable_readahead = value;
6446 options.disable_clear_memory = value;
6452 options.enable_validation = value;
6534 return static_cast<size_t>(result);
6541 return static_cast<size_t>(result);
6552 return static_cast<size_t>(result);
6563 return static_cast<size_t>(result);
6576 return static_cast<size_t>(result);
6587 return static_cast<size_t>(result);
6596 return static_cast<size_t>(result);
6607 return static_cast<size_t>(result);
6618 return static_cast<size_t>(result);
6629 return static_cast<size_t>(result);
6640 return static_cast<size_t>(result);
6739 unsigned seconds_16dot16;
6741 return seconds_16dot16;
6750#if __cplusplus >= 201103L
6795 size_t retained) noexcept
6803 size_t used,
size_t retained)
noexcept {
6804 reader_visitor_thunk *thunk =
static_cast<reader_visitor_thunk *
>(ctx);
6805 assert(thunk->is_clean());
6816 reader_visitor_thunk thunk(visitor);
6818 thunk.rethrow_captured();
6826 return static_cast<unsigned>(dead_count);
6835 cb = &silent_chk_callbacks;
6856#ifdef MDBX_STD_FILESYSTEM_PATH
6862#if defined(_WIN32) || defined(_WIN64)
6879 return ::mdbx_env_warmup(
handle_,
txn, flags, timeout_seconds_16dot16);
6882#if !defined(_WIN32) && !defined(_WIN64)
6942template <
typename VISITOR>
6944 size_t defrag_enough,
size_t time_limit_dot16, intptr_t acceptable_backlash,
6945 intptr_t preferred_batch) {
6949 defrag_thunk *thunk =
static_cast<defrag_thunk *
>(ctx);
6950 assert(thunk->is_clean());
6952 return static_cast<int>(thunk->visitor_(*progress));
6960 defrag_thunk thunk(visitor);
6964 acceptable_backlash, preferred_batch, thunk.cb, &thunk, &result);
6965 thunk.rethrow_captured();
6972 size_t time_limit_dot16, intptr_t acceptable_backlash, intptr_t preferred_batch) {
6973 struct noop_visitor {
6976 return defrag(visitor, defrag_atleast, time_atleast_dot16, defrag_enough, time_limit_dot16, acceptable_backlash,
6983 if (
this != &other) {
6985 other.handle_ =
nullptr;
6993#if (defined(MDBX_CHECKING) && MDBX_CHECKING > 0) || (defined(MDBX_DEBUG) && MDBX_DEBUG > 0)
7049inline void txn::copy(
const char *destination,
bool compactify,
bool force_dynamic_size) {
7056inline void txn::copy(const ::std::string &destination,
bool compactify,
bool force_dynamic_size) {
7057 copy(destination.c_str(), compactify, force_dynamic_size);
7060#if defined(_WIN32) || defined(_WIN64)
7061inline void txn::copy(
const wchar_t *destination,
bool compactify,
bool force_dynamic_size) {
7068inline void txn::copy(const ::std::wstring &destination,
bool compactify,
bool force_dynamic_size) {
7069 copy(destination.c_str(), compactify, force_dynamic_size);
7073#ifdef MDBX_STD_FILESYSTEM_PATH
7075 copy(destination.native(), compactify, force_dynamic_size);
7192#if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L
7194 return open_map_accede(
slice(name));
7213#if defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L
7215 return rename_map(map,
slice(new_name));
7232 unsigned flags, state;
7242 tables_enum_thunk *thunk =
static_cast<tables_enum_thunk *
>(ctx);
7243 assert(thunk->is_clean());
7245 const slice table_name(*name);
7254 tables_enum_thunk thunk(visitor);
7256 thunk.rethrow_captured();
7263 static int cb(
void *ctx,
const MDBX_txn *, uint64_t span_txnid,
size_t span_pgno,
size_t span_length,
7264 bool span_is_reclaimable)
noexcept {
7265 gc_iter_thunk *thunk =
static_cast<gc_iter_thunk *
>(ctx);
7266 assert(thunk->is_clean());
7268 return loop_control(thunk->visitor_(span_txnid, span_pgno, span_length, span_is_reclaimable));
7276 gc_iter_thunk thunk(visitor);
7279 thunk.rethrow_captured();
7289 struct noop_visitor {
7323 return ::mdbx_dcmp(
handle_, map.
dbi, &a, &b);
7341 return ::mdbx_cache_get(
handle_, map.
dbi, &key, data, &entry);
7346 const auto result =
get_cached(map, key, &value, entry);
7348 *status = result.status;
7366 return value_at_absence;
7379 return value_at_absence;
7428 const int err =
put(map, key, &value ,
7441 slice result(
nullptr, value_length);
7450 slice result(
nullptr, value_length);
7453 const int err =
put(map, key, &result ,
7472 slice result(
nullptr, value_length);
7500 slice result(
nullptr, value_length);
7508 slice result(
nullptr, value_length);
7551template <
class BUFFER,
typename ALLOCATOR>
7553 typename BUFFER::data_preserver result(alloc);
7559template <
class BUFFER,
typename ALLOCATOR>
7561 typename BUFFER::data_preserver result(alloc);
7568template <
class BUFFER,
typename ALLOCATOR>
7570 const ALLOCATOR &alloc) {
7571 new_value_reservation.iov_base =
nullptr;
7572 new_value_reservation.iov_len = length;
7573 typename BUFFER::data_preserver result(alloc);
7586 const void *values_array,
size_t values_count,
put_mode mode,
7587 bool allow_partial) {
7588 MDBX_val args[2] = {{
const_cast<void *
>(values_array), value_length}, {
nullptr, values_count}};
7601 return args[1].iov_len ;
7636 if (
this != &other) {
7638 other.handle_ =
nullptr;
7646#if (defined(MDBX_CHECKING) && MDBX_CHECKING > 0) || (defined(MDBX_DEBUG) && MDBX_DEBUG > 0)
7676 bool throw_notfound)
7678 this->
done =
cursor.move(operation, &this->key, &this->value, throw_notfound);
7689 if (!throw_notfound)
7756 ::std::vector<pair> result;
7760 const size_t limit = max_pairs * 2;
7761 ::std::vector<MDBX_val> pairs(limit);
7772 result.reserve(count / 2);
7773 for (
size_t i = 0; i + 1 < count; i += 2)
7774 result.emplace_back(
slice(pairs[i]),
slice(pairs[i + 1]));
7816 return ::mdbx::txn(
txn);
7853 slice result(
nullptr, value_length);
7860 slice result(
nullptr, value_length);
7861 const int err =
put(key, &result ,
7878 slice result(
nullptr, value_length);
7900 slice result(
nullptr, value_length);
7906 slice result(
nullptr, value_length);
7931 bool found =
seek(key);
7932 return found ?
erase(whole_multivalue) : found;
7943 return size_t(affected);
7949 return size_t(affected);
7955 size_t values_count,
put_mode mode,
bool allow_partial) {
7956 MDBX_val args[2] = {{
const_cast<void *
>(values_array), value_length}, {
nullptr, values_count}};
7969 return args[1].iov_len ;
7973 intptr_t distance = PTRDIFF_MIN;
7978inline bool cursor::scroll(intptr_t distance,
unsigned deepness,
bool throw_notfound) {
7984 if (!throw_notfound)
7993 unsigned deepness) {
7994 static_assert(
sizeof(cursors_array[0]) ==
sizeof(
MDBX_cursor *),
"oops");
8000 unsigned deepness) {
8002 const int err =
MDBX_LIKELY(!cursors_array.empty())
8004 cursors_array.size(), deepness)
8010 unsigned deepness) {
8012 const int err =
MDBX_LIKELY(!cursors_array.empty())
8014 cursors_array.size(), deepness)
8055template <
class ALLOCATOR,
typename CAPACITY_POLICY>
8056inline string to_string(const ::mdbx::buffer<ALLOCATOR, CAPACITY_POLICY> &buffer) {
8068inline string to_string(const ::mdbx::env::geometry &value) {
8074inline string to_string(const ::mdbx::env::operate_parameters &value) {
8086inline string to_string(const ::mdbx::env::durability &value) {
8092inline string to_string(const ::mdbx::env::reclaiming_options &value) {
8098inline string to_string(const ::mdbx::env::operate_options &value) {
8104inline string to_string(const ::mdbx::env_managed::create_parameters &value) {
8138template <>
struct hash<::
mdbx::env> :
public std::hash<const MDBX_env *> {
8140 size_t operator()(const ::mdbx::env &env)
const noexcept {
return inherited::operator()(env); }
8143template <>
struct hash<::
mdbx::txn> :
public std::hash<const MDBX_txn *> {
8145 size_t operator()(const ::mdbx::txn &txn)
const noexcept {
return inherited::operator()(txn); }
8148template <>
struct hash<::
mdbx::cursor> :
public std::hash<const MDBX_cursor *> {
8150 size_t operator()(const ::mdbx::cursor &cursor)
const noexcept {
return inherited::operator()(cursor); }
8153template <
class ALLOCATOR,
typename CAPACITY_POLICY>
struct hash<::
mdbx::buffer<ALLOCATOR, CAPACITY_POLICY>> {
8155 return buffer.hash_value();
8161#if defined(__LCC__) && __LCC__ >= 126
8162#pragma diagnostic pop
#define MDBX_CXX11_CONSTEXPR
Definition mdbx.h:458
#define MDBX_LIKELY(cond)
Definition mdbx.h:590
#define MDBX_MAYBE_UNUSED
Definition mdbx.h:524
#define MDBX_INLINE_API_ASSERT(expr)
Definition mdbx.h:605
#define MDBX_UNLIKELY(cond)
Definition mdbx.h:598
#define MDBX_CXX14_CONSTEXPR
Definition mdbx.h:477
#define MDBX_NOTHROW_PURE_FUNCTION
The pure nothrow function attribute for optimization.
Definition mdbx.h:274
size_t offset
Definition mdbx.h:5293
uint64_t last_confirmed_txnid
Definition mdbx.h:5291
uint64_t trunk_txnid
Definition mdbx.h:5289
mode_t mdbx_mode_t
Definition mdbx.h:187
#define LIBMDBX_API
Definition mdbx.h:634
#define LIBMDBX_API_TYPE
Definition mdbx.h:649
struct iovec MDBX_val
Generic structure used for passing keys and data in and out of the table. .
Definition mdbx.h:808
pthread_t mdbx_tid_t
Definition mdbx.h:186
struct MDBX_env MDBX_env
Opaque structure for a database environment.
Definition mdbx.h:741
int mdbx_filehandle_t
Definition mdbx.h:184
pid_t mdbx_pid_t
Definition mdbx.h:185
@ MDBX_MAX_PAGESIZE
Definition mdbx.h:822
@ MDBX_MAXDATASIZE
Definition mdbx.h:816
@ MDBX_MAX_DBI
Definition mdbx.h:813
@ MDBX_MIN_PAGESIZE
Definition mdbx.h:819
libmdbx build information
Definition mdbx.h:677
Lightweight transparent cache entry structure used by mdbx_cache_get().
Definition mdbx.h:5288
Pair of error code and cache status as a result of mdbx_cache_get().
Definition mdbx.h:5388
The four integer markers (aka "canary") associated with the environment.
Definition mdbx.h:4781
Latency of commit stages in 1/65536 of seconds units.
Definition mdbx.h:4187
The numerical metrics of progress and result of database defragmentation.
Definition mdbx.h:7517
Information about the environment.
Definition mdbx.h:2877
Information about Garbage Collection and page usage.
Definition mdbx.h:7442
Statistics for a table in the environment.
Definition mdbx.h:2831
Information about the transaction.
Definition mdbx.h:4085
libmdbx version information,
Definition mdbx.h:659
MDBX_bunch_action_t
Modes for deleting bunches of neighboring items with self-documenting names.
Definition mdbx.h:6485
LIBMDBX_API int mdbx_cursor_del(MDBX_cursor *cursor, MDBX_put_flags_t flags)
Delete current key/data pair.
LIBMDBX_API int mdbx_cursor_delete_range(MDBX_cursor *begin, MDBX_cursor *end, bool end_including, uint64_t *number_of_affected)
Quickly removes given range of items.
int(* MDBX_preserve_func)(void *context, MDBX_val *target, const void *src, size_t bytes)
A data preservation callback for using within mdbx_replace_ex().
Definition mdbx.h:5581
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_cursor_scan(MDBX_cursor *cursor, MDBX_predicate_func predicate, void *context, MDBX_cursor_op start_op, MDBX_cursor_op turn_op, void *arg)
Scans the table using the passed predicate, reducing the associated overhead.
LIBMDBX_API int mdbx_get_equal_or_great(const MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key, MDBX_val *data)
Get equal or greater item from a table.
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 four integer markers (aka "canary") associated with the environment.
MDBX_put_flags_t
Data changing flags.
Definition mdbx.h:1663
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)
Replaces item in a table using preservation callback for an original data.
LIBMDBX_API int mdbx_cursor_get_batch(MDBX_cursor *cursor, size_t *count, MDBX_val *pairs, size_t limit, MDBX_cursor_op op)
Retrieve multiple non-dupsort key/value pairs by cursor.
LIBMDBX_API int mdbx_cursor_count(const MDBX_cursor *cursor, size_t *count)
Return count values (aka duplicates) for current key.
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:4841
LIBMDBX_API int mdbx_cursor_count_ex(const MDBX_cursor *cursor, size_t *count, MDBX_stat *stat, size_t bytes)
Return count values (aka duplicates) and nested b-tree statistics for current key.
MDBX_cache_status_t
Cache entry status returned by mdbx_cache_get().
Definition mdbx.h:5313
void mdbx_cache_init(MDBX_cache_entry_t *entry)
Initializes the cache entry before the first use.
Definition mdbx.h:5302
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_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)
Scans a table using the given predicate, starting with the given key-value pair, and reduces an assoc...
LIBMDBX_API int mdbx_cursor_bunch_delete(MDBX_cursor *cursor, MDBX_bunch_action_t action, uint64_t *number_of_affected)
Quickly removes bunches of neighboring items.
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_DELETE_AFTER_INCLUDING
Definition mdbx.h:6494
@ MDBX_DELETE_BEFORE_INCLUDING
Definition mdbx.h:6493
@ MDBX_DELETE_WHOLE
Definition mdbx.h:6496
@ MDBX_DELETE_BEFORE_EXCLUDING
Definition mdbx.h:6492
@ MDBX_DELETE_CURRENT_VALUE
Definition mdbx.h:6486
@ MDBX_DELETE_CURRENT_MULTIVAL_BEFORE_EXCLUDING
Definition mdbx.h:6487
@ MDBX_DELETE_AFTER_EXCLUDING
Definition mdbx.h:6495
@ MDBX_DELETE_CURRENT_MULTIVAL_ALL
Definition mdbx.h:6491
@ MDBX_DELETE_CURRENT_MULTIVAL_BEFORE_INCLUDING
Definition mdbx.h:6488
@ MDBX_DELETE_CURRENT_MULTIVAL_AFTER_INCLUDING
Definition mdbx.h:6489
@ MDBX_DELETE_CURRENT_MULTIVAL_AFTER_EXCLUDING
Definition mdbx.h:6490
@ MDBX_MULTIPLE
Definition mdbx.h:1700
@ MDBX_ALLDUPS
Definition mdbx.h:1683
@ MDBX_CURRENT
Definition mdbx.h:1678
@ MDBX_APPENDDUP
Definition mdbx.h:1696
@ MDBX_APPEND
Definition mdbx.h:1691
@ MDBX_UPSERT
Definition mdbx.h:1665
@ MDBX_RESERVE
Definition mdbx.h:1687
@ MDBX_NOOVERWRITE
Definition mdbx.h:1668
LIBMDBX_API int mdbx_cursor_on_first_dup(const MDBX_cursor *cursor)
Determines whether the cursor is on the first or single multi-value corresponding to the key.
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:1744
LIBMDBX_API int mdbx_cursor_compare(const MDBX_cursor *left, const MDBX_cursor *right, bool ignore_multival)
Compares the position of the cursors.
LIBMDBX_API int mdbx_cursor_on_last_dup(const MDBX_cursor *cursor)
Determines whether the cursor is on the last or single multi-value corresponding to the key.
LIBMDBX_API int mdbx_cursor_distribute(const MDBX_cursor *first, const MDBX_cursor *last, MDBX_cursor **array, intptr_t count, unsigned deepness)
Distributes cursors for multithreaded range scanning.
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_cursor_reset(MDBX_cursor *cursor)
Resets the cursor state.
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:771
LIBMDBX_API int mdbx_cursor_set_userctx(MDBX_cursor *cursor, void *ctx)
Set application information associated with the cursor.
LIBMDBX_API int mdbx_cursor_distance(const MDBX_cursor *first, const MDBX_cursor *last, intptr_t *distance, unsigned deepness)
Calculates the distance between the cursors at the specified B-tree level.
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_scroll(MDBX_cursor *cursor, intptr_t amount, unsigned deepness)
Scrolls the cursor to the specified number of positions at the specified B-tree level.
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 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:1863
@ MDBX_GET_CURRENT
Definition mdbx.h:1759
@ MDBX_GET_BOTH
Definition mdbx.h:1752
@ MDBX_TO_KEY_EQUAL
Definition mdbx.h:1840
@ MDBX_GET_BOTH_RANGE
Definition mdbx.h:1756
@ MDBX_SET_KEY
Definition mdbx.h:1799
@ MDBX_FIRST_DUP
Definition mdbx.h:1749
@ MDBX_TO_KEY_LESSER_OR_EQUAL
Definition mdbx.h:1839
@ MDBX_GET_MULTIPLE
Definition mdbx.h:1764
@ MDBX_TO_EXACT_KEY_VALUE_GREATER_THAN
Definition mdbx.h:1850
@ MDBX_NEXT_NODUP
Definition mdbx.h:1784
@ MDBX_TO_EXACT_KEY_VALUE_LESSER_OR_EQUAL
Definition mdbx.h:1847
@ MDBX_TO_EXACT_KEY_VALUE_EQUAL
Definition mdbx.h:1848
@ MDBX_TO_PAIR_LESSER_OR_EQUAL
Definition mdbx.h:1855
@ MDBX_PREV_MULTIPLE
Definition mdbx.h:1807
@ MDBX_SET_RANGE
Definition mdbx.h:1802
@ MDBX_LAST_DUP
Definition mdbx.h:1770
@ MDBX_PREV
Definition mdbx.h:1787
@ MDBX_TO_PAIR_GREATER_OR_EQUAL
Definition mdbx.h:1857
@ MDBX_TO_PAIR_GREATER_THAN
Definition mdbx.h:1858
@ MDBX_LAST
Definition mdbx.h:1767
@ MDBX_TO_KEY_LESSER_THAN
Definition mdbx.h:1838
@ MDBX_PREV_DUP
Definition mdbx.h:1790
@ MDBX_TO_EXACT_KEY_VALUE_LESSER_THAN
Definition mdbx.h:1846
@ MDBX_SET
Definition mdbx.h:1796
@ MDBX_NEXT
Definition mdbx.h:1773
@ MDBX_TO_KEY_GREATER_OR_EQUAL
Definition mdbx.h:1841
@ MDBX_TO_PAIR_LESSER_THAN
Definition mdbx.h:1854
@ MDBX_NEXT_MULTIPLE
Definition mdbx.h:1781
@ MDBX_PREV_NODUP
Definition mdbx.h:1793
@ MDBX_TO_PAIR_EQUAL
Definition mdbx.h:1856
@ MDBX_NEXT_DUP
Definition mdbx.h:1776
@ MDBX_TO_EXACT_KEY_VALUE_GREATER_OR_EQUAL
Definition mdbx.h:1849
@ MDBX_TO_KEY_GREATER_THAN
Definition mdbx.h:1842
@ MDBX_FIRST
Definition mdbx.h:1746
LIBMDBX_API int mdbx_dbi_rename(MDBX_txn *txn, MDBX_dbi dbi, const char *name)
Renames the table using the DBI descriptor.
LIBMDBX_API int mdbx_dbi_rename2(MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *name)
Renames the table using the DBI descriptor.
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:764
MDBX_db_flags_t
Table flags.
Definition mdbx.h:1613
@ MDBX_INTEGERDUP
Definition mdbx.h:1637
@ MDBX_DB_ACCEDE
Definition mdbx.h:1655
@ MDBX_DB_DEFAULTS
Definition mdbx.h:1615
@ MDBX_REVERSEKEY
Definition mdbx.h:1618
@ MDBX_DUPFIXED
Definition mdbx.h:1632
@ MDBX_INTEGERKEY
Definition mdbx.h:1628
@ MDBX_REVERSEDUP
Definition mdbx.h:1640
@ MDBX_CREATE
Definition mdbx.h:1643
@ MDBX_DUPSORT
Definition mdbx.h:1621
LIBMDBX_API const char * mdbx_dump_val(const MDBX_val *key, char *const buf, const size_t bufsize)
Dump given MDBX_val to the buffer.
void(* MDBX_panic_func)(const char *msg, const char *function, unsigned line, const void *obj, const char *obj_class) noexcept
A callback function for most assertion failures, that called before printing the message and aborting...
Definition mdbx.h:1057
void(* MDBX_debug_func)(MDBX_log_level_t log_level, const char *function, int line, const char *fmt, va_list args) noexcept
A log callback function that accepts a format string and arguments passed through the va_list pointer...
Definition mdbx.h:991
MDBX_log_level_t
Definition mdbx.h:884
MDBX_debug_flags_t
Runtime debug flags.
Definition mdbx.h:942
LIBMDBX_API void mdbx_set_panic(MDBX_panic_func func)
Sets or reset the callback for panic() and assert() for the current process.
void(* MDBX_debug_func_nofmt)(MDBX_log_level_t log_level, const char *function, int line, const char *msg, unsigned length) noexcept
A log callback function that accepts a formatted message with length.
Definition mdbx.h:1019
@ MDBX_LOG_DONTCHANGE
Definition mdbx.h:886
@ MDBX_DBG_DONTCHANGE
Definition mdbx.h:944
MDBX_error_t
Errors and return codes.
Definition mdbx.h:1871
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:7008
@ MDBX_FIRST_LMDB_ERRCODE
Definition mdbx.h:1885
@ MDBX_BAD_TXN
Definition mdbx.h:1948
@ MDBX_LAST_LMDB_ERRCODE
Definition mdbx.h:1962
@ MDBX_SUCCESS
Definition mdbx.h:1873
@ MDBX_NOTFOUND
Definition mdbx.h:1888
@ MDBX_RESULT_TRUE
Definition mdbx.h:1879
@ MDBX_BUSY
Definition mdbx.h:1966
@ MDBX_EINVAL
Definition mdbx.h:2043
@ MDBX_ENOMEM
Definition mdbx.h:2045
@ MDBX_FIRST_ADDED_ERRCODE
Definition mdbx.h:1969
@ MDBX_RESULT_FALSE
Definition mdbx.h:1876
@ MDBX_LAST_ADDED_ERRCODE
Definition mdbx.h:2021
@ MDBX_KEYEXIST
Definition mdbx.h:1882
MDBX_env_flags_t
Environment flags.
Definition mdbx.h:1085
LIBMDBX_API int mdbx_preopen_snapinfoW(const wchar_t *pathname, MDBX_envinfo *info, size_t bytes)
Gets basic information about the database without opening it.
LIBMDBX_API int mdbx_preopen_snapinfo(const char *pathname, MDBX_envinfo *info, size_t bytes)
Gets basic information about the database without opening it.
@ MDBX_WRITEMAP
Definition mdbx.h:1205
@ MDBX_EXCLUSIVE
Definition mdbx.h:1159
@ MDBX_RDONLY
Definition mdbx.h:1129
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:3126
MDBX_option_t
MDBX environment extra runtime options.
Definition mdbx.h:2151
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:3067
MDBX_warmup_flags_t
Warming up options.
Definition mdbx.h:3269
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:2256
@ MDBX_opt_subpage_room_threshold
Sets the minimum amount of free space on a leaf page in the absence of which the nested pages are pla...
Definition mdbx.h:2418
@ MDBX_opt_subpage_limit
Specifies the maximum size of nested pages used to accommodate a small number of multi-values associa...
Definition mdbx.h:2411
@ MDBX_opt_txn_dp_limit
Controls the in-process limit of dirty pages for a write transaction.
Definition mdbx.h:2252
@ MDBX_opt_prefer_waf_insteadof_balance
Controls the choice between striving for uniformity of page filling/density, either for reducing the ...
Definition mdbx.h:2397
@ MDBX_opt_presync_threshold
Sets threshold in bytes for preliminary flush/sync operation without holding a transaction lock.
Definition mdbx.h:2478
@ 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:2356
@ MDBX_opt_max_db
Controls the maximum number of named tables for the environment.
Definition mdbx.h:2160
@ MDBX_opt_subpage_reserve_prereq
Sets the minimum amount of free space on the main page, if available, to reserve space in the subpage...
Definition mdbx.h:2432
@ MDBX_opt_sync_bytes
Controls interprocess/shared threshold to force flush the data buffers to disk, if MDBX_SAFE_NOSYNC i...
Definition mdbx.h:2183
@ MDBX_opt_spill_min_denominator
Controls the in-process how minimal part of the dirty pages should be spilled when necessary.
Definition mdbx.h:2288
@ 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:2311
@ MDBX_opt_split_reserve
Sets the space reservation in 1/65536 of page size when splitting page along the edge.
Definition mdbx.h:2460
@ 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:2223
@ 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:2210
@ MDBX_opt_max_readers
Defines the maximum number of threads/reader slots for all processes interacting with the database.
Definition mdbx.h:2177
@ MDBX_opt_subpage_reserve_limit
Sets the limit for reserving space on nested pages.
Definition mdbx.h:2438
@ MDBX_opt_spill_max_denominator
Controls the in-process how maximal part of the dirty pages may be spilled when necessary.
Definition mdbx.h:2272
@ MDBX_opt_sync_period
Controls interprocess/shared relative period since the last unsteady commit to force flush the data b...
Definition mdbx.h:2189
@ MDBX_opt_dp_reserve_limit
Controls the in-process limit of a pre-allocated memory items for dirty pages.
Definition mdbx.h:2237
@ MDBX_opt_writethrough_threshold
Controls the choosing between use write-through disk writes and usual ones with followed flush by the...
Definition mdbx.h:2351
@ MDBX_opt_gc_time_limit
Controls the in-process spending time limit of searching consecutive pages inside GC.
Definition mdbx.h:2375
@ MDBX_opt_merge_threshold
Controls the in-process threshold of semi-empty pages merge.
Definition mdbx.h:2323
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:3741
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:3146
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_gc_info(MDBX_txn *txn, MDBX_gc_info_t *info, size_t bytes, MDBX_gc_iter_func iter_func, void *iter_ctx)
Provides information of Garbage Collection and page usage.
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:3085
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 returned by mdbx_dbi_flags_ex().
Definition mdbx.h:5103
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 int mdbx_enumerate_tables(const MDBX_txn *txn, MDBX_table_enum_func func, void *ctx)
Enumerates user's named tables in a database.
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:3786
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_get_sysraminfo(intptr_t *page_size, intptr_t *total_pages, intptr_t *avail_pages)
Returns basic information about system RAM. This function provides a portable way to get information ...
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_reader_list(const MDBX_env *env, MDBX_reader_list_func func, void *ctx)
Enumerate the entries in the reader lock table.
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_clone(const MDBX_txn *origin, MDBX_txn **in_out_clone, void *context)
Starts a read-only clone of a given transaction.
LIBMDBX_API int mdbx_txn_park(MDBX_txn *txn, bool autounpark)
Puts the reading transaction in a "parked" state.
LIBMDBX_API int mdbx_txn_refresh(MDBX_txn *txn)
Refresh a read-only transaction for a recent data.
LIBMDBX_API int mdbx_txn_unpark(MDBX_txn *txn, bool restart_if_ousted)
Unparks a previously parked reading transaction.
MDBX_txn_flags_t
Definition mdbx.h:1512
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:4002
struct MDBX_txn MDBX_txn
Opaque structure for a transaction handle.
Definition mdbx.h:752
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:1523
@ MDBX_TXN_RDONLY_PREPARE
Definition mdbx.h:1532
@ MDBX_TXN_READWRITE
Definition mdbx.h:1517
@ MDBX_TXN_TRY
Definition mdbx.h:1538
LIBMDBX_API int mdbx_env_turn_for_recovery(MDBX_env *env, unsigned target_meta)
Turn database to the specified meta-page.
A set of callback functions used for checking the integrity of a database.
Definition mdbx.h:7332
The context for checking the integrity of a database.
Definition mdbx.h:7295
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++:6544
static constexpr intptr_t compare_fast(const pair &a, const pair &b) noexcept
Three-way fast non-lexicographically length-based comparison.
Definition mdbx.h++:6169
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++:7546
constexpr slice & set_end(const void *ptr)
Sets the length by specifying the end of the slice data.
Definition mdbx.h++:5733
polymorphic_allocator default_allocator
Definition mdbx.h++:393
constexpr size_t size() const noexcept
Returns the number of bytes.
Definition mdbx.h++:5742
constexpr slice safe_tail(size_t n) const
Returns the last "n" bytes of the slice.
Definition mdbx.h++:5927
constexpr geometry & set_size_lower(intptr_t size) noexcept
Sets the lower bound of database size in bytes.
Definition mdbx.h++:6274
constexpr operate_options & set_no_sticky_threads(bool value=true) noexcept
Sets the "no sticky threads" mode.
Definition mdbx.h++:6491
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++:6143
void copy(const char *destination, bool compactify, bool force_dynamic_size=false)
Copy an MVCC-snapshot of the database to the destination path.
Definition mdbx.h++:7049
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++:6081
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++:6072
void * get_context() const noexcept
Returns the application context associated with the transaction.
Definition mdbx.h++:6998
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++:6572
constexpr operate_options & set_disable_clear_memory(bool value=true) noexcept
Sets the clear-memory disable mode.
Definition mdbx.h++:6515
static constexpr intptr_t compare_fast(const slice &a, const slice &b) noexcept
Three-way fast non-lexicographically length-based comparison.
Definition mdbx.h++:5941
constexpr MDBX_error_t code() const noexcept
Returns error code.
Definition mdbx.h++:5583
void thread_register()
Registers the current thread as a reader for the environment, i.e. assigns a reader slot.
Definition mdbx.h++:6874
void renew(::mdbx::txn &txn)
Renew/bind a cursor with a new transaction and previously used key-value map handle.
Definition mdbx.h++:7806
MDBX_CXX11_CONSTEXPR_ENUM mdbx::key_mode key_mode() const noexcept
Definition mdbx.h++:5540
constexpr slice safe_head(size_t n) const
Returns the first "n" bytes of the slice.
Definition mdbx.h++:5921
void reset_reading()
Reset read-only transaction.
Definition mdbx.h++:7031
class MDBX_MSVC_DECLSPEC_EMPTY_BASES buffer
Definition mdbx.h++:401
constexpr const char * char_ptr() const noexcept
Returns casted to pointer to char an address of data.
Definition mdbx.h++:5710
void rethrow_captured() const
Definition mdbx.h++:5555
constexpr const void * data() const noexcept
Return a pointer to the beginning of the referenced data.
Definition mdbx.h++:5718
move_result find_multivalue(const slice &key, const slice &value, bool throw_notfound=true)
Definition mdbx.h++:7727
ptrdiff_t estimate(move_operation operation, MDBX_val *key, MDBX_val *value) const
Definition mdbx.h++:7703
static size_t dbsize_max(intptr_t pagesize)
Returns the maximal database size in bytes for specified page size.
Definition mdbx.h++:6537
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++:6090
value_result try_update_reserve(map_handle map, const slice &key, size_t value_length)
Definition mdbx.h++:7507
value_result try_insert_reserve(map_handle map, const slice &key, size_t value_length)
Definition mdbx.h++:7449
void close_map(const map_handle &)
Close a key-value map (aka table) handle. Normally unnecessary.
Definition mdbx.h++:6791
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++:6722
move_result(const cursor &cursor, bool throw_notfound)
Definition mdbx.h++:7671
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++:6122
constexpr operate_parameters & write_file_io() noexcept
Sets the operation mode to env::mode::write_file_io.
Definition mdbx.h++:6379
void turn_for_recovery(unsigned target_meta)
Turns the database to the specified meta-page.
Definition mdbx.h++:6886
::mdbx::filesystem::path::string_type path_string
Definition mdbx.h++:441
constexpr bool is_null() const noexcept
Checks whether the slice data pointer is nullptr.
Definition mdbx.h++:5740
ptrdiff_t estimate_from_first(map_handle map, const slice &to) const
Definition mdbx.h++:7616
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++:6148
void remove_suffix(size_t n) noexcept
Drops the last "n" bytes from this slice.
Definition mdbx.h++:5765
slice & assign(const void *ptr, size_t bytes)
Definition mdbx.h++:5666
void unbind()
Unbind cursor from a transaction.
Definition mdbx.h++:7812
::std::chrono::duration< unsigned, ::std::ratio< 1, 65536 > > duration
Duration in 1/65536 units of second.
Definition mdbx.h++:462
slice insert_reserve(map_handle map, const slice &key, size_t value_length)
Definition mdbx.h++:7440
constexpr cursor(MDBX_cursor *ptr) noexcept
Definition mdbx.h++:7628
void rename_map(map_handle map, const char *new_name)
Переименовывает таблицу ключ-значение.
Definition mdbx.h++:7177
size_t erase_range(const cursor &end, bool end_including)
Quickly removes a range of items between the current cursor position and the position of end much fas...
Definition mdbx.h++:7946
void throw_on_failure() const
Definition mdbx.h++:5595
bool try_update(const slice &key, const slice &value)
Definition mdbx.h++:7887
void update(const slice &key, const slice &value)
Definition mdbx.h++:7883
constexpr info(map_handle::flags flags, map_handle::state state) noexcept
Definition mdbx.h++:5537
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++:7318
constexpr buffer(const struct slice &src, bool make_reference, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:5993
constexpr slice & set_length(size_t bytes)
Set slice length.
Definition mdbx.h++:5728
constexpr size_t rfind(const slice &needle, size_t pos=npos) const noexcept
Finds the last occurrence of needle not after pos.
Definition mdbx.h++:5839
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++:6137
txn & set_context(void *your_context)
Sets the application context associated with the transaction.
Definition mdbx.h++:7000
txn_managed start_write(txn &parent)
Starts write (read-write) transaction.
Definition mdbx.h++:6919
constexpr operate_parameters & lifo(bool value=true) noexcept
Sets the LIFO reclaiming mode, i.e. reclaiming_options::lifo.
Definition mdbx.h++:6421
int compare_position_nothrow(const cursor &left, const cursor &right, bool ignore_nested=false) noexcept
Definition mdbx.h++:7658
constexpr bool operator>(const slice &a, const slice &b) noexcept
Definition mdbx.h++:5967
constexpr operate_parameters & set_options(const env::operate_options &value) noexcept
Sets the operate options.
Definition mdbx.h++:6367
MDBX_NODISCARD env::durability get_durability() const
Returns current durability mode.
Definition mdbx.h++:6655
uint64_t sequence(map_handle map) const
Reads sequence generator associated with a key-value map (aka table).
Definition mdbx.h++:7306
void upsert(const slice &key, const slice &value)
Definition mdbx.h++:7873
constexpr operate_parameters & write_mapped_io() noexcept
Sets the operation mode to env::mode::write_mapped_io.
Definition mdbx.h++:6385
bool is_clean() const noexcept
Definition mdbx.h++:5548
constexpr operate_parameters & lazy_weak_tail() noexcept
Sets the durability level to env::durability::lazy_weak_tail.
Definition mdbx.h++:6403
static bool boolean_or_throw(int error_code)
Definition mdbx.h++:5628
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++:6127
path_string::value_type path_char
Definition mdbx.h++:449
constexpr operate_parameters & no_sticky_threads(bool value=true) noexcept
Sets the "no sticky threads" mode, i.e. operate_options::no_sticky_threads.
Definition mdbx.h++:6427
MDBX_NODISCARD env::operate_parameters get_operation_parameters() const
Returns current operation parameters.
Definition mdbx.h++:6645
::std::basic_string< char, ::std::char_traits< char >, ALLOCATOR > string
Default single-byte string.
Definition mdbx.h++:414
constexpr operate_parameters & exclusive(bool value=true) noexcept
Sets the exclusive mode, i.e. operate_options::exclusive.
Definition mdbx.h++:6433
MDBX_env_flags_t get_flags() const
Returns environment flags.
Definition mdbx.h++:6697
static size_t dbsize_min(intptr_t pagesize)
Returns the minimal database size in bytes for specified page size.
Definition mdbx.h++:6530
constexpr slice tail(size_t n) const noexcept
Returns the last "n" bytes of the slice.
Definition mdbx.h++:5808
static constexpr operate_parameters fragile_write() noexcept
Constructs parameters for a writable environment with env::durability::whole_fragile durability and e...
Definition mdbx.h++:6478
constexpr operate_parameters & set_max_readers(unsigned value) noexcept
Sets the maximum number of threads/reader slots for the environment. Zero means default value.
Definition mdbx.h++:6343
constexpr error(MDBX_error_t error_code) noexcept
Definition mdbx.h++:5562
constexpr size_t find_last_of(const slice &chars, size_t pos=npos) const noexcept
Finds the last byte matching any byte of chars not after pos.
Definition mdbx.h++:5875
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++:6153
constexpr const version_info & get_version() noexcept
Returns libmdbx version information.
Definition mdbx.h++:5490
buffer< ALLOCATOR, CAPACITY_POLICY > make_buffer(PRODUCER &producer, const ALLOCATOR &alloc)
Definition mdbx.h++:6024
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++:6890
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++:6794
void insert(const slice &key, slice value)
Definition mdbx.h++:7834
constexpr create_parameters & set_geometry(const env::geometry &value) noexcept
Sets the database geometry for size management.
Definition mdbx.h++:6318
move_result lower_bound_multivalue(const slice &key, const slice &value, bool throw_notfound=false)
Definition mdbx.h++:7731
constexpr operate_parameters & half_synchronous_weak_last() noexcept
Sets the durability level to env::durability::half_synchronous_weak_last.
Definition mdbx.h++:6397
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++:7132
buffer_pair< default_buffer > default_buffer_pair
Default pair of buffers.
Definition mdbx.h++:6218
::std::pmr::string::allocator_type polymorphic_allocator
Default polymorphic allocator for modern code.
Definition mdbx.h++:392
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++:6163
constexpr slice() noexcept
Create an empty slice.
Definition mdbx.h++:5650
~cursor() noexcept
Definition mdbx.h++:7645
constexpr operate_parameters & enable_validation(bool value=true) noexcept
Sets the validation enable mode, i.e. operate_options::enable_validation.
Definition mdbx.h++:6451
~txn() noexcept
Definition mdbx.h++:6992
size_t sync_threshold() const
Gets threshold used to force flush the data buffers to disk, for non-sync durability modes.
Definition mdbx.h++:6727
buffer< ALLOCATOR, CAPACITY_POLICY > as_buffer(const ALLOCATOR &alloc=ALLOCATOR()) const
Decodes Base64 dump from a passed slice to returned buffer.
Definition mdbx.h++:6117
move_result upper_bound(const slice &key, bool throw_notfound=false)
Definition mdbx.h++:7723
uint64_t txnid
Transaction ID and MVCC-snapshot number.
Definition mdbx.h++:410
constexpr void invalidate() noexcept
Invalidates the slice by nullifying the data pointer while preserving the length; makes is_valid() re...
Definition mdbx.h++:5746
inline ::mdbx::txn txn() const
Returns the cursor's transaction.
Definition mdbx.h++:7814
inline ::std::vector< pair > get_batch(size_t max_pairs, move_operation op, bool *is_last=nullptr) const
Reads a batch of key-value pairs.
Definition mdbx.h++:7753
constexpr operate_options & set_enable_validation(bool value=true) noexcept
Sets the validation enable mode.
Definition mdbx.h++:6521
value_result try_insert_reserve(const slice &key, size_t value_length)
Definition mdbx.h++:7859
static MDBX_NODISCARD env::operate_options options_from_flags(MDBX_env_flags_t flags) noexcept
Definition mdbx.h++:6313
map_handle map() const
Definition mdbx.h++:7819
unsigned sync_period__seconds_16dot16() const
Gets relative period since the last unsteady commit that used to force flush the data buffers to disk...
Definition mdbx.h++:6738
MDBX_CXX11_CONSTEXPR_ENUM mdbx::value_mode value_mode() const noexcept
Definition mdbx.h++:5544
move_result find(const slice &key, bool throw_notfound=true)
Definition mdbx.h++:7715
map_handle open_map_accede(const char *name) const
Open existing key-value map.
Definition mdbx.h++:7148
move_result upper_bound_multivalue(const slice &key, const slice &value, bool throw_notfound=false)
Definition mdbx.h++:7735
void success_or_throw() const
Definition mdbx.h++:5600
void renew_reading()
Renew read-only transaction.
Definition mdbx.h++:7035
void ignore_key_order()
Disables the control of the order of keys when reading database pages for this cursor.
Definition mdbx.h++:7778
constexpr bool ends_with(const slice &suffix) const noexcept
Checks if the data ends with the given suffix.
Definition mdbx.h++:5780
bool sync_to_disk(bool force=true, bool nonblock=false)
Flush the environment data buffers.
Definition mdbx.h++:6778
constexpr bool operator<=(const slice &a, const slice &b) noexcept
Definition mdbx.h++:5971
int compare_position(const cursor &left, const cursor &right, bool ignore_nested=false)
Definition mdbx.h++:7662
size_t count_multivalue() const
Return count of duplicates for current key.
Definition mdbx.h++:7741
constexpr bool starts_with(const slice &prefix) const noexcept
Checks if the data starts with the given prefix.
Definition mdbx.h++:5776
static size_t pagesize_max() noexcept
Returns the maximal database page size in bytes.
Definition mdbx.h++:6528
constexpr size_t hash_value() const noexcept
Returns the hash value of referenced data.
Definition mdbx.h++:5785
bool is_dirty(const void *ptr) const
Checks whether the given data is on a dirty page.
Definition mdbx.h++:7005
slice upsert_reserve(const slice &key, size_t value_length)
Definition mdbx.h++:7877
constexpr operate_parameters & set_max_maps(unsigned value) noexcept
Sets the maximum number of named tables/maps for the environment. Zero means default value.
Definition mdbx.h++:6337
MDBX_NODISCARD env::mode get_mode() const
Returns current operation mode.
Definition mdbx.h++:6653
void capture() noexcept
Definition mdbx.h++:5550
buffer< ALLOCATOR, CAPACITY_POLICY > as_buffer(const ALLOCATOR &alloc=ALLOCATOR()) const
Decodes hexadecimal dump from a passed slice to returned buffer.
Definition mdbx.h++:6099
bool scroll(intptr_t distable, unsigned deepness=42, bool throw_notfound=true)
Definition mdbx.h++:7978
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++:7225
constexpr operate_parameters & robust_synchronous() noexcept
Sets the durability level to env::durability::robust_synchronous.
Definition mdbx.h++:6391
bool try_update(map_handle map, const slice &key, const slice &value)
Definition mdbx.h++:7485
void safe_remove_prefix(size_t n)
Drops the first "n" bytes from this slice.
Definition mdbx.h++:5759
bool txn_lock(bool dont_wait=false)
Acquires write-transaction lock.
Definition mdbx.h++:6928
slice insert_reserve(const slice &key, size_t value_length)
Definition mdbx.h++:7852
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++:6895
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 page size and table flag...
Definition mdbx.h++:6592
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++:6733
ptrdiff_t estimate(map_handle map, const pair &from, const pair &to) const
Definition mdbx.h++:7604
MDBX_NODISCARD env::reclaiming_options get_reclaiming() const
Returns current reclaiming options.
Definition mdbx.h++:6659
void drop_map(map_handle map)
Drops key-value map using handle.
Definition mdbx.h++:7173
ptrdiff_t estimate_to_last(map_handle map, const slice &from) const
Definition mdbx.h++:7622
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++:7580
constexpr operate_parameters & disable_clear_memory(bool value=true) noexcept
Sets the clear-memory disable mode, i.e. operate_options::disable_clear_memory.
Definition mdbx.h++:6445
MDBX_NODISCARD env::operate_options get_options() const
Returns current operate options.
Definition mdbx.h++:6663
constexpr operate_parameters & readonly() noexcept
Sets the operation mode to env::mode::readonly.
Definition mdbx.h++:6373
void park_reading(bool autounpark=true)
Park read-only transaction.
Definition mdbx.h++:7099
constexpr bool operator>=(const slice &a, const slice &b) noexcept
Definition mdbx.h++:5975
MDBX_NODISCARD cache_result get_cached(map_handle map, const slice &key, slice *data, cache_entry &entry) const
Gets a value by key using the transparent read-your-writes cache.
Definition mdbx.h++:7340
cursor & set_context(void *your_context)
Sets the application context associated with the cursor.
Definition mdbx.h++:7653
map_stat get_map_stat(map_handle map) const
Returns statistics for a table.
Definition mdbx.h++:7219
bool move(move_operation operation, MDBX_val *key, MDBX_val *value, bool throw_notfound) const
Definition mdbx.h++:7681
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++:6568
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++:7322
static MDBX_NODISCARD env::reclaiming_options reclaiming_from_flags(MDBX_env_flags_t flags) noexcept
Definition mdbx.h++:6309
void thread_unregister()
Unregisters the current thread, i.e. releases its reader slot.
Definition mdbx.h++:6876
txn & put_canary(const canary &)
Set integers markers (aka "canary") associated with the environment.
Definition mdbx.h++:7295
slice upsert_reserve(map_handle map, const slice &key, size_t value_length)
Definition mdbx.h++:7471
constexpr slice head(size_t n) const noexcept
Returns the first "n" bytes of the slice.
Definition mdbx.h++:5803
constexpr bool is_result_false() const noexcept
Definition mdbx.h++:5577
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++:6744
constexpr slice safe_middle(size_t from, size_t n) const
Returns the middle "n" bytes of the slice.
Definition mdbx.h++:5933
constexpr const byte * byte_ptr() const noexcept
Returns casted to pointer to byte an address of data.
Definition mdbx.h++:5702
bool on_first() const
Definition mdbx.h++:7782
::MDBX_version_info version_info
libmdbx version information,
Definition mdbx.h++:357
constexpr bool empty() const noexcept
Checks whether the slice is empty.
Definition mdbx.h++:5738
constexpr operate_parameters & set_durability(env::durability value) noexcept
Sets the durability level.
Definition mdbx.h++:6355
bool eof() const
Definition mdbx.h++:7780
void make_broken()
Marks transaction as broken to prevent further operations.
Definition mdbx.h++:7033
MDBX_txn_flags_t flags() const
Returns transaction's flags.
Definition mdbx.h++:7019
void * get_context() const noexcept
Returns the application context associated with the environment.
Definition mdbx.h++:6715
MDBX_error_t put(const slice &key, slice *value, MDBX_put_flags_t flags) noexcept
Definition mdbx.h++:7826
txn_managed prepare_read() const
Creates but not start read transaction.
Definition mdbx.h++:6904
::MDBX_build_info build_info
libmdbx build information
Definition mdbx.h++:361
string< ALLOCATOR > as_string(const ALLOCATOR &alloc=ALLOCATOR()) const
Decodes Base64 dump from a passed slice to returned string.
Definition mdbx.h++:6112
constexpr txn(MDBX_txn *ptr) noexcept
Definition mdbx.h++:6980
constexpr const byte * begin() const noexcept
Returns an iterator to the beginning of the referenced data.
Definition mdbx.h++:5818
void safe_remove_suffix(size_t n)
Drops the last "n" bytes from this slice.
Definition mdbx.h++:5770
int enumerate_tables(VISITOR &visitor) const
Enumerates user's named tables in a database.
Definition mdbx.h++:7237
bool seek(const slice &key)
Definition mdbx.h++:7739
env & alter_flags(MDBX_env_flags_t flags, bool on_off)
Alter environment flags.
Definition mdbx.h++:6767
env & set_context(void *your_context)
Sets the application context associated with the environment.
Definition mdbx.h++:6717
constexpr byte operator[](size_t n) const noexcept
Returns the nth byte in the referenced data.
Definition mdbx.h++:5792
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++:6636
void clear_map(map_handle map)
Clear key-value map.
Definition mdbx.h++:7175
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++:6756
constexpr create_parameters & set_use_subdirectory(bool value=true) noexcept
Sets whether to use a subdirectory to place the DB files.
Definition mdbx.h++:6331
bool is_base64(bool ignore_spaces=false) const noexcept
Checks whether the content of the slice is a Base64 dump.
Definition mdbx.h++:6234
void remove_prefix(size_t n) noexcept
Drops the first "n" bytes from this slice.
Definition mdbx.h++:5753
constexpr geometry & set_pagesize(intptr_t size) noexcept
Sets the database page size for new database creation.
Definition mdbx.h++:6304
value_result try_insert(const slice &key, slice value)
Definition mdbx.h++:7839
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++:7954
constexpr size_t find_first_of(const slice &chars, size_t pos=0) const noexcept
Finds the first byte matching any byte of chars starting at pos.
Definition mdbx.h++:5860
static void throw_on_nullptr(const void *ptr, MDBX_error_t error_code)
Definition mdbx.h++:5613
constexpr bool operator!=(const error &a, const error &b) noexcept
Definition mdbx.h++:5571
inline ::mdbx::env env() const noexcept
Returns the transaction's environment.
Definition mdbx.h++:7017
static MDBX_NODISCARD info get_preopen_snapinfo(const ::std::string &pathname)
Provides information about a database, including meta-page and geometry, without opening it.
Definition mdbx.h++:6846
static constexpr intptr_t compare_lexicographically(const pair &a, const pair &b) noexcept
Three-way lexicographically comparison.
Definition mdbx.h++:6174
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++:6158
double sync_period__seconds_double() const
Gets relative period since the last unsteady commit that used to force flush the data buffers to disk...
Definition mdbx.h++:6748
::mdbx_filehandle_t filehandle
Definition mdbx.h++:416
constexpr operate_parameters & set_reclaiming(const env::reclaiming_options &value) noexcept
Sets the garbage reclaiming options.
Definition mdbx.h++:6361
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++:6614
constexpr env(MDBX_env *ptr) noexcept
Definition mdbx.h++:6240
constexpr bool operator<(const slice &a, const slice &b) noexcept
Definition mdbx.h++:5963
void txn_unlock()
Releases write-transaction lock acquired by txn_lock().
Definition mdbx.h++:6940
BUFFER extract(map_handle map, const slice &key, const ALLOCATOR &alloc=ALLOCATOR())
Removes and return a value of the key.
Definition mdbx.h++:7552
char8_t byte
The byte-like type that don't presumes aliases for pointers as does the char.
Definition mdbx.h++:342
canary get_canary() const
Returns the four integer markers (aka "canary") associated with the environment.
Definition mdbx.h++:7300
bool erase(bool whole_multivalue=false)
Removes single key-value pair or all multi-values at the current cursor position.
Definition mdbx.h++:7918
bool refresh()
Refresh the read-only transaction to the most recent snapshot.
Definition mdbx.h++:7037
BUFFER replace_reserve(map_handle map, const slice &key, size_t length, slice &new_value_reservation, const ALLOCATOR &alloc=ALLOCATOR())
Definition mdbx.h++:7569
stat get_stat() const
Returns snapshot statistics about the MDBX environment.
Definition mdbx.h++:6667
string< ALLOCATOR > as_string(const ALLOCATOR &alloc=ALLOCATOR()) const
Returns a string with a hexadecimal dump of a passed slice.
Definition mdbx.h++:6067
uint64_t id() const
Return the transaction's ID.
Definition mdbx.h++:7025
value_result try_insert(map_handle map, const slice &key, slice value)
Definition mdbx.h++:7425
::std::string::allocator_type legacy_allocator
Legacy allocator but it is recommended to use polymorphic_allocator.
Definition mdbx.h++:375
constexpr size_t find_last_not_of(const slice &chars, size_t pos=npos) const noexcept
Finds the last byte not matching any byte of chars not after pos.
Definition mdbx.h++:5904
constexpr bool is_mdbx_error() const noexcept
Returns true for MDBX's errors.
Definition mdbx.h++:5585
constexpr reclaiming_options & set_lifo(bool value=true) noexcept
Sets the LIFO reclaiming mode.
Definition mdbx.h++:6485
constexpr geometry & set_size_now(intptr_t size) noexcept
Sets the size in bytes to setup the database size for now.
Definition mdbx.h++:6280
string< ALLOCATOR > as_string(const ALLOCATOR &alloc=ALLOCATOR()) const
Decodes hexadecimal dump from a passed slice to returned string.
Definition mdbx.h++:6094
string< ALLOCATOR > as_string(const ALLOCATOR &alloc=ALLOCATOR()) const
Returns a string with a Base58 dump of a passed slice.
Definition mdbx.h++:6076
ptrdiff_t estimate(const cursor &from, const cursor &to)
Definition mdbx.h++:7709
static constexpr intptr_t compare_lexicographically(const slice &a, const slice &b) noexcept
Three-way lexicographically comparison.
Definition mdbx.h++:5948
string< ALLOCATOR > as_string(const ALLOCATOR &alloc=ALLOCATOR()) const
Returns a string with a Base64 dump of a passed slice.
Definition mdbx.h++:6085
static bool distribute(const cursor from, const cursor to, cursor *cursors_array, intptr_t cursors_array_size, unsigned deepness=42)
Definition mdbx.h++:7992
string< ALLOCATOR > as_string(const ALLOCATOR &alloc=ALLOCATOR()) const
Decodes Base58 dump from a passed slice to returned string.
Definition mdbx.h++:6103
slice update_reserve(map_handle map, const slice &key, size_t value_length)
Definition mdbx.h++:7499
bool is_base58(bool ignore_spaces=false) const noexcept
Checks whether the content of the slice is a Base58 dump.
Definition mdbx.h++:6230
~env() noexcept
Definition mdbx.h++:6252
gc_info get_gc_info(VISITOR &visitor) const
Provides information of Garbage Collection and page usage.
Definition mdbx.h++:7260
slice get(map_handle map, const slice &key) const
Get value by key from a key-value map (aka table).
Definition mdbx.h++:7334
static constexpr operate_parameters lazy_write() noexcept
Constructs parameters for a writable environment with env::durability::lazy_weak_tail durability and ...
Definition mdbx.h++:6471
constexpr bool is_failure() const noexcept
Definition mdbx.h++:5579
constexpr void clear() noexcept
Makes the slice empty and referencing to nothing.
Definition mdbx.h++:5748
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++:7585
void update(map_handle map, const slice &key, const slice &value)
Definition mdbx.h++:7479
constexpr byte at(size_t n) const
Returns the nth byte in the referenced data with bounds checking.
Definition mdbx.h++:5797
txn_managed start_read() const
Starts read (read-only) transaction.
Definition mdbx.h++:6897
::mdbx::filesystem::path path
Definition mdbx.h++:440
bool on_last_multival() const
Definition mdbx.h++:7788
defrag_result defrag(VISITOR &visitor, size_t defrag_atleast=0, size_t time_atleast_dot16=0, size_t defrag_enough=0, size_t time_limit_dot16=0, intptr_t acceptable_backlash=-1, intptr_t preferred_batch=0)
Performs database defragmentation.
Definition mdbx.h++:6943
unsigned max_maps() const
Returns the maximum number of named tables for the environment.
Definition mdbx.h++:6709
constexpr const byte * end() const noexcept
Return a pointer to the end of the referenced data.
Definition mdbx.h++:5720
void insert(map_handle map, const slice &key, slice value)
Definition mdbx.h++:7418
constexpr operate_options & set_nested_transactions(bool value=true) noexcept
Sets the nested transactions mode.
Definition mdbx.h++:6497
unsigned max_readers() const
Returns the maximum number of threads/reader slots for the environment.
Definition mdbx.h++:6703
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++:6548
int enumerate_readers(VISITOR &visitor)
Enumerate readers.
Definition mdbx.h++:6799
void * get_context() const noexcept
Returns the application context associated with the cursor.
Definition mdbx.h++:7651
static size_t max_map_handles(void)
Returns the maximum opened map handles, aka DBI-handles.
Definition mdbx.h++:6643
cursor_managed open_cursor(map_handle map) const
Opens cursor for specified key-value map handle.
Definition mdbx.h++:7111
bool unpark_reading(bool restart_if_ousted=true)
Resume parked read-only transaction.
Definition mdbx.h++:7101
uint64_t extra_option(extra_runtime_option option) const
Gets the value of extra runtime options from an environment.
Definition mdbx.h++:6761
MDBX_NODISCARD int warmup(MDBX_warmup_flags_t flags, unsigned timeout_seconds_16dot16, const MDBX_txn *txn=nullptr) const
Loads into memory the given pages of the database and their on-disk neighbours in advance.
Definition mdbx.h++:6878
constexpr const build_info & get_build() noexcept
Returns libmdbx build information.
Definition mdbx.h++:5491
constexpr operate_parameters & whole_fragile() noexcept
Sets the durability level to env::durability::whole_fragile.
Definition mdbx.h++:6409
bool on_first_multival() const
Definition mdbx.h++:7786
MDBX_error_t put(map_handle map, const slice &key, slice *value, MDBX_put_flags_t flags) noexcept
Definition mdbx.h++:7406
inline ::std::ostream & operator<<(::std::ostream &out, const buffer< ALLOCATOR, CAPACITY_POLICY > &it)
Definition mdbx.h++:6006
constexpr slice middle(size_t from, size_t n) const noexcept
Returns the middle "n" bytes of the slice.
Definition mdbx.h++:5813
static constexpr operate_parameters safe_write() noexcept
Constructs parameters for a writable environment with env::durability::robust_synchronous durability ...
Definition mdbx.h++:6464
constexpr geometry & make_dynamic(intptr_t lower=default_value, intptr_t upper=default_value) noexcept
Definition mdbx.h++:6266
info get_info() const
Return snapshot information about the MDBX environment.
Definition mdbx.h++:6679
void upsert(map_handle map, const slice &key, const slice &value)
Definition mdbx.h++:7465
static size_t pagesize_min() noexcept
Returns the minimal database page size in bytes.
Definition mdbx.h++:6526
string< ALLOCATOR > as_base64_string(unsigned wrap_width=0, const ALLOCATOR &alloc=ALLOCATOR()) const
Returns a string with a Base64 dump of the slice content.
Definition mdbx.h++:6132
slice update_reserve(const slice &key, size_t value_length)
Definition mdbx.h++:7899
txn_managed clone(void *context=nullptr) const
Clone read transaction.
Definition mdbx.h++:7086
move_result lower_bound(const slice &key, bool throw_notfound=false)
Definition mdbx.h++:7719
constexpr const byte * end_byte_ptr() const noexcept
Returns casted to pointer to byte an end of data.
Definition mdbx.h++:5704
constexpr size_t length() const noexcept
Returns the number of bytes.
Definition mdbx.h++:5726
gc_info get_gc_info() const
Definition mdbx.h++:7288
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++:6215
constexpr operate_options & set_disable_readahead(bool value=true) noexcept
Sets the readahead disable mode.
Definition mdbx.h++:6509
unsigned check_readers()
Checks for stale readers in the lock table and return number of cleared slots.
Definition mdbx.h++:6822
constexpr geometry & set_size_upper(intptr_t size) noexcept
Sets the upper bound of database size in bytes.
Definition mdbx.h++:6286
bool erase(map_handle map, const slice &key)
Removes all values for given key.
Definition mdbx.h++:7522
static constexpr operate_parameters read_only() noexcept
Constructs parameters for a read-only environment.
Definition mdbx.h++:6457
static MDBX_NODISCARD sysraminfo get_sysraminfo()
Returns information about the system RAM.
Definition mdbx.h++:6840
constexpr bool is_result_true() const noexcept
Definition mdbx.h++:5575
constexpr size_t find_first_not_of(const slice &chars, size_t pos=0) const noexcept
Finds the first byte not matching any byte of chars starting at pos.
Definition mdbx.h++:5891
bool on_last() const
Definition mdbx.h++:7784
constexpr geometry & make_fixed(intptr_t size) noexcept
Definition mdbx.h++:6259
constexpr operate_parameters & set_mode(env::mode value) noexcept
Sets the operation mode.
Definition mdbx.h++:6349
#define MDBX_STD_FILESYSTEM_PATH
Defined if mdbx::filesystem::path is available.
Definition mdbx.h++:436
constexpr create_parameters & set_file_mode_bits(mdbx_mode_t value) noexcept
Sets the file mode bits used for creation of the DB files.
Definition mdbx.h++:6325
constexpr geometry & set_shrink_threshold(intptr_t threshold) noexcept
Sets the shrink threshold in bytes.
Definition mdbx.h++:6298
constexpr size_t find(const slice &needle, size_t pos=0) const noexcept
Finds the first occurrence of needle starting at pos.
Definition mdbx.h++:5822
filehandle get_filehandle() const
Returns the file descriptor for the DXB file of MDBX environment.
Definition mdbx.h++:6691
env & set_geometry(const geometry &size)
Set all size-related parameters of environment.
Definition mdbx.h++:6772
constexpr operate_options & set_exclusive(bool value=true) noexcept
Sets the exclusive mode.
Definition mdbx.h++:6503
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++:7808
buffer< ALLOCATOR, CAPACITY_POLICY > as_buffer(const ALLOCATOR &alloc=ALLOCATOR()) const
Decodes Base58 dump from a passed slice to returned buffer.
Definition mdbx.h++:6108
constexpr geometry & set_growth_step(intptr_t step) noexcept
Sets the growth step in bytes.
Definition mdbx.h++:6292
size_t release_all_cursors(bool unbind) const
Unbind or close all cursors.
Definition mdbx.h++:7117
size_t erase_bunch(bunch_delete action)
Quickly removes bunches of neighboring items much faster by cutting out entire pages and branches fro...
Definition mdbx.h++:7940
constexpr bool operator==(const error &a, const error &b) noexcept
Definition mdbx.h++:5569
string< ALLOCATOR > make_string(PRODUCER &producer, const ALLOCATOR &alloc)
Definition mdbx.h++:6046
constexpr bool is_success() const noexcept
Definition mdbx.h++:5573
value_result try_update_reserve(const slice &key, size_t value_length)
Definition mdbx.h++:7905
constexpr operate_parameters & nested_transactions(bool value=true) noexcept
Sets the nested transactions mode, i.e. operate_options::nested_transactions.
Definition mdbx.h++:6415
buffer< default_allocator, default_capacity_policy > default_buffer
Default buffer.
Definition mdbx.h++:6019
void reset()
Resets the cursor state.
Definition mdbx.h++:7952
cursor & assign(const cursor &)
Definition mdbx.h++:7630
txn_managed try_start_write()
Tries to start write (read-write) transaction without blocking.
Definition mdbx.h++:6926
bool is_hex(bool ignore_spaces=false) const noexcept
Checks whether the content of the slice is a hexadecimal dump.
Definition mdbx.h++:6226
info get_info(bool scan_reader_lock_table=false) const
Returns information about the MDBX transaction.
Definition mdbx.h++:7105
static ptrdiff_t distance_between(const cursor from, const cursor to, unsigned deepness=42)
Definition mdbx.h++:7972
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++:7164
MDBX_NODISCARD MDBX_chk_context_t & chk(MDBX_chk_context_t &ctx, const MDBX_chk_callbacks_t *cb=nullptr, MDBX_chk_flags_t flags=MDBX_CHK_DEFAULTS, MDBX_chk_severity_t verbosity=MDBX_chk_info, unsigned timeout_seconds_16dot16=0) const
Checks the integrity of the environment (database).
Definition mdbx.h++:6832
void resurrect_after_fork()
Restores the environment after fork(), dropping all read-write locks and reader slots of the parent p...
Definition mdbx.h++:6883
constexpr operate_parameters & disable_readahead(bool value=true) noexcept
Sets the readahead disable mode, i.e. operate_options::disable_readahead.
Definition mdbx.h++:6439
pair_result get_equal_or_great(map_handle map, const slice &key) const
Gets the value for an equal or greater key from a table.
Definition mdbx.h++:7385
map_handle::info get_map_flags(map_handle map) const
Returns information about key-value map (aka table) handle.
Definition mdbx.h++:7231
constexpr const char * end_char_ptr() const noexcept
Returns casted to pointer to char an end of data.
Definition mdbx.h++:5712
void commit(finalization_latency &latency)
Commits all changes of the transaction into a database with collecting latencies information.
Definition mdbx.h++:4895
constexpr const MDBX_env * handle() const noexcept
Definition mdbx.h++:3264
friend class env
Definition mdbx.h++:4860
env_managed(const char *pathname, const operate_parameters &, bool accede=true)
::MDBX_txn_info info
Definition mdbx.h++:4448
cursor_managed(void *your_context=nullptr)
Creates a new managed cursor with underlying object.
Definition mdbx.h++:5461
bool scan_until(CALLABLE_PREDICATE predicate, move_operation start=first, move_operation turn=next)
Definition mdbx.h++:5082
::MDBX_stat map_stat
Definition mdbx.h++:4648
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,...
bool amend(bool dont_wait=false)
Starts a writing transaction to amending data in the MVCC-snapshot used by the read-only transaction.
txn_managed start_nested()
Start nested write transaction.
extra_runtime_option
MDBX environment extra runtime options.
Definition mdbx.h++:3884
env_managed & operator=(env_managed &&other) noexcept
constexpr uint64_t transaction_id() const noexcept
Returns the transaction/MVCC-snapshot ID of the internal structure that holds the cached data.
Definition mdbx.h++:3031
::MDBX_cache_status_t cache_status
Definition mdbx.h++:4714
bool drop_map(const ::std::string_view &name, bool throw_if_absent=false)
Drop key-value map.
Definition mdbx.h++:4629
bool scan_until_from(CALLABLE_PREDICATE predicate, pair &from, move_operation start=pair_greater_or_equal, move_operation turn=next)
Definition mdbx.h++:5127
env_managed(const char *pathname, const create_parameters &, const operate_parameters &, bool accede=true)
map_handle(const map_handle &) noexcept=default
mode
Operation mode.
Definition mdbx.h++:3389
@ readonly
Definition mdbx.h++:3390
@ write_mapped_io
Definition mdbx.h++:3392
@ write_file_io
Definition mdbx.h++:3391
::MDBX_db_flags_t flags
Definition mdbx.h++:3211
move_result to_exact_key_value_lesser_or_equal(const slice &key, const slice &value, bool throw_notfound=true)
Definition mdbx.h++:5204
move_result previous_multiple_samelength(bool throw_notfound=false)
Definition mdbx.h++:5288
friend constexpr bool operator==(const env &a, const env &b) noexcept
Definition mdbx.h++:3266
static bool remove(const ::std::wstring &pathname, const remove_mode mode=just_remove)
constexpr const MDBX_cursor * handle() const noexcept
Definition mdbx.h++:4960
::MDBX_defrag_result_t defrag_result
The result of database defragmentation, see MDBX_defrag_result_t.
Definition mdbx.h++:4131
constexpr txn() noexcept=default
constexpr map_handle() noexcept
Definition mdbx.h++:3180
friend constexpr bool operator!=(const cursor &a, const cursor &b) noexcept
Definition mdbx.h++:4965
void commit_embark_read()
Commits all the operations of a transaction into the database and then start read transaction.
friend constexpr bool operator!=(const map_handle &a, const map_handle &b) noexcept
Definition mdbx.h++:3207
size_t dbsize_min() const
Returns the minimal database size in bytes for the environment.
Definition mdbx.h++:3678
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++:5276
bool checkpoint(finalization_latency &latency)
Commits all the operations of the transaction and immediately starts next without releasing any locks...
Definition mdbx.h++:4909
constexpr uint64_t last_confirmed() const noexcept
Returns the recent transaction/MVCC-snapshot ID wherein the entry was checked and confirmed.
Definition mdbx.h++:3034
constexpr cache_entry(const MDBX_cache_entry_t &ce) noexcept
Definition mdbx.h++:3036
cache_entry() noexcept
Definition mdbx.h++:3013
static bool remove(const char *pathname, const remove_mode mode=just_remove)
friend class cursor
Definition mdbx.h++:4403
move_result to_pair_equal(const slice &key, const slice &value, bool throw_notfound=true)
Definition mdbx.h++:5223
ptrdiff_t distance_to_end(unsigned deepness=42) const
Definition mdbx.h++:5314
::MDBX_canary canary
Definition mdbx.h++:4691
defrag_control
Control values returned by the defragmentation progress visitor.
Definition mdbx.h++:4135
@ abort
Abort defragmentation immediately.
Definition mdbx.h++:4137
@ proceed
Continue defragmentation.
Definition mdbx.h++:4136
std::pair< bool, finalization_latency > checkpoint_get_latency()
Commits all the operations of the transaction and immediately starts next without releasing any locks...
Definition mdbx.h++:4912
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++:4446
void commit_embark_read(finalization_latency *latency)
Commits all the operations of a transaction into the database and then start read transaction.
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++:5153
friend constexpr bool operator!=(const txn &a, const txn &b) noexcept
Definition mdbx.h++:4421
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++:5217
bool clear_map(const char *name, bool throw_if_absent=false)
constexpr env() noexcept=default
move_result to_pair_exact(const slice &key, const slice &value, bool throw_notfound=true)
Definition mdbx.h++:5226
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.
slice reserve_current(size_t value_length)
Reserves and returns the space for storing a value associated with a key at the current cursor positi...
constexpr cache_entry & operator=(const MDBX_cache_entry_t &ce) noexcept
Definition mdbx.h++:3037
env_managed(const ::mdbx::filesystem::path &pathname, const operate_parameters &, bool accede=true)
Open existing database.
durability
Durability level.
Definition mdbx.h++:3397
@ whole_fragile
Definition mdbx.h++:3401
@ lazy_weak_tail
Definition mdbx.h++:3400
@ robust_synchronous
Definition mdbx.h++:3398
@ half_synchronous_weak_last
Definition mdbx.h++:3399
void reset() noexcept
Initializes the cache entry to the "no cached info" state.
Definition mdbx.h++:3022
friend constexpr bool operator<=(const map_handle &a, const map_handle &b) noexcept
Definition mdbx.h++:3201
::MDBX_gc_info_t gc_info
Definition mdbx.h++:4671
static bool remove(const ::std::string &pathname, const remove_mode mode=just_remove)
constexpr map_handle(MDBX_dbi dbi) noexcept
Definition mdbx.h++:3181
void put(const pair &kv, put_mode mode)
Definition mdbx.h++:5370
move_result current(bool throw_notfound=true) const
Definition mdbx.h++:5171
cursor_managed clone(void *your_context=nullptr) const
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++:5162
static MDBX_NODISCARD info get_preopen_snapinfo(const ::std::wstring &pathname)
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++:4988
size_t unbind_all_cursors() const
Unbind all cursors.
Definition mdbx.h++:4536
void upsert(map_handle map, const pair &kv)
Definition mdbx.h++:4784
move_result to_key_greater_or_equal(const slice &key, bool throw_notfound=true)
Definition mdbx.h++:5194
bool is_same_position(const cursor &other, bool ignore_nested=false) const
Definition mdbx.h++:4980
bool is_after_than(const cursor &other, bool ignore_nested=false) const
Definition mdbx.h++:4984
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++:4621
constexpr MDBX_txn * handle() noexcept
Definition mdbx.h++:4419
static size_t default_pagesize() noexcept
Returns default page size for current system/platform.
Definition mdbx.h++:3596
move_result to_next_first_multi(bool throw_notfound=true)
Definition mdbx.h++:5178
MDBX_cursor * withdraw_handle() noexcept
Definition mdbx.h++:5472
bunch_delete
Modes for deleting bunches of neighboring items, see MDBX_bunch_action_t(). The EXCLUDING and INCLUDI...
Definition mdbx.h++:5390
@ delete_current_multival_all
Definition mdbx.h++:5396
@ delete_current_multival_after_excluding
Definition mdbx.h++:5395
@ delete_current_value
Definition mdbx.h++:5391
@ delete_after_excluding
Definition mdbx.h++:5400
@ delete_current_multival_before_including
Definition mdbx.h++:5393
@ delete_current_multival_before_excluding
Definition mdbx.h++:5392
@ delete_current_multival_after_including
Definition mdbx.h++:5394
@ delete_after_including
Definition mdbx.h++:5399
@ delete_before_including
Definition mdbx.h++:5398
@ delete_before_excluding
Definition mdbx.h++:5397
@ delete_whole
Definition mdbx.h++:5401
MDBX_txn * handle_
Definition mdbx.h++:4404
void abort()
Abandon all the operations of the transaction instead of saving ones.
MDBX_commit_latency finalization_latency
Definition mdbx.h++:4874
const path_char * get_path() const
Return the path that was used for opening the environment.
move_result move(move_operation operation, const slice &key, bool throw_notfound)
Definition mdbx.h++:5150
friend constexpr bool operator==(const cursor &a, const cursor &b) noexcept
Definition mdbx.h++:4962
bool is_writemap() const
Definition mdbx.h++:3790
move_result move(move_operation operation, bool throw_notfound)
Definition mdbx.h++:5147
::MDBX_envinfo info
Information about the environment.
Definition mdbx.h++:3739
operator::mdbx::txn() const
Definition mdbx.h++:5345
MDBX_env * handle_
Definition mdbx.h++:3250
slice reverse_current(size_t value_length)
Deprecated misspelling of reserve_current().
Definition mdbx.h++:5363
move_result to_exact_key_value_greater_or_equal(const slice &key, const slice &value, bool throw_notfound=true)
Definition mdbx.h++:5210
::MDBX_cache_result_t cache_result
Definition mdbx.h++:4715
bool is_same_or_before_than(const cursor &other, bool ignore_nested=false) const
Definition mdbx.h++:4976
move_result to_first(bool throw_notfound=true)
Definition mdbx.h++:5160
move_result to_last(bool throw_notfound=true)
Definition mdbx.h++:5180
cache_entry(cache_entry &&other) noexcept
Definition mdbx.h++:3016
bool is_nested_transactions_available() const
Definition mdbx.h++:3794
void close()
Explicitly closes the cursor.
static env_managed open_for_recovery(const ::std::string &pathname, unsigned target_meta, bool writeable, unsigned max_maps=2)
static env_managed open_for_recovery(const wchar_t *pathname, unsigned target_meta, bool writeable, unsigned max_maps=2)
constexpr MDBX_env * handle() noexcept
Definition mdbx.h++:3265
bool scan_until_from(CALLABLE_PREDICATE predicate, slice &from, move_operation start=key_greater_or_equal, move_operation turn=next)
Definition mdbx.h++:5106
void abort(finalization_latency &latency)
Abandon all the operations of the transaction instead of saving ones with collecting latencies inform...
Definition mdbx.h++:4881
bool is_pristine() const
Returns true for a freshly created database, but false if at least one transaction was committed.
intptr_t avail_pages
The number of currently available pages.
Definition mdbx.h++:3602
move_result to_key_exact(const slice &key, bool throw_notfound=true)
Definition mdbx.h++:5191
bool is_readonly() const
Checks whether the transaction is read-only.
Definition mdbx.h++:4443
constexpr txn_managed() noexcept=default
bool clear_map(const slice &name, bool throw_if_absent=false)
move_result next_multiple_samelength(bool throw_notfound=false)
Definition mdbx.h++:5284
env_managed(const ::std::wstring &pathname, const operate_parameters &, bool accede=true)
ptrdiff_t distance_from_first(unsigned deepness=42) const
Definition mdbx.h++:5311
void append(map_handle map, const pair &kv, bool multivalue_order_preserved=true)
Definition mdbx.h++:4824
cursor_managed & operator=(const cursor_managed &)=delete
remove_mode
Deletion modes for remove().
Definition mdbx.h++:3709
@ ensure_unused
Make sure that the environment is not being used by other processes, or return an error otherwise.
Definition mdbx.h++:3719
@ wait_for_unused
Wait until other processes closes the environment before deletion.
Definition mdbx.h++:3721
@ just_remove
Just delete the environment's files and directory if any.
Definition mdbx.h++:3716
move_result to_current_first_multi(bool throw_notfound=true)
Definition mdbx.h++:5165
static env_managed open_for_recovery(const ::mdbx::filesystem::path &pathname, unsigned target_meta, bool writeable, unsigned max_maps=2)
intptr_t total_pages
The number of all pages in the system.
Definition mdbx.h++:3601
cursor_managed & operator=(cursor_managed &&other) noexcept
::MDBX_dbi_state_t state
Definition mdbx.h++:3212
env_managed(env_managed &&)=default
bool poll_sync_to_disk()
Performs non-blocking polling of sync-to-disk thresholds.
Definition mdbx.h++:3957
void put_multiple_samelength(const slice &key, const ::std::vector< VALUE > &vector, put_mode mode)
Definition mdbx.h++:5441
cursor_managed(cursor_managed &&)=default
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++:3684
move_result to_pair_lesser_or_equal(const slice &key, const slice &value, bool throw_notfound=true)
Definition mdbx.h++:5220
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.
move_result get_multiple_samelength(bool throw_notfound=false)
Definition mdbx.h++:5280
ptrdiff_t distance_to(const cursor to, unsigned deepness=42) const
Definition mdbx.h++:5308
move_result to_key_lesser_than(const slice &key, bool throw_notfound=true)
Definition mdbx.h++:5182
move_result to_next(bool throw_notfound=true)
Definition mdbx.h++:5179
env_managed(const ::std::string &pathname, const operate_parameters &, bool accede=true)
operator::mdbx::map_handle() const
Definition mdbx.h++:5346
size_t dbsize_max() const
Returns the maximal database size in bytes for the environment.
Definition mdbx.h++:3680
friend constexpr bool operator>=(const map_handle &a, const map_handle &b) noexcept
Definition mdbx.h++:3204
friend constexpr bool operator!=(const cache_entry &a, const cache_entry &b) noexcept
Definition mdbx.h++:3046
static env_managed open_for_recovery(const char *pathname, unsigned target_meta, bool writeable, unsigned max_maps=2)
Opens an environment instance using a specific meta-page for checking and recovery.
size_t close_all_cursors() const
Close all cursors.
Definition mdbx.h++:4533
friend constexpr bool operator<(const map_handle &a, const map_handle &b) noexcept
Definition mdbx.h++:3195
void commit()
Commits all changes of the transaction into a database with collecting latencies information.
move_result to_key_greater_than(const slice &key, bool throw_notfound=true)
Definition mdbx.h++:5197
constexpr bool notfound() const noexcept
Returns true if the entry caches the "key not found" state.
Definition mdbx.h++:3028
size_t get_pagesize() const
Returns pagesize of this MDBX environment.
Definition mdbx.h++:3764
void put(map_handle map, const pair &kv, put_mode mode)
Definition mdbx.h++:4781
env_managed(const ::std::string &pathname, const create_parameters &, const operate_parameters &, bool accede=true)
static env_managed open_for_recovery(const ::std::wstring &pathname, unsigned target_meta, bool writeable, unsigned max_maps=2)
void copy(const wchar_t *destination, bool compactify, bool force_dynamic_size=false)
Copy an MVCC-snapshot of the database to the destination path.
friend int compare_position(const cursor &left, const cursor &right, bool ignore_nested)
Definition mdbx.h++:7662
void copy(const ::std::wstring &destination, bool compactify, bool force_dynamic_size=false)
Copy an MVCC-snapshot of the database to the destination path.
void put_multiple_samelength(map_handle map, const slice &key, const ::std::vector< VALUE > &vector, put_mode mode)
Definition mdbx.h++:4840
bool checkpoint()
Commits all the operations of the transaction and immediately starts next without releasing any locks...
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++:3691
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++:4614
friend constexpr bool operator==(const map_handle &a, const map_handle &b) noexcept
Definition mdbx.h++:3192
bool checkpoint(finalization_latency *latency)
Commits all the operations of the transaction and immediately starts next without releasing any locks...
void commit_embark_read(finalization_latency &latency)
Commits all the operations of a transaction into the database and then start read transaction.
Definition mdbx.h++:4923
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++:4832
finalization_latency commit_embark_read_get_latency()
Commits all the operations of a transaction into the database and then start read transaction.
Definition mdbx.h++:4926
void commit(finalization_latency *)
Commits all changes of the transaction into a database with collecting latencies information.
friend constexpr bool operator>(const map_handle &a, const map_handle &b) noexcept
Definition mdbx.h++:3198
bool rename_map(const ::std::string &old_name, const ::std::string &new_name, bool throw_if_absent=false)
Переименовывает таблицу ключ-значение.
bool is_empty() const
Checks whether the database is empty.
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++:5232
env & copy(const ::std::string &destination, bool compactify, bool force_dynamic_size=false)
move_operation
Definition mdbx.h++:4998
@ multi_exactkey_lowerboundvalue
Definition mdbx.h++:5013
@ multi_exactkey_value_equal
Definition mdbx.h++:5030
@ pair_greater_or_equal
Definition mdbx.h++:5038
@ key_lesser_than
Definition mdbx.h++:5020
@ next
Definition mdbx.h++:5001
@ pair_exact
Definition mdbx.h++:5037
@ multi_exactkey_value_greater_or_equal
Definition mdbx.h++:5031
@ pair_lesser_or_equal
Definition mdbx.h++:5035
@ batch_samelength
Definition mdbx.h++:5041
@ seek_key
Definition mdbx.h++:5015
@ key_lowerbound
Definition mdbx.h++:5017
@ pair_lesser_than
Definition mdbx.h++:5034
@ pair_equal
Definition mdbx.h++:5036
@ key_greater_than
Definition mdbx.h++:5024
@ batch_samelength_next
Definition mdbx.h++:5042
@ multi_find_pair
Definition mdbx.h++:5012
@ key_greater_or_equal
Definition mdbx.h++:5023
@ key_exact
Definition mdbx.h++:5016
@ key_equal
Definition mdbx.h++:5022
@ multi_currentkey_prevvalue
Definition mdbx.h++:5007
@ key_lesser_or_equal
Definition mdbx.h++:5021
@ multi_nextkey_firstvalue
Definition mdbx.h++:5010
@ get_current
Definition mdbx.h++:5003
@ multi_exactkey_value_lesser_or_equal
Definition mdbx.h++:5029
@ multi_prevkey_lastvalue
Definition mdbx.h++:5005
@ previous
Definition mdbx.h++:5002
@ last
Definition mdbx.h++:5000
@ pair_greater_than
Definition mdbx.h++:5039
@ multi_exactkey_value_lesser_than
Definition mdbx.h++:5028
@ multi_currentkey_firstvalue
Definition mdbx.h++:5006
@ first
Definition mdbx.h++:4999
@ batch_samelength_previous
Definition mdbx.h++:5043
@ multi_currentkey_nextvalue
Definition mdbx.h++:5008
@ seek_and_batch_samelength
Definition mdbx.h++:5044
@ multi_exactkey_value_greater
Definition mdbx.h++:5032
@ multi_currentkey_lastvalue
Definition mdbx.h++:5009
finalization_latency commit_get_latency()
Commits all changes of the transaction into a database and return latency information.
Definition mdbx.h++:4898
friend constexpr bool operator==(const cache_entry &a, const cache_entry &b) noexcept
Definition mdbx.h++:3042
bool move(move_operation operation, slice &key, slice &value, bool throw_notfound)
Definition mdbx.h++:5156
void insert(const pair &kv)
Definition mdbx.h++:5371
bool is_dirty(const slice &item) const
Checks whether the given slice is on a dirty page.
Definition mdbx.h++:4440
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++:5373
move_result to_current_prev_multi(bool throw_notfound=true)
Definition mdbx.h++:5168
constexpr const MDBX_txn * handle() const noexcept
Definition mdbx.h++:4418
bool is_cooperative() const
Definition mdbx.h++:3788
bool clear_map(const ::std::string_view &name, bool throw_if_absent=false)
Definition mdbx.h++:4634
move_result to_exact_key_value_equal(const slice &key, const slice &value, bool throw_notfound=true)
Definition mdbx.h++:5207
bool rename_map(const char *old_name, const char *new_name, bool throw_if_absent=false)
Переименовывает таблицу ключ-значение.
env_managed(const env_managed &)=delete
move_result to_current_last_multi(bool throw_notfound=true)
Definition mdbx.h++:5175
bool is_readonly() const
Definition mdbx.h++:3784
value_result try_insert(const pair &kv)
Definition mdbx.h++:5372
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++:5433
constexpr cursor() noexcept=default
bool is_exclusive() const
Definition mdbx.h++:3786
move_result to_key_lesser_or_equal(const slice &key, bool throw_notfound=true)
Definition mdbx.h++:5185
finalization_latency abort_get_latency()
Abandon all the operations of the transaction instead of saving ones with collecting latencies inform...
Definition mdbx.h++:4884
constexpr MDBX_cursor * handle() noexcept
Definition mdbx.h++:4961
bool is_readwrite() const
Definition mdbx.h++:3792
move_result to_pair_greater_or_equal(const slice &key, const slice &value, bool throw_notfound=true)
Definition mdbx.h++:5229
size_t value_max(value_mode mode) const
Returns the maximal value size in bytes for specified values mode.
Definition mdbx.h++:3688
MDBX_cursor * handle_
Definition mdbx.h++:4945
static MDBX_NODISCARD info get_preopen_snapinfo(const wchar_t *pathname)
MDBX_dbi dbi
Definition mdbx.h++:3179
move_result to_exact_key_value_lesser_than(const slice &key, const slice &value, bool throw_notfound=true)
Definition mdbx.h++:5201
friend constexpr bool operator!=(const env &a, const env &b) noexcept
Definition mdbx.h++:3267
move_result to_current_next_multi(bool throw_notfound=true)
Definition mdbx.h++:5172
intptr_t page_size
The size of a memory page in bytes.
Definition mdbx.h++:3600
size_t size_max() const
Returns maximal write transaction size (i.e. limit for summary volume of dirty pages) in bytes.
Definition mdbx.h++:4454
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++:5213
ptrdiff_t distance_from(const cursor from, unsigned deepness=42) const
Definition mdbx.h++:5304
::MDBX_stat stat
Statistics for a database in the MDBX environment.
Definition mdbx.h++:3736
size_t value_min(value_mode mode) const noexcept
Returns the minimal value size in bytes for specified values mode.
Definition mdbx.h++:3686
cache_entry(const cache_entry &) noexcept=default
value_result try_insert(map_handle map, const pair &kv)
Definition mdbx.h++:4783
void insert(map_handle map, const pair &kv)
Definition mdbx.h++:4782
env_managed(const ::mdbx::filesystem::path &pathname, const create_parameters &, const operate_parameters &, bool accede=true)
Create new or open existing database.
txn_managed start_nested(bool readonly)
Start nested transaction.
cache_entry & operator=(const cache_entry &) noexcept=default
bool rename_map(const ::std::string_view &old_name, const ::std::string_view &new_name, bool throw_if_absent=false)
Переименовывает таблицу ключ-значение.
Definition mdbx.h++:4642
move_result to_key_equal(const slice &key, bool throw_notfound=true)
Definition mdbx.h++:5188
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++:5161
friend class txn
Definition mdbx.h++:3247
bool is_before_than(const cursor &other, bool ignore_nested=false) const
Definition mdbx.h++:4972
friend constexpr bool operator==(const txn &a, const txn &b) noexcept
Definition mdbx.h++:4420
size_t key_min(key_mode mode) const noexcept
Returns the minimal key size in bytes for specified keys mode.
Definition mdbx.h++:3682
size_t size_current() const
Returns current write transaction size (i.e. summary volume of dirty pages) in bytes.
Definition mdbx.h++:4457
constexpr env_managed() noexcept=default
bool fullscan(CALLABLE_PREDICATE predicate, bool backward=false)
Definition mdbx.h++:5101
Cache entry for the transparent read-your-writes caching, see txn::get_cached() and mdbx_cache_get().
Definition mdbx.h++:3011
Unmanaged cursor.
Definition mdbx.h++:4943
Managed cursor.
Definition mdbx.h++:5453
Unmanaged database environment.
Definition mdbx.h++:3246
Managed database environment.
Definition mdbx.h++:4217
Unmanaged database transaction.
Definition mdbx.h++:4401
Managed database transaction.
Definition mdbx.h++:4858
value_mode
Kind of the values and sorted multi-values with corresponding comparison.
Definition mdbx.h++:3093
int setup_debug_nofmt(MDBX_log_level_t log_level, MDBX_debug_flags_t debug_flags, MDBX_debug_func_nofmt logger, char *logger_buffer, size_t logger_buffer_size)
Sets up the global log-level, debug options and a logger for plain preformatted messages.
Definition mdbx.h++:4385
inline ::std::string ratio2percents(uint64_t value, uint64_t whole)
Converts a fraction to a percentage string without using floating-point operations.
Definition mdbx.h++:4355
env_managed::create_parameters create_parameters
Shorthand for env_managed::create_parameters.
Definition mdbx.h++:4344
::MDBX_cmp_func comparator
Definition mdbx.h++:3224
inline ::std::string ratio2digits(uint64_t numerator, uint64_t denominator, int precision)
Converts a fraction to a string of decimal digits without using floating-point operations.
Definition mdbx.h++:4348
MDBX_CXX01_CONSTEXPR_ENUM bool is_reverse(key_mode mode) noexcept
Definition mdbx.h++:3086
MDBX_CXX01_CONSTEXPR_ENUM bool is_msgpack(key_mode mode) noexcept
Definition mdbx.h++:3090
MDBX_CXX01_CONSTEXPR_ENUM bool is_usual(key_mode mode) noexcept
Definition mdbx.h++:3074
bool is_readahead_reasonable(size_t volume, intptr_t redundancy)
Quickly finds out whether readahead is reasonable for the given data volume and redundancy.
Definition mdbx.h++:4362
MDBX_CXX01_CONSTEXPR_ENUM bool is_multi(value_mode mode) noexcept
Definition mdbx.h++:3154
MDBX_cmp_func get_datacmp(MDBX_db_flags_t flags)
Returns the built-in data (value) comparator for the given table flags, which is useful as a fallback...
Definition mdbx.h++:4369
int setup_debug(MDBX_log_level_t log_level=MDBX_LOG_DONTCHANGE, MDBX_debug_flags_t debug_flags=MDBX_DBG_DONTCHANGE, MDBX_debug_func logger=nullptr)
Sets up the global log-level, debug options and logger.
Definition mdbx.h++:4375
MDBX_CXX01_CONSTEXPR_ENUM bool is_samelength(key_mode mode) noexcept
Definition mdbx.h++:3082
comparator default_comparator(key_mode mode) noexcept
Definition mdbx.h++:3225
env::operate_options operate_options
Shorthand for env::operate_options.
Definition mdbx.h++:4340
put_mode
Key-value pairs put mode.
Definition mdbx.h++:3233
loop_control
Loop control constants for readers enumeration functor and other cases.
Definition mdbx.h++:3055
key_mode
Kinds of the keys and corresponding modes of comparing it.
Definition mdbx.h++:3058
MDBX_CXX01_CONSTEXPR_ENUM bool is_ordinal(key_mode mode) noexcept
Definition mdbx.h++:3078
env::operate_parameters operate_parameters
Shorthand for env::operate_parameters.
Definition mdbx.h++:4342
void set_panic(MDBX_panic_func func)
Sets a callback for assertion failures, called before printing the message and aborting.
Definition mdbx.h++:4392
env::reclaiming_options reclaiming_options
Shorthand for env::reclaiming_options.
Definition mdbx.h++:4338
env::geometry geometry
Shorthand for env::geometry.
Definition mdbx.h++:4336
@ multi_reverse_samelength
Definition mdbx.h++:3126
@ multi_samelength
Definition mdbx.h++:3111
@ multi_ordinal
Definition mdbx.h++:3118
@ msgpack
Definition mdbx.h++:3141
@ single
Definition mdbx.h++:3094
@ multi
Definition mdbx.h++:3096
@ multi_reverse
Definition mdbx.h++:3103
@ upsert
Insert or update.
Definition mdbx.h++:3235
@ update
Update existing, don't insert new.
Definition mdbx.h++:3236
@ insert_unique
Insert only unique keys.
Definition mdbx.h++:3234
@ continue_loop
Definition mdbx.h++:3055
@ exit_loop
Definition mdbx.h++:3055
@ usual
Definition mdbx.h++:3059
@ ordinal
Definition mdbx.h++:3064
@ reverse
Definition mdbx.h++:3061
@ msgpack
Definition mdbx.h++:3069
Information about the system RAM, see mdbx_get_sysraminfo().
Definition mdbx.h++:3599
A handle for an individual table (aka key-value space, maps or sub-database) in the environment.
Definition mdbx.h++:3178
buffer & assign(const void *begin, const void *end, bool make_reference=false)
Definition mdbx.h++:2611
constexpr buffer(const ::std::basic_string_view< CHAR, T > &view, bool make_reference, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2291
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++:2149
void resize(size_t size, byte value)
Resizes the buffer to contain size bytes, filling the added space with value. STL-compatible counterp...
Definition mdbx.h++:2255
modality
Data storage modality.
Definition mdbx.h++:1724
buffer_pair_spec & operator=(const buffer_pair_spec &)=default
constexpr byte * byte_ptr() noexcept
Returns casted to pointer to byte an address of data.
Definition mdbx.h++:2179
constexpr ::std::span< byte > bytes()
Definition mdbx.h++:697
constexpr buffer & set_end(const void *ptr)
Sets the length by specifying the end of the data.
Definition mdbx.h++:2264
buffer_pair_spec(const buffer_pair_spec &)=default
constexpr allocator_type get_allocator() const
Definition mdbx.h++:2129
static constexpr slice wrap(const char(&text)[SIZE])
Definition mdbx.h++:711
constexpr slice(const ::std::span< POD > &span)
Definition mdbx.h++:673
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++:2447
void reserve_tailroom(size_t wanna_tailroom)
Definition mdbx.h++:2496
constexpr slice(const ::std::basic_string< CHAR, T, A > &str)
Create a slice that refers to the contents of "str".
Definition mdbx.h++:664
const slice source
Definition mdbx.h++:1395
bool is_erroneous() const noexcept
Checks whether the content of a passed slice is a valid Base58 dump, and therefore can be decoded wit...
static buffer key_from(const double *ieee754_64bit)
Definition mdbx.h++:2869
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++:2396
slice & assign(::std::basic_string_view< CHAR, T > &&view)
Definition mdbx.h++:733
constexpr const char * end_char_ptr() const noexcept
Returns casted to const pointer to char an end of data.
Definition mdbx.h++:2195
int8_t as_int8_adapt() const
constexpr buffer make_inplace_or_reference() const
Definition mdbx.h++:2531
constexpr const char * char_ptr() const noexcept
Returns casted to const pointer to char an address of data.
Definition mdbx.h++:2192
buffer & assign(const char *c_str, bool make_reference=false)
Definition mdbx.h++:2620
void reserve(size_t wanna_headroom, size_t wanna_tailroom)
Reserves storage space.
Definition mdbx.h++:2471
constexpr size_t tailroom() const noexcept
Returns the number of bytes that available in currently allocated storage after the data.
Definition mdbx.h++:2167
constexpr buffer(const ::std::basic_string_view< CHAR, T > &view, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2330
buffer & assign(const struct slice &src, bool make_reference=false)
Definition mdbx.h++:2591
void reserve_headroom(size_t wanna_headroom)
Reserves space before the payload.
Definition mdbx.h++:2493
constexpr byte * end_byte_ptr() noexcept
Returns casted to pointer to byte an end of data.
Definition mdbx.h++:2186
buffer & append(const ::std::basic_string_view< CHAR, T > &view)
Definition mdbx.h++:2650
buffer(size_t head_room, size_t tail_room, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2335
buffer< ALLOCATOR, CAPACITY_POLICY > buffer_type
Definition mdbx.h++:2901
::std::allocator_traits< allocator_type > allocator_traits
Definition mdbx.h++:1710
constexpr uint16_t as_uint16() const
Definition mdbx.h++:1113
constexpr size_t envisage_result_length() const noexcept
Returns the buffer size in bytes needed for Base58 dump of passed slice.
Definition mdbx.h++:1371
constexpr buffer & assign(size_t headroom, const buffer &src, size_t tailroom)
Definition mdbx.h++:2536
constexpr void * data() noexcept
Return a pointer to the beginning of the referenced data.
Definition mdbx.h++:2225
buffer & append_decoded_hex(const struct slice &data, bool ignore_spaces=false)
Definition mdbx.h++:2758
buffer & append(const byte c)
Definition mdbx.h++:2695
buffer & assign_freestanding(const void *ptr, size_t bytes)
Definition mdbx.h++:2509
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++:1094
constexpr void swap(buffer &other) noexcept(swap_alloc::is_nothrow())
Definition mdbx.h++:2514
buffer & operator=(const buffer &src)
Definition mdbx.h++:2637
constexpr uint32_t as_uint32() const
Definition mdbx.h++:1112
buffer & append_u16(uint_fast16_t u16)
Definition mdbx.h++:2780
constexpr size_t headroom() const noexcept
Returns the number of bytes available in the currently allocated storage in front of the data.
Definition mdbx.h++:2162
buffer_pair_spec(buffer_pair_spec &&pair) noexcept(buffer_type::move_assign_alloc::is_nothrow())
Definition mdbx.h++:2943
constexpr int64_t as_int64() const
Definition mdbx.h++:1119
constexpr const void * data() const noexcept
Return a const pointer to the beginning of the referenced data.
Definition mdbx.h++:2212
static buffer key_from(const ::std::basic_string< CHAR, T, A > &src, bool make_reference=false)
Definition mdbx.h++:2859
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++:2378
const bool ignore_spaces
Definition mdbx.h++:1475
void swap(::std::basic_string_view< CHAR, T > &view) noexcept
Definition mdbx.h++:855
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++:2460
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++:2454
static buffer wrap(const POD &pod, bool make_reference=false, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2373
value_result & operator=(const value_result &) noexcept=default
buffer_type value
Definition mdbx.h++:2906
buffer & add_header(const void *src, size_t bytes)
Definition mdbx.h++:2705
buffer encode_hex(bool uppercase=false, unsigned wrap_width=0, const allocator_type &alloc=allocator_type()) const
Definition mdbx.h++:2416
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.
pair & operator=(stl_pair &&couple)
Definition mdbx.h++:1182
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++:2912
constexpr int16_t as_int16() const
Definition mdbx.h++:1121
slice value
Definition mdbx.h++:1146
::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++:2914
buffer & assign(const ::std::basic_string< CHAR, T, A > &str, bool make_reference=false)
Definition mdbx.h++:2616
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++:2440
constexpr buffer(const ::std::basic_string< CHAR, T, A > &&str, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2319
constexpr bool is_reference() const noexcept
Definition mdbx.h++:2981
static buffer key_from_jsonInteger(const int64_t json_integer)
Definition mdbx.h++:2879
bool is_empty() const noexcept
Checks whether a passed slice is empty, and therefore there will be no output bytes.
Definition mdbx.h++:1342
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++:2466
static constexpr buffer invalid() noexcept
Builds an invalid buffer that has a non-zero length and refers to a null address.
Definition mdbx.h++:2370
slice value
Definition mdbx.h++:1160
::std::pair< buffer_type, buffer_type > stl_pair
Definition mdbx.h++:2905
::std::ostream & output(::std::ostream &out) const
Output hexadecimal dump of passed slice to the std::ostream.
pair_result(const pair_result &) noexcept=default
static buffer key_from(const float ieee754_32bit)
Definition mdbx.h++:2885
const slice source
Definition mdbx.h++:1474
buffer_pair_spec(const slice &key, const slice &value, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2923
const slice source
Definition mdbx.h++:1309
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++:2404
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++:1457
const unsigned wrap_width
Definition mdbx.h++:1311
buffer & operator=(const ::std::basic_string_view< CHAR, T > &view) noexcept
Definition mdbx.h++:2646
constexpr buffer() noexcept=default
static buffer key_from_double(const double ieee754_64bit)
Definition mdbx.h++:2865
slice & assign(const ::std::basic_string< CHAR, T, ALLOCATOR > &str)
Definition mdbx.h++:725
constexpr bool is_freestanding() const noexcept
Definition mdbx.h++:2976
const slice & slice() const noexcept
Definition mdbx.h++:2897
buffer & assign(struct slice &&src, bool make_reference=false)
Definition mdbx.h++:2599
const bool ignore_spaces
Definition mdbx.h++:1441
constexpr POD as_pod() const
Definition mdbx.h++:1096
constexpr buffer & assign(buffer &&src) noexcept(move_assign_alloc::is_nothrow())
Definition mdbx.h++:2568
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++:1209
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++:1542
buffer_pair_spec(const stl_pair &pair, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2918
buffer & assign(const void *ptr, size_t bytes, bool make_reference=false)
Definition mdbx.h++:2587
constexpr buffer(const buffer &src)
Definition mdbx.h++:2301
constexpr slice substr(size_t pos, size_t count=npos) const
Returns a sub-slice of [pos, pos+count) clamped to the end.
Definition mdbx.h++:981
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++:2433
constexpr uint128_t as_uint128() const
Definition mdbx.h++:1109
uint16_t as_uint16_adapt() const
buffer_pair_spec & operator=(pair &&src)
Definition mdbx.h++:2958
constexpr size_t length() const noexcept
Returns the number of bytes.
Definition mdbx.h++:2238
static buffer key_from_u64(const uint64_t unsigned_int64)
Definition mdbx.h++:2871
constexpr friend void swap(buffer &left, buffer &right) noexcept(buffer::is_swap_nothrow())
Definition mdbx.h++:2523
constexpr to_hex(const slice &source, bool uppercase=false, unsigned wrap_width=0) noexcept
Definition mdbx.h++:1312
buffer_pair_spec(const stl_pair &pair, bool make_reference, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2920
buffer & append_base64(const struct slice &data, unsigned wrap_width=0)
Definition mdbx.h++:2754
static buffer key_from(const ::std::basic_string_view< CHAR, T > &src, bool make_reference=false)
Definition mdbx.h++:2851
static constexpr size_t advise(const size_t current, const size_t wanna, const size_t inplace)
Definition mdbx.h++:1675
constexpr byte * end() noexcept
Return a pointer to the end of the referenced data.
Definition mdbx.h++:2232
buffer(size_t head_room, const slice &src, size_t tail_room, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2346
slice & operator=(const ::std::basic_string_view< CHAR, T > &view)
Definition mdbx.h++:747
std::pair< slice, slice > stl_pair
Definition mdbx.h++:1159
buffer & append_byte(uint_fast8_t byte)
Definition mdbx.h++:2778
constexpr bool is_inplace() const noexcept
Checks whether data chunk stored in place within the buffer instance itself, without reference outsid...
Definition mdbx.h++:2144
constexpr const byte * end() const noexcept
Return a const pointer to the end of the referenced data.
Definition mdbx.h++:2215
value_result(const value_result &) noexcept=default
constexpr slice(const slice &) noexcept=default
typename silo::copy_assign_alloc copy_assign_alloc
Definition mdbx.h++:2124
@ pettiness_threshold
Definition mdbx.h++:1664
@ extra_inplace_storage
Definition mdbx.h++:1662
@ max_reserve
Definition mdbx.h++:1665
@ inplace_storage_size_rounding
Definition mdbx.h++:1663
static buffer key_from_float(const float ieee754_32bit)
Definition mdbx.h++:2883
constexpr ::std::span< POD > as_span()
Definition mdbx.h++:687
constexpr from_base58(const slice &source, bool ignore_spaces=false) noexcept
Definition mdbx.h++:1476
buffer & operator=(const struct slice &src)
Definition mdbx.h++:2641
buffer_type key
Definition mdbx.h++:2906
buffer & append_base58(const struct slice &data, unsigned wrap_width=0)
Definition mdbx.h++:2750
constexpr int8_t as_int8() const
Definition mdbx.h++:1122
constexpr ::std::span< char > chars()
Definition mdbx.h++:699
constexpr slice(size_t invalid_length) noexcept
Definition mdbx.h++:1141
constexpr size_t envisage_result_length() const noexcept
Returns the buffer size in bytes needed for Base64 dump of passed slice.
Definition mdbx.h++:1414
buffer(const char *c_str, bool make_reference, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2286
buffer(const txn &transaction, const slice &src, const allocator_type &alloc=allocator_type())
static constexpr size_t round(const size_t value)
Definition mdbx.h++:1668
bool is_empty() const noexcept
Checks whether a passed slice is empty, and therefore there will be no output bytes.
Definition mdbx.h++:1385
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++:1533
value_result(const slice &value, bool done) noexcept
Definition mdbx.h++:1148
static buffer key_from(buffer &&src) noexcept
Definition mdbx.h++:2863
bool is_empty() const noexcept
Checks whether a passed slice is empty, and therefore there will be no output bytes.
Definition mdbx.h++:1503
buffer encode_base64(unsigned wrap_width=0, const allocator_type &alloc=allocator_type()) const
Definition mdbx.h++:2428
buffer(size_t capacity, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2341
const slice source
Definition mdbx.h++:1352
constexpr pair(const stl_pair &couple) noexcept
Definition mdbx.h++:1162
buffer & assign(::MDBX_val &&src, bool make_reference=false)
Definition mdbx.h++:2605
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++:2133
static buffer key_from(const float *ieee754_32bit)
Definition mdbx.h++:2887
constexpr ::std::span< const char > chars() const
Definition mdbx.h++:698
constexpr from_base64(const slice &source, bool ignore_spaces=false) noexcept
Definition mdbx.h++:1516
buffer_pair_spec & operator=(buffer_pair_spec &&src)
Definition mdbx.h++:2947
buffer & append_u48(uint_fast64_t u48)
Definition mdbx.h++:2813
constexpr void swap(slice &other) noexcept
Definition mdbx.h++:863
typename silo::swap_alloc swap_alloc
Definition mdbx.h++:2125
constexpr buffer(const ::std::basic_string< CHAR, T, A > &str, bool make_reference, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2314
bool is_erroneous() const noexcept
Checks whether the content of the passed slice could be encoded; this encoder always returns false.
Definition mdbx.h++:1346
CAPACITY_POLICY reservation_policy
Definition mdbx.h++:1711
uint8_t as_uint8_adapt() const
constexpr ::std::span< const POD > as_span() const
Definition mdbx.h++:678
static buffer key_from(const int64_t signed_int64)
Definition mdbx.h++:2877
constexpr buffer(const void *ptr, size_t bytes, bool make_reference, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2283
void reserve(size_t size)
Reserves storage space for at least size bytes of payload, without changing the current length....
Definition mdbx.h++:2501
buffer & operator=(struct slice &&src)
Definition mdbx.h++:2643
buffer_pair_spec & operator=(const stl_pair &src)
Definition mdbx.h++:2963
buffer & add_header(const struct slice &chunk)
Definition mdbx.h++:2722
buffer & append_u32(uint_fast32_t u32)
Definition mdbx.h++:2801
buffer & append_decoded_base58(const struct slice &data, bool ignore_spaces=false)
Definition mdbx.h++:2762
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++:1493
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++:1464
int32_t as_int32_adapt() const
buffer_pair_spec & operator=(const pair &src)
Definition mdbx.h++:2953
@ max_length
Definition mdbx.h++:643
@ npos
Definition mdbx.h++:643
pair & operator=(pair &&couple) noexcept
Definition mdbx.h++:1166
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++:2411
static buffer key_from_i32(const int32_t signed_int32)
Definition mdbx.h++:2893
slice inherited
Definition mdbx.h++:1704
constexpr pair_result(const slice &key, const slice &value, bool done) noexcept
Definition mdbx.h++:1210
constexpr from_hex(const slice &source, bool ignore_spaces=false) noexcept
Definition mdbx.h++:1442
static buffer key_from_u32(const uint32_t unsigned_int32)
Definition mdbx.h++:2889
char * write_bytes(char *dest, size_t dest_size) const
Fills the buffer by hexadecimal dump of a passed slice.
static buffer key_from(const uint32_t unsigned_int32)
Definition mdbx.h++:2891
buffer & assign_reference(const void *ptr, size_t bytes)
Definition mdbx.h++:2503
static constexpr pair invalid() noexcept
Definition mdbx.h++:1175
typename silo::move_assign_alloc move_assign_alloc
Definition mdbx.h++:2123
void make_freestanding()
Makes buffer owning the data.
Definition mdbx.h++:2272
constexpr bool contains(const slice &needle) const noexcept
Checks whether the referenced data contains needle as a sub-slice.
Definition mdbx.h++:1028
buffer & assign(const ::MDBX_val &src, bool make_reference=false)
Definition mdbx.h++:2595
bool done
Definition mdbx.h++:1208
::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 could be encoded; always returns false for the Base58 en...
Definition mdbx.h++:1389
constexpr ::std::span< const byte > bytes() const
Definition mdbx.h++:696
constexpr intptr_t compare(const slice &other) const noexcept
Lexicographical three-way comparison with another slice.
Definition mdbx.h++:1033
constexpr const void * const_end() const noexcept
Definition mdbx.h++:2221
static constexpr slice wrap(const POD &pod)
Definition mdbx.h++:713
const bool uppercase
Definition mdbx.h++:1310
constexpr char * char_ptr() noexcept
Returns casted to pointer to char an address of data.
Definition mdbx.h++:2199
constexpr byte front() const noexcept
Returns the first byte of the referenced data.
Definition mdbx.h++:973
void clear_and_reserve(size_t whole_capacity, size_t headroom=0)
Clears the contents and reserve storage.
Definition mdbx.h++:2668
constexpr buffer & assign(const buffer &src, bool make_reference=false)
Definition mdbx.h++:2550
buffer & append(const struct slice &chunk)
Definition mdbx.h++:2703
buffer & append_decoded_base64(const struct slice &data, bool ignore_spaces=false)
Definition mdbx.h++:2766
buffer_pair_spec(const pair &pair, bool make_reference, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2931
void make_freestanding()
Definition mdbx.h++:2987
constexpr char * end_char_ptr() noexcept
Returns casted to pointer to char an end of data.
Definition mdbx.h++:2206
const bool ignore_spaces
Definition mdbx.h++:1515
constexpr to_base64(const slice &source, unsigned wrap_width=0) noexcept
Definition mdbx.h++:1398
pair(const pair &) noexcept=default
static buffer key_from(const char(&text)[SIZE], bool make_reference=true)
Definition mdbx.h++:2845
static constexpr slice invalid() noexcept
Builds an invalid slice that has a non-zero length and refers to a null address.
Definition mdbx.h++:1089
bool is_erroneous() const noexcept
Checks whether the content of a passed slice is a valid Base64 dump, and therefore can be decoded wit...
slice & operator=(const slice &) noexcept=default
uint128_t as_uint128_adapt() const
constexpr int128_t as_int128() const
Definition mdbx.h++:1117
buffer_pair_spec & operator=(stl_pair &&src)
Definition mdbx.h++:2968
slice key
Definition mdbx.h++:1160
buffer & append(const void *src, size_t bytes)
Definition mdbx.h++:2678
constexpr pair(const slice &key, const slice &value) noexcept
Definition mdbx.h++:1161
buffer_pair_spec(const txn &transaction, const pair &pair, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2937
const slice source
Definition mdbx.h++:1514
pair_result & operator=(const pair_result &) noexcept=default
void shrink_to_fit()
Reduces memory usage by freeing unused storage space.
Definition mdbx.h++:2673
bool is_empty() const noexcept
Checks whether a passed slice is empty, and therefore there will be no output bytes.
Definition mdbx.h++:1431
static buffer key_from(const int32_t signed_int32)
Definition mdbx.h++:2895
void clear() noexcept
Clears the contents and storage.
Definition mdbx.h++:2665
typename buffer_type::allocator_traits allocator_traits
Definition mdbx.h++:2903
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++:1120
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++:2390
constexpr buffer(const void *ptr, size_t bytes, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2305
typename ::std::allocator_traits< ALLOCATOR >::template rebind_alloc< uint64_t > allocator_type
Definition mdbx.h++:1706
static buffer key_from(const double ieee754_64bit)
Definition mdbx.h++:2867
constexpr const byte * byte_ptr() const noexcept
Returns casted to const pointer to byte an address of data.
Definition mdbx.h++:2172
constexpr modality content_modality() const noexcept
Returns current modality of buffer content.
Definition mdbx.h++:2152
constexpr const void * const_data() const noexcept
Definition mdbx.h++:2218
pair & operator=(const stl_pair &couple)
Definition mdbx.h++:1177
int64_t as_int64_adapt() const
static buffer key_from_i64(const int64_t signed_int64)
Definition mdbx.h++:2875
constexpr const byte * end_byte_ptr() const noexcept
Returns casted to const pointer to byte an end of data.
Definition mdbx.h++:2175
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++:2385
static buffer clone(const buffer &src, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2527
buffer_pair_spec(const pair &pair, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2929
constexpr uint8_t as_uint8() const
Definition mdbx.h++:1114
CAPACITY_POLICY reservation_policy
Definition mdbx.h++:2904
void resize(size_t size)
Resizes the buffer to contain size bytes, filling the added space with zeroes. STL-compatible counter...
Definition mdbx.h++:2251
constexpr buffer(const char *c_str, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2326
static constexpr bool is_swap_nothrow() noexcept
Definition mdbx.h++:2126
buffer & append(const ::std::basic_string< CHAR, T, A > &str)
Definition mdbx.h++:2660
buffer & append_u8(uint_fast8_t u8)
Definition mdbx.h++:2770
buffer & append_u24(uint_fast32_t u24)
Definition mdbx.h++:2790
constexpr uint64_t as_uint64() const
Definition mdbx.h++:1111
constexpr byte back() const noexcept
Returns the last byte of the referenced data.
Definition mdbx.h++:977
buffer_pair_spec(const slice &key, const slice &value, bool make_reference, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2925
static buffer key_from(const uint64_t unsigned_int64)
Definition mdbx.h++:2873
bool is_erroneous() const noexcept
Checks whether the content of a passed slice is a valid hexadecimal dump, and therefore can be decode...
buffer encode_base58(unsigned wrap_width=0, const allocator_type &alloc=allocator_type()) const
Definition mdbx.h++:2423
buffer & append_u64(uint_fast64_t u64)
Definition mdbx.h++:2827
const unsigned wrap_width
Definition mdbx.h++:1353
buffer & append_hex(const struct slice &data, bool uppercase=false, unsigned wrap_width=0)
Definition mdbx.h++:2746
static constexpr buffer null() noexcept
Build a null buffer which zero length and refers to null address.
Definition mdbx.h++:2366
const unsigned wrap_width
Definition mdbx.h++:1396
buffer & operator=(buffer &&src) noexcept(move_assign_alloc::is_nothrow())
Definition mdbx.h++:2639
uint32_t as_uint32_adapt() const
constexpr bool is_valid() const noexcept
Checks the slice is valid: returns false only if it has a null data pointer and a non-zero length.
Definition mdbx.h++:1085
char * write_bytes(char *dest, size_t dest_size) const
Fills the buffer by Base64 dump of passed slice.
buffer & append_producer(PRODUCER &producer)
Definition mdbx.h++:2724
buffer_pair_spec(buffer_type &&key, buffer_type &&value) noexcept(buffer_type::move_assign_alloc::is_nothrow())
Definition mdbx.h++:2940
buffer_pair_spec(const txn &transaction, const slice &key, const slice &value, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2934
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++:705
buffer & append_producer(const PRODUCER &producer)
Definition mdbx.h++:2735
constexpr buffer(const ::std::basic_string< CHAR, T, A > &str, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2309
int16_t as_int16_adapt() const
static buffer key_from(const char *src, bool make_reference=false)
Definition mdbx.h++:2856
typename buffer_type::allocator_type allocator_type
Definition mdbx.h++:2902
@ pettiness_threshold
Definition mdbx.h++:1720
@ max_length
Definition mdbx.h++:1713
@ max_capacity
Definition mdbx.h++:1714
@ extra_inplace_storage
Definition mdbx.h++:1715
@ inplace_storage_size_rounding
Definition mdbx.h++:1716
bool is_erroneous() const noexcept
Checks whether the content of the passed slice could be encoded; this encoder always returns false.
Definition mdbx.h++:1435
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++:1355
friend class txn
Definition mdbx.h++:1727
constexpr buffer(const struct slice &src, const allocator_type &alloc=allocator_type())
Definition mdbx.h++:2297
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++:1327
buffer(buffer &&src) noexcept(::std::is_nothrow_move_constructible< allocator_type >::value)
Definition mdbx.h++:2354
bool done
Definition mdbx.h++:1147
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++:1440
constexpr size_t capacity() const noexcept
Returns the number of bytes that can be held in currently allocated storage.
Definition mdbx.h++:2157
constexpr buffer & set_length(size_t bytes)
Set length of data.
Definition mdbx.h++:2243
The chunk of data stored inside the buffer or located outside it.
Definition mdbx.h++:1702
inline ::std::string dump_val(const slice &value)
Dumps the given value to a string: as-is when printable (all bytes in the range 0x20....
Definition mdbx.h++:1263
uint64_t key_from_jsonInteger(int64_t json_integer) noexcept
Value-to-Key functions to avoid using custom comparators.
Definition mdbx.h++:1226
uint64_t key_from_int64(int64_t i64) noexcept
Definition mdbx.h++:1242
float float_from_key(const slice &key) noexcept
Definition mdbx.h++:1250
uint64_t key_from_double(double ieee754_64bit) noexcept
Definition mdbx.h++:1230
int64_t jsonInteger_from_key(const slice &key) noexcept
Definition mdbx.h++:1256
uint32_t key_from_float(float ieee754_32bit) noexcept
Definition mdbx.h++:1236
int64_t int64_from_key(const slice &key) noexcept
Definition mdbx.h++:1254
uint32_t key_from_ptrfloat(const float *const ieee754_32bit) noexcept
Definition mdbx.h++:1238
uint64_t key_from_ptrdouble(const double *const ieee754_64bit) noexcept
Definition mdbx.h++:1232
double double_from_key(const slice &key) noexcept
Key-to-Value functions to avoid using custom comparators.
Definition mdbx.h++:1248
uint32_t key_from_int32(int32_t i32) noexcept
Definition mdbx.h++:1244
int32_t int32_from_key(const slice &key) noexcept
Definition mdbx.h++:1252
Type tag for delivered buffer template classes.
Definition mdbx.h++:1698
Base58 decoder which satisfy SliceTranscoder concept.
Definition mdbx.h++:1473
Base64 decoder which satisfy SliceTranscoder concept.
Definition mdbx.h++:1513
Hexadecimal decoder which satisfy SliceTranscoder concept.
Definition mdbx.h++:1439
Combines pair of slices for key and value to represent result of certain operations.
Definition mdbx.h++:1158
Combines pair of slices for key and value with boolean flag to represent result of certain operations...
Definition mdbx.h++:1207
References a data located outside the slice.
Definition mdbx.h++:638
Base58 encoder which satisfy SliceTranscoder concept.
Definition mdbx.h++:1351
Base64 encoder which satisfy SliceTranscoder concept.
Definition mdbx.h++:1394
Hexadecimal encoder which satisfy SliceTranscoder concept.
Definition mdbx.h++:1308
Combines data slice with boolean flag to represent result of certain operations.
Definition mdbx.h++:1145
incompatible_operation(const ::mdbx::error &)
fatal(exception &&src) noexcept
Definition mdbx.h++:555
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++:5571
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
Panics on unrecoverable errors inside destructors etc.
fatal(const exception &src) noexcept
Definition mdbx.h++:554
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 &)
static void success_or_throw(int error_code)
Definition mdbx.h++:525
laggard_reader(const ::mdbx::error &)
db_full(const ::mdbx::error &)
duplicated_lck_file(const ::mdbx::error &)
const ::mdbx::error error() const noexcept
Definition mdbx.h++:545
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++:556
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++:557
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++:5569
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++:487
Transfers C++ exceptions thru C callbacks.
Definition mdbx.h++:472
LIBMDBX_API void throw_allocators_mismatch()
#define MDBX_DECLARE_EXCEPTION(NAME)
Definition mdbx.h++:563
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:5042
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:5046
LIBMDBX_API uint64_t mdbx_key_from_jsonInteger(const int64_t json_integer)
#define MDBX_CXX20_CONSTEXPR
Definition mdbx.h++:195
#define MDBX_MSVC_DECLSPEC_EMPTY_BASES
Definition mdbx.h++:138
#define MDBX_CXX17_FALLTHROUGH
Definition mdbx.h++:237
#define MDBX_ASSERT_CXX20_CONCEPT_SATISFIED(CONCEPT, TYPE)
Definition mdbx.h++:286
#define MDBX_EXTERN_API_TEMPLATE(API_ATTRIBUTES,...)
Definition mdbx.h++:128
#define MDBX_CXX11_CONSTEXPR_ENUM
Definition mdbx.h++:205
#define MDBX_CXX17_CONSTEXPR
Definition mdbx.h++:184
#define MDBX_CONSTEXPR_ASSERT(expr)
Definition mdbx.h++:223
#define MDBX_IF_CONSTEXPR
Definition mdbx.h++:228
#define MDBX_NODISCARD
Definition mdbx.h++:259
#define MDBX_CXX01_CONSTEXPR_ENUM
Definition mdbx.h++:204
#define MDBX_CXX20_LIKELY
Definition mdbx.h++:243
The libmdbx C API header file.
constexpr bool allocator_is_always_equal() noexcept
Definition mdbx.h++:1552
The libmdbx C++ API namespace.
Definition mdbx.h++:319
string to_string(const ::mdbx::slice &value)
Definition mdbx.h++:8049
byte buffer_[inplace_size - sizeof(byte)]
Definition mdbx.h++:1803
constexpr inplace_flag_holder(byte signature)
Definition mdbx.h++:1805
byte lastbyte_
Definition mdbx.h++:1804
estimate_result(const cursor &cursor, move_operation operation)
Definition mdbx.h++:5065
estimate_result & operator=(const estimate_result &) noexcept=default
ptrdiff_t approximate_quantity
Definition mdbx.h++:5064
estimate_result(const estimate_result &) noexcept=default
estimate_result(const cursor &cursor, move_operation operation, const slice &key)
Definition mdbx.h++:5067
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++:5055
move_result(cursor &cursor, move_operation operation, bool throw_notfound)
Definition mdbx.h++:5053
Tagged type for output to std::ostream.
Definition mdbx.h++:3300
intptr_t bytes
Definition mdbx.h++:3301
constexpr size(intptr_t bytes) noexcept
Definition mdbx.h++:3302
Database geometry for size management.
Definition mdbx.h++:3276
constexpr geometry(const geometry &) noexcept=default
static constexpr geometry fixed(intptr_t size) noexcept
Creates a fixed-size geometry, i.e. with disabled growing and shrinking.
Definition mdbx.h++:3365
intptr_t size_upper
The upper bound of database size in bytes.
Definition mdbx.h++:3324
intptr_t pagesize
The database page size for new database creation or default_value otherwise.
Definition mdbx.h++:3336
@ GB
bytes (0x3B9A_CA00)
Definition mdbx.h++:3283
@ minimal_value
Means "minimal acceptable".
Definition mdbx.h++:3279
@ MB
bytes (0x000F_4240)
Definition mdbx.h++:3282
@ GiB
bytes (0x4000_0000)
Definition mdbx.h++:3291
@ maximal_value
Means "maximal acceptable".
Definition mdbx.h++:3280
@ default_value
Means "keep current or use default".
Definition mdbx.h++:3278
@ kB
bytes (0x03E8)
Definition mdbx.h++:3281
@ MiB
bytes (0x0010_0000)
Definition mdbx.h++:3290
@ KiB
bytes (0x0400)
Definition mdbx.h++:3289
constexpr geometry() noexcept
Definition mdbx.h++:3354
constexpr geometry & operator=(const geometry &) noexcept=default
static constexpr geometry dynamic(intptr_t lower=default_value, intptr_t upper=default_value) noexcept
Creates a dynamic-size geometry with the given bounds.
Definition mdbx.h++:3370
intptr_t growth_step
The growth step in bytes, must be greater than zero to allow the database to grow.
Definition mdbx.h++:3327
intptr_t size_now
The size in bytes to setup the database size for now.
Definition mdbx.h++:3312
intptr_t shrink_threshold
The shrink threshold in bytes, must be greater than zero to allow the database to shrink.
Definition mdbx.h++:3330
constexpr bool operator==(const geometry &other) const noexcept
Definition mdbx.h++:3379
intptr_t size_lower
The lower bound of database size in bytes.
Definition mdbx.h++:3307
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++:3358
constexpr bool operator!=(const geometry &other) const noexcept
Definition mdbx.h++:3384
Operate options.
Definition mdbx.h++:3428
bool disable_readahead
Definition mdbx.h++:3437
bool enable_validation
Definition mdbx.h++:3441
bool no_sticky_threads
Definition mdbx.h++:3430
constexpr operate_options() noexcept
Definition mdbx.h++:3442
bool disable_clear_memory
Definition mdbx.h++:3439
constexpr operate_options & operator=(const operate_options &) noexcept=default
bool exclusive
Definition mdbx.h++:3435
constexpr operate_options(const operate_options &) noexcept=default
operate_options(MDBX_env_flags_t) noexcept
constexpr bool operator==(const operate_options &other) const noexcept
Definition mdbx.h++:3463
bool nested_transactions
Enables nested transactions at the cost of disabling MDBX_WRITEMAP and increasing overhead.
Definition mdbx.h++:3433
constexpr bool operator!=(const operate_options &other) const noexcept
Definition mdbx.h++:3468
Operate parameters.
Definition mdbx.h++:3475
env::durability durability
Definition mdbx.h++:3483
static MDBX_NODISCARD env::durability durability_from_flags(MDBX_env_flags_t) noexcept
env::operate_options options
Definition mdbx.h++:3485
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++:3489
constexpr operate_parameters & operator=(const operate_parameters &) noexcept=default
static MDBX_NODISCARD env::mode mode_from_flags(MDBX_env_flags_t) noexcept
unsigned max_readers
The maximum number of threads/reader slots for the environment. Zero means default value.
Definition mdbx.h++:3481
constexpr operate_parameters(const operate_parameters &) noexcept=default
MDBX_NODISCARD MDBX_env_flags_t make_flags(bool accede=true, bool use_subdirectory=false) const
constexpr bool operator==(const operate_parameters &other) const noexcept
Definition mdbx.h++:3559
env::reclaiming_options reclaiming
Definition mdbx.h++:3484
env::mode mode
Definition mdbx.h++:3482
unsigned max_maps
The maximum number of named tables/maps for the environment. Zero means default value.
Definition mdbx.h++:3478
constexpr operate_parameters() noexcept
Definition mdbx.h++:3487
constexpr bool operator!=(const operate_parameters &other) const noexcept
Definition mdbx.h++:3563
Reader information.
Definition mdbx.h++:3980
mdbx_tid_t thread
The reader thread ID.
Definition mdbx.h++:3983
uint64_t transaction_lag
Definition mdbx.h++:3986
size_t bytes_used
Definition mdbx.h++:3990
uint64_t transaction_id
Definition mdbx.h++:3984
int slot
The reader lock table slot number.
Definition mdbx.h++:3981
mdbx_pid_t pid
The reader process ID.
Definition mdbx.h++:3982
size_t bytes_retained
Definition mdbx.h++:3993
Garbage reclaiming options.
Definition mdbx.h++:3405
constexpr reclaiming_options(const reclaiming_options &) noexcept=default
constexpr bool operator!=(const reclaiming_options &other) const noexcept
Definition mdbx.h++:3421
reclaiming_options(MDBX_env_flags_t) noexcept
constexpr bool operator==(const reclaiming_options &other) const noexcept
Definition mdbx.h++:3418
constexpr reclaiming_options & operator=(const reclaiming_options &) noexcept=default
constexpr reclaiming_options() noexcept
Definition mdbx.h++:3408
bool lifo
Definition mdbx.h++:3407
Additional parameters for creating a new database.
Definition mdbx.h++:4240
constexpr bool operator==(const create_parameters &other) const noexcept
Definition mdbx.h++:4257
mdbx_mode_t file_mode_bits
Definition mdbx.h++:4242
constexpr create_parameters() noexcept=default
constexpr bool operator!=(const create_parameters &other) const noexcept
Definition mdbx.h++:4261
bool use_subdirectory
Definition mdbx.h++:4243
env::geometry geometry
Definition mdbx.h++:4241
map_handle::state state
Definition mdbx.h++:3215
info(const info &) noexcept=default
map_handle::flags flags
Definition mdbx.h++:3214
info & operator=(const info &) noexcept=default
size_t operator()(::mdbx::buffer< ALLOCATOR, CAPACITY_POLICY > const &buffer) const noexcept
Definition mdbx.h++:8154
size_t operator()(const ::mdbx::cursor &cursor) const noexcept
Definition mdbx.h++:8150
std::hash< const MDBX_cursor * > inherited
Definition mdbx.h++:8149
size_t operator()(const ::mdbx::env &env) const noexcept
Definition mdbx.h++:8140
std::hash< const MDBX_env * > inherited
Definition mdbx.h++:8139
constexpr size_t operator()(const ::mdbx::map_handle &handle) const noexcept
Definition mdbx.h++:8135
constexpr size_t operator()(const ::mdbx::slice &slice) const noexcept
Definition mdbx.h++:8131
std::hash< const MDBX_txn * > inherited
Definition mdbx.h++:8144
size_t operator()(const ::mdbx::txn &txn) const noexcept
Definition mdbx.h++:8145
capacity_holder capacity_
Definition mdbx.h++:1809
allocator_pointer stub_ptr_
Definition mdbx.h++:1784
constexpr bool is_inplace() const noexcept
Definition mdbx.h++:1821
static constexpr size_t advise_capacity(const size_t current, const size_t wanna)
Definition mdbx.h++:1854
static constexpr bool is_suitable_for_inplace(size_t capacity_bytes) noexcept
Definition mdbx.h++:1813
constexpr bool is_allocated() const noexcept
Definition mdbx.h++:1828
inplace_flag_holder inplace_
Definition mdbx.h++:1810
static constexpr size_t inplace_capacity() noexcept
Definition mdbx.h++:1812
allocator_pointer allocated_ptr_
Definition mdbx.h++:1808
size_t stub_capacity_bytes_
Definition mdbx.h++:1785
constexpr size_t capacity() const noexcept
Definition mdbx.h++:1873
byte pad_[inplace_size - sizeof(allocator_pointer)]
Definition mdbx.h++:1798
size_t bytes_
Definition mdbx.h++:1799
constexpr const byte * address() const noexcept
Definition mdbx.h++:1867
constexpr bin() noexcept
Definition mdbx.h++:1848
@ inplace_size
Definition mdbx.h++:1793
@ inplace_signature_limit
Definition mdbx.h++:1790
@ inplace_size_rounding
Definition mdbx.h++:1792
constexpr byte * address() noexcept
Definition mdbx.h++:1870
constexpr byte * make_allocated(const ::std::pair< allocator_pointer, size_t > &pair) noexcept
Definition mdbx.h++:1839
@ lastbyte_poison
Definition mdbx.h++:1788
@ lastbyte_inplace_signature
Definition mdbx.h++:1788
constexpr bool is_inplace(const void *ptr) const noexcept
Definition mdbx.h++:1863
constexpr byte * make_inplace() noexcept
Definition mdbx.h++:1830