57#if defined(__riscv) || defined(__riscv__) || defined(__RISCV) || defined(__RISCV__)
58#warning "The RISC-V architecture is intentionally insecure by design. \
59 Please delete this admonition at your own risk, \
60 if you make such decision informed and consciously. \
61 Refer to https://clck.ru/32d9xH for more information."
65#pragma warning(push, 1)
66#pragma warning(disable : 4548)
68#pragma warning(disable : 4530)
70#pragma warning(disable : 4577)
163#if !defined(NDEBUG) && !defined(assert)
167#if defined(_WIN32) || defined(_WIN64)
170#ifndef __mode_t_defined
181#include <sys/types.h>
183#define HAVE_STRUCT_IOVEC 1
194#define MDBX_AMALGAMATED_SOURCE 1
203#ifndef __has_attribute
204#define __has_attribute(x) (0)
207#ifndef __has_c_attribute
208#define __has_c_attribute(x) (0)
209#define __has_c_attribute_qualified(x) 0
210#elif !defined(__STDC_VERSION__) || __STDC_VERSION__ < 202311L
211#define __has_c_attribute_qualified(x) 0
212#elif defined(_MSC_VER)
214#define __has_c_attribute_qualified(x) 0
216#define __has_c_attribute_qualified(x) __has_c_attribute(x)
219#ifndef __has_cpp_attribute
220#define __has_cpp_attribute(x) 0
221#define __has_cpp_attribute_qualified(x) 0
222#elif defined(_MSC_VER) || (__clang__ && __clang__ < 14)
224#define __has_cpp_attribute_qualified(x) 0
226#define __has_cpp_attribute_qualified(x) __has_cpp_attribute(x)
229#ifndef __has_C23_or_CXX_attribute
230#if defined(__cplusplus)
231#define __has_C23_or_CXX_attribute(x) __has_cpp_attribute_qualified(x)
233#define __has_C23_or_CXX_attribute(x) __has_c_attribute_qualified(x)
238#define __has_feature(x) (0)
239#define __has_exceptions_disabled (0)
240#elif !defined(__has_exceptions_disabled)
241#define __has_exceptions_disabled (__has_feature(cxx_noexcept) && !__has_feature(cxx_exceptions))
244#ifndef __has_extension
245#define __has_extension(x) __has_feature(x)
249#define __has_builtin(x) (0)
259#define MDBX_PURE_FUNCTION [[gnu::pure]]
260#elif __has_C23_or_CXX_attribute(gnu::pure)
261#define MDBX_PURE_FUNCTION [[gnu::pure]]
262#elif (defined(__GNUC__) || __has_attribute(__pure__)) && \
263 (!defined(__clang__) || !defined(__cplusplus) || \
264 __has_exceptions_disabled)
265#define MDBX_PURE_FUNCTION __attribute__((__pure__))
267#define MDBX_PURE_FUNCTION
274#define MDBX_NOTHROW_PURE_FUNCTION [[gnu::pure, gnu::nothrow]]
275#elif __has_C23_or_CXX_attribute(gnu::pure)
276#if __has_C23_or_CXX_attribute(gnu::nothrow)
277#define MDBX_NOTHROW_PURE_FUNCTION [[gnu::pure, gnu::nothrow]]
279#define MDBX_NOTHROW_PURE_FUNCTION [[gnu::pure]]
281#elif defined(__GNUC__) || (__has_attribute(__pure__) && __has_attribute(__nothrow__))
282#define MDBX_NOTHROW_PURE_FUNCTION __attribute__((__pure__, __nothrow__))
283#elif __has_cpp_attribute(pure)
284#define MDBX_NOTHROW_PURE_FUNCTION [[pure]]
286#define MDBX_NOTHROW_PURE_FUNCTION
300#define MDBX_CONST_FUNCTION [[gnu::const]]
301#elif __has_C23_or_CXX_attribute(gnu::const)
302#define MDBX_CONST_FUNCTION [[gnu::const]]
303#elif (defined(__GNUC__) || __has_attribute(__const__)) && \
304 (!defined(__clang__) || !defined(__cplusplus) || \
305 __has_exceptions_disabled)
306#define MDBX_CONST_FUNCTION __attribute__((__const__))
308#define MDBX_CONST_FUNCTION MDBX_PURE_FUNCTION
315#define MDBX_NOTHROW_CONST_FUNCTION [[gnu::const, gnu::nothrow]]
316#elif __has_C23_or_CXX_attribute(gnu::const)
317#if __has_C23_or_CXX_attribute(gnu::nothrow)
318#define MDBX_NOTHROW_CONST_FUNCTION [[gnu::const, gnu::nothrow]]
320#define MDBX_NOTHROW_CONST_FUNCTION [[gnu::const]]
322#elif defined(__GNUC__) || (__has_attribute(__const__) && __has_attribute(__nothrow__))
323#define MDBX_NOTHROW_CONST_FUNCTION __attribute__((__const__, __nothrow__))
324#elif __has_cpp_attribute_qualified(const)
325#define MDBX_NOTHROW_CONST_FUNCTION [[const]]
327#define MDBX_NOTHROW_CONST_FUNCTION MDBX_NOTHROW_PURE_FUNCTION
333#ifndef MDBX_DEPRECATED
335#define MDBX_DEPRECATED __deprecated
336#elif defined(DOXYGEN) || ((!defined(__GNUC__) || (defined(__clang__) && __clang__ > 19) || __GNUC__ > 5) && \
337 ((defined(__cplusplus) && __cplusplus >= 201403L && __has_cpp_attribute(deprecated) && \
338 __has_cpp_attribute(deprecated) >= 201309L) || \
339 (!defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202304L)))
340#define MDBX_DEPRECATED [[deprecated]]
341#elif (defined(__GNUC__) && __GNUC__ > 5) || \
342 (__has_attribute(__deprecated__) && (!defined(__GNUC__) || defined(__clang__) || __GNUC__ > 5))
343#define MDBX_DEPRECATED __attribute__((__deprecated__))
344#elif defined(_MSC_VER)
345#define MDBX_DEPRECATED __declspec(deprecated)
347#define MDBX_DEPRECATED
351#ifndef MDBX_DEPRECATED_ENUM
352#ifdef __deprecated_enum
353#define MDBX_DEPRECATED_ENUM __deprecated_enum
354#elif defined(DOXYGEN) || \
355 (!defined(_MSC_VER) || (defined(__cplusplus) && __cplusplus >= 201403L && __has_cpp_attribute(deprecated) && \
356 __has_cpp_attribute(deprecated) >= 201309L))
357#define MDBX_DEPRECATED_ENUM MDBX_DEPRECATED
359#define MDBX_DEPRECATED_ENUM
364#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__) || defined(__MINGW__) || defined(__MINGW32__) || \
366#if defined(__GNUC__) || __has_attribute(__dllexport__)
367#define __dll_export __attribute__((__dllexport__))
368#elif defined(_MSC_VER)
369#define __dll_export __declspec(dllexport)
373#elif defined(__GNUC__) || defined(__clang__) || __has_attribute(__visibility__)
374#define __dll_export __attribute__((__visibility__("default")))
381#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__) || defined(__MINGW__) || defined(__MINGW32__) || \
383#if defined(__GNUC__) || __has_attribute(__dllimport__)
384#define __dll_import __attribute__((__dllimport__))
385#elif defined(_MSC_VER)
386#define __dll_import __declspec(dllimport)
399#if defined(LIBMDBX_INTERNALS) && !defined(LIBMDBX_NO_EXPORTS_LEGACY_API)
400#define LIBMDBX_INLINE_API(TYPE, NAME, ARGS) \
401 LIBMDBX_API TYPE NAME ARGS; \
402 static __inline TYPE __inline_##NAME ARGS
404#define LIBMDBX_INLINE_API(TYPE, NAME, ARGS) static __inline TYPE NAME ARGS
408#ifndef MDBX_STRINGIFY
409#define MDBX_STRINGIFY_HELPER(x) #x
410#define MDBX_STRINGIFY(x) MDBX_STRINGIFY_HELPER(x)
429#define MDBX_CXX17_NOEXCEPT noexcept
430#elif !defined(__cpp_noexcept_function_type) || __cpp_noexcept_function_type < 201510L
431#define MDBX_CXX17_NOEXCEPT
433#define MDBX_CXX17_NOEXCEPT noexcept
438#define MDBX_CXX01_CONSTEXPR constexpr
439#define MDBX_CXX01_CONSTEXPR_VAR constexpr
440#elif !defined(__cplusplus)
441#define MDBX_CXX01_CONSTEXPR __inline
442#define MDBX_CXX01_CONSTEXPR_VAR const
443#elif !defined(DOXYGEN) && \
444 ((__cplusplus < 201103L && defined(__cpp_constexpr) && __cpp_constexpr < 200704L) || \
445 (defined(__LCC__) && __LCC__ < 124) || \
446 (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 407) && !defined(__clang__) && !defined(__LCC__)) || \
447 (defined(_MSC_VER) && _MSC_VER < 1910) || (defined(__clang__) && __clang_major__ < 4))
448#define MDBX_CXX01_CONSTEXPR inline
449#define MDBX_CXX01_CONSTEXPR_VAR const
451#define MDBX_CXX01_CONSTEXPR constexpr
452#define MDBX_CXX01_CONSTEXPR_VAR constexpr
458#define MDBX_CXX11_CONSTEXPR constexpr
459#define MDBX_CXX11_CONSTEXPR_VAR constexpr
460#elif !defined(__cplusplus)
461#define MDBX_CXX11_CONSTEXPR __inline
462#define MDBX_CXX11_CONSTEXPR_VAR const
463#elif !defined(DOXYGEN) && \
464 (!defined(__cpp_constexpr) || __cpp_constexpr < 201304L || (defined(__LCC__) && __LCC__ < 124) || \
465 (defined(__GNUC__) && __GNUC__ < 6 && !defined(__clang__) && !defined(__LCC__)) || \
466 (defined(_MSC_VER) && _MSC_VER < 1910) || (defined(__clang__) && __clang_major__ < 5))
467#define MDBX_CXX11_CONSTEXPR inline
468#define MDBX_CXX11_CONSTEXPR_VAR const
470#define MDBX_CXX11_CONSTEXPR constexpr
471#define MDBX_CXX11_CONSTEXPR_VAR constexpr
477#define MDBX_CXX14_CONSTEXPR constexpr
478#define MDBX_CXX14_CONSTEXPR_VAR constexpr
479#elif !defined(__cplusplus)
480#define MDBX_CXX14_CONSTEXPR __inline
481#define MDBX_CXX14_CONSTEXPR_VAR const
482#elif defined(DOXYGEN) || \
483 defined(__cpp_constexpr) && __cpp_constexpr >= 201304L && \
484 ((defined(_MSC_VER) && _MSC_VER >= 1910) || (defined(__clang__) && __clang_major__ > 4) || \
485 (defined(__GNUC__) && __GNUC__ > 6) || (!defined(__GNUC__) && !defined(__clang__) && !defined(_MSC_VER)))
486#define MDBX_CXX14_CONSTEXPR constexpr
487#define MDBX_CXX14_CONSTEXPR_VAR constexpr
489#define MDBX_CXX14_CONSTEXPR inline
490#define MDBX_CXX14_CONSTEXPR_VAR const
493#if defined(__noreturn)
494#define MDBX_NORETURN __noreturn
495#elif defined(_Noreturn)
496#define MDBX_NORETURN _Noreturn
497#elif defined(DOXYGEN) || (defined(__cplusplus) && __cplusplus >= 201103L) || \
498 (!defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ > 202005L)
499#define MDBX_NORETURN [[noreturn]]
500#elif defined(__GNUC__) || __has_attribute(__noreturn__)
501#define MDBX_NORETURN __attribute__((__noreturn__))
502#elif defined(_MSC_VER) && !defined(__clang__)
503#define MDBX_NORETURN __declspec(noreturn)
508#ifndef MDBX_PRINTF_ARGS
509#if defined(__GNUC__) || __has_attribute(__format__) || defined(DOXYGEN)
510#if defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__)
511#define MDBX_PRINTF_ARGS(format_index, first_arg) __attribute__((__format__(__gnu_printf__, format_index, first_arg)))
513#define MDBX_PRINTF_ARGS(format_index, first_arg) __attribute__((__format__(__printf__, format_index, first_arg)))
516#define MDBX_PRINTF_ARGS(format_index, first_arg)
520#if defined(DOXYGEN) || \
521 (defined(__cplusplus) && __cplusplus >= 201603L && __has_cpp_attribute(maybe_unused) && \
522 __has_cpp_attribute(maybe_unused) >= 201603L && (!defined(__clang__) || __clang__ > 19)) || \
523 (!defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ > 202005L)
524#define MDBX_MAYBE_UNUSED [[maybe_unused]]
525#elif defined(__GNUC__) || __has_attribute(__unused__)
526#define MDBX_MAYBE_UNUSED __attribute__((__unused__))
528#define MDBX_MAYBE_UNUSED
531#if __has_attribute(no_sanitize) || defined(DOXYGEN)
532#define MDBX_NOSANITIZE_ENUM __attribute((__no_sanitize__("enum")))
534#define MDBX_NOSANITIZE_ENUM
542#if !defined(DEFINE_ENUM_FLAG_OPERATORS) && !defined(DOXYGEN)
545#if !defined(__cpp_constexpr) || __cpp_constexpr < 200704L || (defined(__LCC__) && __LCC__ < 124) || \
546 (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 407) && !defined(__clang__) && !defined(__LCC__)) || \
547 (defined(_MSC_VER) && _MSC_VER < 1910) || (defined(__clang__) && __clang_major__ < 4)
549#define CONSTEXPR_ENUM_FLAGS_OPERATIONS 0
552#define CONSTEXPR_ENUM_FLAGS_OPERATIONS 1
557#define DEFINE_ENUM_FLAG_OPERATORS(ENUM) \
559 MDBX_NOSANITIZE_ENUM MDBX_CXX01_CONSTEXPR ENUM operator|(ENUM a, ENUM b) { return ENUM(unsigned(a) | unsigned(b)); } \
560 MDBX_NOSANITIZE_ENUM MDBX_CXX14_CONSTEXPR ENUM &operator|=(ENUM &a, ENUM b) { return a = a | b; } \
561 MDBX_NOSANITIZE_ENUM MDBX_CXX01_CONSTEXPR ENUM operator&(ENUM a, ENUM b) { return ENUM(unsigned(a) & unsigned(b)); } \
562 MDBX_NOSANITIZE_ENUM MDBX_CXX01_CONSTEXPR ENUM operator&(ENUM a, unsigned b) { return ENUM(unsigned(a) & b); } \
563 MDBX_NOSANITIZE_ENUM MDBX_CXX01_CONSTEXPR ENUM operator&(unsigned a, ENUM b) { return ENUM(a & unsigned(b)); } \
564 MDBX_NOSANITIZE_ENUM MDBX_CXX14_CONSTEXPR ENUM &operator&=(ENUM &a, ENUM b) { return a = a & b; } \
565 MDBX_NOSANITIZE_ENUM MDBX_CXX14_CONSTEXPR ENUM &operator&=(ENUM &a, unsigned b) { return a = a & b; } \
566 MDBX_CXX01_CONSTEXPR unsigned operator~(ENUM a) { return ~unsigned(a); } \
567 MDBX_NOSANITIZE_ENUM MDBX_CXX01_CONSTEXPR ENUM operator^(ENUM a, ENUM b) { return ENUM(unsigned(a) ^ unsigned(b)); } \
568 MDBX_NOSANITIZE_ENUM MDBX_CXX14_CONSTEXPR ENUM &operator^=(ENUM &a, ENUM b) { return a = a ^ b; } \
572#define DEFINE_ENUM_FLAG_OPERATORS(ENUM)
573#define CONSTEXPR_ENUM_FLAGS_OPERATIONS 1
576#elif !defined(CONSTEXPR_ENUM_FLAGS_OPERATIONS)
580#define CONSTEXPR_ENUM_FLAGS_OPERATIONS 0
583#define CONSTEXPR_ENUM_FLAGS_OPERATIONS 1
600#define MDBX_VERSION_UNSTABLE
601#define MDBX_VERSION_MAJOR 0
602#define MDBX_VERSION_MINOR 14
605#if defined(LIBMDBX_EXPORTS) || defined(DOXYGEN)
606#define LIBMDBX_API __dll_export
607#elif defined(LIBMDBX_IMPORTS)
608#define LIBMDBX_API __dll_import
615#if defined(__clang__) || __has_attribute(type_visibility) || defined(DOXYGEN)
616#define LIBMDBX_API_TYPE LIBMDBX_API __attribute__((type_visibility("default")))
618#define LIBMDBX_API_TYPE LIBMDBX_API
621#define LIBMDBX_API_TYPE
624#if defined(LIBMDBX_IMPORTS)
625#define LIBMDBX_VERINFO_API __dll_import
627#define LIBMDBX_VERINFO_API __dll_export
660#if (defined(_WIN32) || defined(_WIN64)) && !MDBX_BUILD_SHARED_LIBRARY
688#error Non-dll build libmdbx requires target Windows version \
689 to be explicitly defined via _WIN32_WINNT for properly \
690 handling thread local storage destructors.
693#if _WIN32_WINNT >= 0x0600
696#define MDBX_MANUAL_MODULE_HANDLER 0
700#define MDBX_MANUAL_MODULE_HANDLER 1
701void LIBMDBX_API NTAPI mdbx_module_handler(PVOID module, DWORD reason, PVOID reserved);
762#ifndef HAVE_STRUCT_IOVEC
767#define HAVE_STRUCT_IOVEC
770#if defined(__sun) || defined(__SVR4) || defined(__svr4__)
804#if !(defined(_WIN32) || defined(_WIN64))
805#define MDBX_LOCKNAME "/mdbx.lck"
807#define MDBX_LOCKNAME_W L"\\mdbx.lck"
808#define MDBX_LOCKNAME_A "\\mdbx.lck"
810#define MDBX_LOCKNAME MDBX_LOCKNAME_W
812#define MDBX_LOCKNAME MDBX_LOCKNAME_A
819#if !(defined(_WIN32) || defined(_WIN64))
820#define MDBX_DATANAME "/mdbx.dat"
822#define MDBX_DATANAME_W L"\\mdbx.dat"
823#define MDBX_DATANAME_A "\\mdbx.dat"
825#define MDBX_DATANAME MDBX_DATANAME_W
827#define MDBX_DATANAME MDBX_DATANAME_A
832#ifndef MDBX_LOCK_SUFFIX
834#if !(defined(_WIN32) || defined(_WIN64))
835#define MDBX_LOCK_SUFFIX "-lck"
837#define MDBX_LOCK_SUFFIX_W L"-lck"
838#define MDBX_LOCK_SUFFIX_A "-lck"
840#define MDBX_LOCK_SUFFIX MDBX_LOCK_SUFFIX_W
842#define MDBX_LOCK_SUFFIX MDBX_LOCK_SUFFIX_A
858typedef enum MDBX_log_level {
917typedef enum MDBX_debug_flags {
948 MDBX_DBG_MAX = ((unsigned)MDBX_LOG_MAX) << 16 | 127 ,
954DEFINE_ENUM_FLAG_OPERATORS(MDBX_debug_flags)
974#define MDBX_LOGGER_DONTCHANGE ((MDBX_debug_func *)(intptr_t)-1)
975#define MDBX_LOGGER_NOFMT_DONTCHANGE ((MDBX_debug_func_nofmt *)(intptr_t)-1)
1030#if !((defined(_WIN32) || defined(_WIN64)) && !MDBX_WITHOUT_MSVC_CRT)
1040typedef enum MDBX_env_flags {
1495DEFINE_ENUM_FLAG_OPERATORS(MDBX_env_flags)
1501typedef enum MDBX_txn_flags {
1520#if CONSTEXPR_ENUM_FLAGS_OPERATIONS || defined(DOXYGEN)
1596DEFINE_ENUM_FLAG_OPERATORS(MDBX_txn_flags)
1602typedef enum MDBX_db_flags {
1646DEFINE_ENUM_FLAG_OPERATORS(MDBX_db_flags)
1652typedef enum MDBX_put_flags {
1691DEFINE_ENUM_FLAG_OPERATORS(MDBX_put_flags)
1696typedef enum MDBX_copy_flags {
1727DEFINE_ENUM_FLAG_OPERATORS(MDBX_copy_flags)
1860typedef enum MDBX_error {
2011#if defined(_WIN32) || defined(_WIN64)
2025#if defined(ENODATA) || defined(DOXYGEN)
2034#if defined(ENOTSUP) || defined(DOXYGEN)
2043#if defined(EREMOTEIO) || defined(DOXYGEN)
2058#define MDBX_MAP_RESIZED MDBX_MAP_RESIZED_is_deprecated()
2107#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
2140typedef enum MDBX_option {
2540#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
2545#define mdbx_env_openT(env, pathname, flags, mode) mdbx_env_openW(env, pathname, flags, mode)
2547#define mdbx_env_openT(env, pathname, flags, mode) mdbx_env_open(env, pathname, flags, mode)
2553typedef enum MDBX_env_delete_mode {
2589#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
2595#define mdbx_env_deleteT(pathname, mode) mdbx_env_deleteW(pathname, mode)
2597#define mdbx_env_deleteT(pathname, mode) mdbx_env_delete(pathname, mode)
2710#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
2716#define mdbx_env_copyT(env, dest, flags) mdbx_env_copyW(env, dest, flags)
2723#define mdbx_txn_copy2pathnameT(txn, dest, flags) mdbx_txn_copy2pathnameW(txn, dest, path)
2725#define mdbx_env_copyT(env, dest, flags) mdbx_env_copy(env, dest, flags)
2726#define mdbx_txn_copy2pathnameT(txn, dest, flags) mdbx_txn_copy2pathname(txn, dest, path)
3039 assert(proxy <= SIZE_MAX);
3041 *threshold = (size_t)proxy;
3098 if (period_seconds_16dot16) {
3102 assert(proxy <= UINT32_MAX);
3104 *period_seconds_16dot16 = (unsigned)proxy;
3155#if defined(DOXYGEN) || !(defined(_WIN32) || defined(_WIN64))
3239typedef enum MDBX_warmup_flags {
3283DEFINE_ENUM_FLAG_OPERATORS(MDBX_warmup_flags)
3317 unsigned timeout_seconds_16dot16);
3368#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
3374#define mdbx_env_get_pathT(env, dest) mdbx_env_get_pathW(env, dest)
3376#define mdbx_env_get_pathT(env, dest) mdbx_env_get_path(env, dest)
3590 intptr_t growth_step, intptr_t shrink_threshold, intptr_t pagesize);
3717 *readers = (unsigned)proxy;
4237 } pnl_merge_work, pnl_merge_self;
4828 return UINT64_C(0x8000000000000000) + i64;
4832 return UINT32_C(0x80000000) + i32;
4888typedef enum MDBX_dbi_state {
4898DEFINE_ENUM_FLAG_OPERATORS(MDBX_dbi_state)
5074typedef struct MDBX_cache_entry {
5099typedef enum MDBX_cache_status {
5174typedef struct MDBX_cache_result {
5424 void *preserver_context);
6171typedef enum MDBX_bunch_action {
6389 ptrdiff_t *distance_items);
6417 ptrdiff_t *distance_items);
6421#define MDBX_EPSILON ((MDBX_val *)((ptrdiff_t)-1))
6761#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
6768#define mdbx_env_open_for_recoveryT(env, pathname, target_mets, writeable) \
6769 mdbx_env_open_for_recoveryW(env, pathname, target_mets, writeable)
6771#define mdbx_env_open_for_recoveryT(env, pathname, target_mets, writeable) \
6772 mdbx_env_open_for_recovery(env, pathname, target_mets, writeable)
6814#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
6820#define mdbx_preopen_snapinfoT(pathname, info, bytes) mdbx_preopen_snapinfoW(pathname, info, bytes)
6822#define mdbx_preopen_snapinfoT(pathname, info, bytes) mdbx_preopen_snapinfo(pathname, info, bytes)
6829typedef enum MDBX_chk_flags {
6848DEFINE_ENUM_FLAG_OPERATORS(MDBX_chk_flags)
6853typedef enum MDBX_chk_severity {
6872typedef enum MDBX_chk_stage {
6889typedef struct MDBX_chk_line {
6897typedef struct MDBX_chk_issue {
6905typedef struct MDBX_chk_scope {
6915 } usr_z, usr_v, usr_o;
6936typedef struct MDBX_chk_table {
6940#define MDBX_CHK_MAIN ((void *)((ptrdiff_t)0))
6942#define MDBX_CHK_GC ((void *)((ptrdiff_t)-1))
6944#define MDBX_CHK_META ((void *)((ptrdiff_t)-2))
6980typedef struct MDBX_chk_context {
7017typedef struct MDBX_chk_callbacks {
7024 const char *extra_fmt, va_list extra_args);
7074 unsigned timeout_seconds_16dot16);
7084 size_t buffer_size);
#define MDBX_NOTHROW_CONST_FUNCTION
The 'const nothrow' function attribute for optimization.
Definition mdbx.h:315
#define MDBX_CXX17_NOEXCEPT
Definition mdbx.h:429
#define MDBX_NOTHROW_PURE_FUNCTION
The 'pure nothrow' function attribute for optimization.
Definition mdbx.h:274
#define MDBX_NORETURN
Definition mdbx.h:499
uint64_t mi_mapsize
Definition mdbx.h:2837
uint32_t wipes
The number of previous reliable/stable committed points erased when working in MDBX_UTTERLY_NOSYNC mo...
uint64_t txn_space_dirty
Definition mdbx.h:4103
struct MDBX_envinfo::@012005163333303136244023145022271211024347140371 mi_geo
uint32_t gc_cputime
User-mode CPU time spent on GC update.
Definition mdbx.h:4178
uint32_t mi_dxb_pagesize
Definition mdbx.h:2847
uint32_t mi_maxreaders
Definition mdbx.h:2845
MDBX_error_t errcode
Definition mdbx.h:5176
uint64_t v
Definition mdbx.h:4558
uint32_t coalescences
The number of iterations of merging GC items.
uint32_t mi_numreaders
Definition mdbx.h:2846
uint16_t patch
Definition mdbx.h:634
const char * metadata
Definition mdbx.h:655
uint32_t mi_since_sync_seconds16dot16
Definition mdbx.h:2873
uint32_t length
Definition mdbx.h:5081
uint32_t self_xpages
The number of page sequences allocation requests for the GC itself.
uint16_t major
Definition mdbx.h:632
uint64_t txn_reader_lag
Definition mdbx.h:4070
uint64_t mi_meta_txnid[3]
Definition mdbx.h:2844
MDBX_cache_status_t status
Definition mdbx.h:5178
uint64_t txn_space_leftover
Definition mdbx.h:4096
struct MDBX_envinfo::@366225332126364017271247035205240304242123014254 mi_pgop_stat
uint64_t txn_space_used
Definition mdbx.h:4074
const char * datetime
Definition mdbx.h:650
uint64_t mi_recent_txnid
Definition mdbx.h:2841
uint64_t mi_autosync_threshold
Definition mdbx.h:2869
const char * semver_prerelease
Definition mdbx.h:636
uint32_t wloops
The number of GC update iterations is greater than 1 if there were repeats/restarts.
uint64_t ms_branch_pages
Definition mdbx.h:2787
uint64_t ms_entries
Definition mdbx.h:2790
uint32_t gc_wallclock
Duration of GC update by wall clock.
Definition mdbx.h:4164
uint16_t minor
Definition mdbx.h:633
size_t offset
Definition mdbx.h:5079
uint32_t mi_since_reader_check_seconds16dot16
Definition mdbx.h:2879
uint64_t y
Definition mdbx.h:4558
uint64_t last_confirmed_txnid
Definition mdbx.h:5077
struct MDBX_envinfo::@041066021046127331076001156004251200350305323267 mi_dxbid
uint32_t sync
Duration of syncing written data to the disk/storage, i.e. the duration of a fdatasync() or a msync()...
Definition mdbx.h:4172
uint32_t mi_sys_ioblk
Definition mdbx.h:2850
uint64_t txn_space_limit_soft
Definition mdbx.h:4077
uint32_t mi_mode
Definition mdbx.h:2882
const char * options
Definition mdbx.h:652
uint64_t txn_id
Definition mdbx.h:4064
const char * sourcery
Definition mdbx.h:643
uint64_t mi_latter_reader_txnid
Definition mdbx.h:2842
uint64_t ms_overflow_pages
Definition mdbx.h:2789
uint32_t self_rsteps
The number of search iterations inside the GC when allocating pages for the purposes of maintaining a...
struct MDBX_envinfo::@036110245144360117333346206230046231375034327042 mi_bootid
A mostly unique ID that is regenerated on each boot.
uint32_t self_majflt
The number of page faults within the GC when allocating and preparing pages for the GC itself.
uint32_t work_majflt
The number of page faults inside the GC when allocating and preparing pages for user's data.
uint32_t preparation
Duration of preparation (commit child transactions, update table's records and cursors destroying).
Definition mdbx.h:4162
uint32_t mi_sys_upcblk
Definition mdbx.h:2849
uint64_t z
Definition mdbx.h:4558
uint64_t txn_space_limit_hard
Definition mdbx.h:4081
uint32_t whole
The total duration of a commit.
Definition mdbx.h:4176
uint32_t flushes
The number of forced commits to disk to avoid the database growth when working outside of MDBX_UTTERL...
uint32_t work_xpages
The number of requests to allocate page sequences for the sake of user's data.
const char * flags
Definition mdbx.h:654
uint32_t self_counter
The GC's slow path execution count is for the purposes of maintaining and updating the GC itself.
uint32_t self_rtime_monotonic
The time "by the wall clock" spent reading and searching inside the GC for the purposes of maintainin...
struct MDBX_commit_latency::@063112077126007214166021162020057361221355030117 gc_prof
Information for GC profiling.
uint64_t mi_meta_sign[3]
Definition mdbx.h:2844
uint32_t ms_psize
Definition mdbx.h:2784
uint32_t kicks
The number of accesses to the Handle-Slow-Readers mechanism to avoid void the database growth.
uint32_t audit
Duration of internal audit if enabled.
Definition mdbx.h:4166
uint16_t tweak
Definition mdbx.h:635
const char * target
Definition mdbx.h:651
uint32_t write
Duration of writing dirty/modified data pages to a filesystem, i.e. the summary duration of a write()...
Definition mdbx.h:4169
uint64_t txn_space_retired
Definition mdbx.h:4089
uint32_t ms_depth
Definition mdbx.h:2786
uint64_t mi_dxb_fallocated
Definition mdbx.h:2839
uint64_t mi_last_pgno
Definition mdbx.h:2840
uint32_t work_counter
Number of slow/deep path GC search for the sake of placement user's data.
uint32_t self_xtime_cpu
The CPU time in user mode spent preparing pages taken from the GC for the purposes of maintaining and...
uint32_t ending
Duration of transaction ending (releasing resources).
Definition mdbx.h:4174
uint64_t ms_mod_txnid
Definition mdbx.h:2791
uint32_t work_rsteps
The number of search iterations inside GC when allocating pages for the sake of user's data.
uint64_t trunk_txnid
Definition mdbx.h:5075
uint64_t mi_self_latter_reader_txnid
Definition mdbx.h:2843
uint64_t ms_leaf_pages
Definition mdbx.h:2788
uint64_t mi_dxb_fsize
Definition mdbx.h:2838
uint64_t x
Definition mdbx.h:4558
uint32_t mi_autosync_period_seconds16dot16
Definition mdbx.h:2876
uint64_t mi_unsync_volume
Definition mdbx.h:2867
uint32_t mi_sys_pagesize
Definition mdbx.h:2848
struct MDBX_version_info::@246336125106374236367351214106016351032060025144 git
uint32_t work_rtime_monotonic
The time "by the wall clock" spent reading and searching inside the GC for the user's data.
uint32_t work_xtime_cpu
The CPU time in user mode spent for preparing pages taken from the GC for user data,...
const char * compiler
Definition mdbx.h:653
LIBMDBX_API MDBX_hsr_func * mdbx_env_get_hsr(const MDBX_env *env)
Gets current Handle-Slow-Readers callback used to resolve database full/overflow issue due to a reade...
MDBX_constants
Definition mdbx.h:784
mode_t mdbx_mode_t
Definition mdbx.h:187
#define LIBMDBX_API
Definition mdbx.h:606
struct iovec MDBX_val
Generic structure used for passing keys and data in and out of the table. .
Definition mdbx.h:781
LIBMDBX_VERINFO_API const struct MDBX_version_info mdbx_version
libmdbx version information
pthread_t mdbx_tid_t
Definition mdbx.h:186
LIBMDBX_VERINFO_API const struct MDBX_build_info mdbx_build
libmdbx build information
struct MDBX_env MDBX_env
Opaque structure for a database environment.
Definition mdbx.h:713
int mdbx_filehandle_t
Definition mdbx.h:184
LIBMDBX_API const char * mdbx_liberr2str(int errnum)
pid_t mdbx_pid_t
Definition mdbx.h:185
LIBMDBX_API int mdbx_env_openW(MDBX_env *env, const wchar_t *pathname, MDBX_env_flags_t flags, mdbx_mode_t mode)
Open an environment instance.
#define LIBMDBX_VERINFO_API
Definition mdbx.h:627
@ MDBX_MAX_PAGESIZE
Definition mdbx.h:795
@ MDBX_MAXDATASIZE
Definition mdbx.h:789
@ MDBX_MAX_DBI
Definition mdbx.h:786
@ MDBX_MIN_PAGESIZE
Definition mdbx.h:792
libmdbx build information
Definition mdbx.h:649
Lightweight transparent cache entry structure used by mdbx_cache_get().
Definition mdbx.h:5074
Pair of error code and cache status as a result of mdbx_cache_get().
Definition mdbx.h:5174
The fours integers markers (aka "canary") associated with the environment.
Definition mdbx.h:4557
Latency of commit stages in 1/65536 of seconds units.
Definition mdbx.h:4159
Information about the environment.
Definition mdbx.h:2829
Statistics for a table in the environment.
Definition mdbx.h:2783
Information about the transaction.
Definition mdbx.h:4061
libmdbx version information,
Definition mdbx.h:631
MDBX_bunch_action_t
Modes for deleting bunches of neighboring items with self-documenting names.
Definition mdbx.h:6171
LIBMDBX_API int mdbx_cursor_del(MDBX_cursor *cursor, MDBX_put_flags_t flags)
Delete current key/data pair.
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:5367
LIBMDBX_API int mdbx_dbi_sequence(MDBX_txn *txn, MDBX_dbi dbi, uint64_t *result, uint64_t increment)
Sequence generation for a table.
LIBMDBX_API int mdbx_get_equal_or_great(const MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key, MDBX_val *data)
Get equal or great item from a table.
LIBMDBX_API int mdbx_cursor_scan(MDBX_cursor *cursor, MDBX_predicate_func *predicate, void *context, MDBX_cursor_op start_op, MDBX_cursor_op turn_op, void *arg)
Сканирует таблицу с использованием передаваемого предиката, с уменьшением сопутствующих накладных рас...
LIBMDBX_API int mdbx_canary_put(MDBX_txn *txn, const MDBX_canary *canary)
Set integers markers (aka "canary") associated with the environment.
LIBMDBX_API int mdbx_canary_get(const MDBX_txn *txn, MDBX_canary *canary)
Returns fours integers markers (aka "canary") associated with the environment.
MDBX_put_flags_t
Data changing flags.
Definition mdbx.h:1652
LIBMDBX_API MDBX_cache_result_t mdbx_cache_get(const MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *key, MDBX_val *data, volatile MDBX_cache_entry_t *entry)
Gets items from a table using cache including multithreaded cases.
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.
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:5099
LIBMDBX_API MDBX_cache_result_t mdbx_cache_get_SingleThreaded(const MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *key, MDBX_val *data, MDBX_cache_entry_t *entry)
Gets items from a table using cache within single-thread cases only.
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)
LIBMDBX_API int mdbx_cmp(const MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *a, const MDBX_val *b)
Compare two keys according to a particular table.
void mdbx_cache_init(MDBX_cache_entry_t *entry)
Initializes the cache entry before the first use.
Definition mdbx.h:5088
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:4617
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_replace(MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *key, MDBX_val *new_data, MDBX_val *old_data, MDBX_put_flags_t flags)
Replaces item in 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.
int MDBX_predicate_func(void *context, MDBX_val *key, MDBX_val *value, void *arg) noexcept
Тип предикативных функций обратного вызова используемых mdbx_cursor_scan() и mdbx_cursor_scan_from() ...
Definition mdbx.h:5845
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_dcmp(const MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *a, const MDBX_val *b)
Compare two data items according to a particular 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:6180
@ MDBX_DELETE_BEFORE_INCLUDING
Definition mdbx.h:6179
@ MDBX_DELETE_WHOLE
Definition mdbx.h:6182
@ MDBX_DELETE_BEFORE_EXCLUDING
Definition mdbx.h:6178
@ MDBX_DELETE_CURRENT_VALUE
Definition mdbx.h:6172
@ MDBX_DELETE_CURRENT_MULTIVAL_BEFORE_EXCLUDING
Definition mdbx.h:6173
@ MDBX_DELETE_AFTER_EXCLUDING
Definition mdbx.h:6181
@ MDBX_DELETE_CURRENT_MULTIVAL_ALL
Definition mdbx.h:6177
@ MDBX_DELETE_CURRENT_MULTIVAL_BEFORE_INCLUDING
Definition mdbx.h:6174
@ MDBX_DELETE_CURRENT_MULTIVAL_AFTER_INCLUDING
Definition mdbx.h:6175
@ MDBX_DELETE_CURRENT_MULTIVAL_AFTER_EXCLUDING
Definition mdbx.h:6176
@ MDBX_MULTIPLE
Definition mdbx.h:1689
@ MDBX_ALLDUPS
Definition mdbx.h:1672
@ MDBX_CURRENT
Definition mdbx.h:1667
@ MDBX_APPENDDUP
Definition mdbx.h:1685
@ MDBX_NODUPDATA
Definition mdbx.h:1661
@ MDBX_APPEND
Definition mdbx.h:1680
@ MDBX_UPSERT
Definition mdbx.h:1654
@ MDBX_RESERVE
Definition mdbx.h:1676
@ MDBX_NOOVERWRITE
Definition mdbx.h:1657
@ MDBX_CACHE_DIRTY
The result of getting a value is correct, but it cannot be cached since the changes have not been com...
Definition mdbx.h:5141
@ MDBX_CACHE_UNABLE
The result of getting a value is correct, but it cannot be cached since there the ABA-like issue is i...
Definition mdbx.h:5123
@ MDBX_CACHE_HIT
The result of getting a value is correct and was retrieved from the cache entry which is untouched.
Definition mdbx.h:5149
@ MDBX_CACHE_CONFIRMED
The result of getting a value is correct and has been retrieved from the cache, which has been altere...
Definition mdbx.h:5157
@ MDBX_CACHE_ERROR
The error other than MDBX_NOTFOUND has occurred.
Definition mdbx.h:5104
@ MDBX_CACHE_RACE
The result was obtained by bypassing the cache, because the given cache entry being updated by anothe...
Definition mdbx.h:5132
@ MDBX_CACHE_BEHIND
The result was obtained by bypassing the cache, because the transaction is too old to using the cache...
Definition mdbx.h:5112
@ MDBX_CACHE_REFRESHED
The result of getting a value is correct and corresponds to the fresh data readed from the database,...
Definition mdbx.h:5167
LIBMDBX_API int mdbx_cursor_on_first_dup(const MDBX_cursor *cursor)
Определяет стоит ли курсор на первом или единственном мульти-значении соответствующем ключу.
LIBMDBX_API int mdbx_cursor_open(MDBX_txn *txn, MDBX_dbi dbi, MDBX_cursor **cursor)
Create a cursor handle for the specified transaction and DBI handle.
int mdbx_txn_release_all_cursors(const MDBX_txn *txn, bool unbind)
Unbind or closes all cursors of a given transaction and of all its parent transactions if ones are.
Definition mdbx.h:5691
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:1733
LIBMDBX_API int mdbx_cursor_compare(const MDBX_cursor *left, const MDBX_cursor *right, bool ignore_multival)
Сравнивает позицию курсоров.
LIBMDBX_API int mdbx_cursor_on_last_dup(const MDBX_cursor *cursor)
Определяет стоит ли курсор на последнем или единственном мульти-значении соответствующем ключу.
LIBMDBX_API int mdbx_cursor_on_first(const MDBX_cursor *cursor)
Determines whether the cursor is pointed to the first key-value pair or not.
LIBMDBX_API int mdbx_cursor_bind(MDBX_txn *txn, MDBX_cursor *cursor, MDBX_dbi dbi)
Bind cursor to specified transaction and DBI-handle.
LIBMDBX_API int mdbx_cursor_reset(MDBX_cursor *cursor)
Сбрасывает состояние курсора.
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:743
LIBMDBX_API int mdbx_cursor_set_userctx(MDBX_cursor *cursor, void *ctx)
Set application information associated with the cursor.
LIBMDBX_API int mdbx_cursor_eof(const MDBX_cursor *cursor)
Determines whether the cursor is pointed to a key-value pair or not, i.e. was not positioned or point...
LIBMDBX_API int mdbx_cursor_close2(MDBX_cursor *cursor)
Closes a cursor handle with returning error code.
LIBMDBX_API void * mdbx_cursor_get_userctx(const MDBX_cursor *cursor)
Get the application information associated with the MDBX_cursor.
LIBMDBX_API int mdbx_cursor_renew(MDBX_txn *txn, MDBX_cursor *cursor)
Renew a cursor handle for use within the given transaction.
LIBMDBX_API void mdbx_cursor_close(MDBX_cursor *cursor)
Closes a cursor handle without returning error code.
LIBMDBX_API MDBX_txn * mdbx_cursor_txn(const MDBX_cursor *cursor)
Return the cursor's transaction handle.
LIBMDBX_API int mdbx_cursor_on_last(const MDBX_cursor *cursor)
Determines whether the cursor is pointed to the last key-value pair or not.
LIBMDBX_API int mdbx_cursor_copy(const MDBX_cursor *src, MDBX_cursor *dest)
Copy cursor position and state.
@ MDBX_SET_LOWERBOUND
Definition mdbx.h:1810
@ MDBX_SEEK_AND_GET_MULTIPLE
Definition mdbx.h:1852
@ MDBX_GET_CURRENT
Definition mdbx.h:1748
@ MDBX_GET_BOTH
Definition mdbx.h:1741
@ MDBX_TO_KEY_EQUAL
Definition mdbx.h:1829
@ MDBX_GET_BOTH_RANGE
Definition mdbx.h:1745
@ MDBX_SET_KEY
Definition mdbx.h:1788
@ MDBX_FIRST_DUP
Definition mdbx.h:1738
@ MDBX_TO_KEY_LESSER_OR_EQUAL
Definition mdbx.h:1828
@ MDBX_GET_MULTIPLE
Definition mdbx.h:1753
@ MDBX_TO_EXACT_KEY_VALUE_GREATER_THAN
Definition mdbx.h:1839
@ MDBX_NEXT_NODUP
Definition mdbx.h:1773
@ MDBX_TO_EXACT_KEY_VALUE_LESSER_OR_EQUAL
Definition mdbx.h:1836
@ MDBX_TO_EXACT_KEY_VALUE_EQUAL
Definition mdbx.h:1837
@ MDBX_TO_PAIR_LESSER_OR_EQUAL
Definition mdbx.h:1844
@ MDBX_PREV_MULTIPLE
Definition mdbx.h:1796
@ MDBX_SET_RANGE
Definition mdbx.h:1791
@ MDBX_LAST_DUP
Definition mdbx.h:1759
@ MDBX_PREV
Definition mdbx.h:1776
@ MDBX_TO_PAIR_GREATER_OR_EQUAL
Definition mdbx.h:1846
@ MDBX_TO_PAIR_GREATER_THAN
Definition mdbx.h:1847
@ MDBX_LAST
Definition mdbx.h:1756
@ MDBX_TO_KEY_LESSER_THAN
Definition mdbx.h:1827
@ MDBX_PREV_DUP
Definition mdbx.h:1779
@ MDBX_TO_EXACT_KEY_VALUE_LESSER_THAN
Definition mdbx.h:1835
@ MDBX_SET
Definition mdbx.h:1785
@ MDBX_NEXT
Definition mdbx.h:1762
@ MDBX_TO_KEY_GREATER_OR_EQUAL
Definition mdbx.h:1830
@ MDBX_TO_PAIR_LESSER_THAN
Definition mdbx.h:1843
@ MDBX_NEXT_MULTIPLE
Definition mdbx.h:1770
@ MDBX_PREV_NODUP
Definition mdbx.h:1782
@ MDBX_TO_PAIR_EQUAL
Definition mdbx.h:1845
@ MDBX_NEXT_DUP
Definition mdbx.h:1765
@ MDBX_TO_EXACT_KEY_VALUE_GREATER_OR_EQUAL
Definition mdbx.h:1838
@ MDBX_SET_UPPERBOUND
Definition mdbx.h:1824
@ MDBX_TO_KEY_GREATER_THAN
Definition mdbx.h:1831
@ MDBX_FIRST
Definition mdbx.h:1735
LIBMDBX_API int mdbx_dbi_open_ex2(MDBX_txn *txn, const MDBX_val *name, MDBX_db_flags_t flags, MDBX_dbi *dbi, MDBX_cmp_func *keycmp, MDBX_cmp_func *datacmp)
Open or Create a named table in the environment with using custom comparison functions.
LIBMDBX_API int mdbx_dbi_open_ex(MDBX_txn *txn, const char *name, MDBX_db_flags_t flags, MDBX_dbi *dbi, MDBX_cmp_func *keycmp, MDBX_cmp_func *datacmp)
Open or Create a named table in the environment with using custom comparison functions.
LIBMDBX_API int mdbx_dbi_rename(MDBX_txn *txn, MDBX_dbi dbi, const char *name)
Переименовает таблицу по DBI-дескриптору
LIBMDBX_API int mdbx_dbi_rename2(MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *name)
Переименовает таблицу по DBI-дескриптору
LIBMDBX_API int mdbx_dbi_close(MDBX_env *env, MDBX_dbi dbi)
Close a table handle. Normally unnecessary.
LIBMDBX_API int mdbx_dbi_open(MDBX_txn *txn, const char *name, MDBX_db_flags_t flags, MDBX_dbi *dbi)
Open or Create a named table in the environment.
LIBMDBX_API int mdbx_dbi_open2(MDBX_txn *txn, const MDBX_val *name, MDBX_db_flags_t flags, MDBX_dbi *dbi)
Open or Create a named table in the environment.
uint32_t MDBX_dbi
A handle for an individual table (key-value spaces) in the environment.
Definition mdbx.h:736
MDBX_db_flags_t
Table flags.
Definition mdbx.h:1602
@ MDBX_INTEGERDUP
Definition mdbx.h:1626
@ MDBX_DB_ACCEDE
Definition mdbx.h:1644
@ MDBX_DB_DEFAULTS
Definition mdbx.h:1604
@ MDBX_REVERSEKEY
Definition mdbx.h:1607
@ MDBX_DUPFIXED
Definition mdbx.h:1621
@ MDBX_INTEGERKEY
Definition mdbx.h:1617
@ MDBX_REVERSEDUP
Definition mdbx.h:1629
@ MDBX_CREATE
Definition mdbx.h:1632
@ MDBX_DUPSORT
Definition mdbx.h:1610
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.
MDBX_NORETURN LIBMDBX_API void mdbx_panic(const char *fmt,...) MDBX_PRINTF_ARGS(1
Panics with message and causes abnormal process termination.
void MDBX_debug_func_nofmt(MDBX_log_level_t loglevel, const char *function, int line, const char *msg, unsigned length) noexcept
Definition mdbx.h:984
void MDBX_assert_func(const MDBX_env *env, const char *msg, const char *function, unsigned line) noexcept
A callback function for most MDBX assert() failures, called before printing the message and aborting.
Definition mdbx.h:1000
MDBX_log_level_t
Definition mdbx.h:858
MDBX_debug_flags_t
Runtime debug flags.
Definition mdbx.h:917
LIBMDBX_API int mdbx_env_set_assert(MDBX_env *env, MDBX_assert_func *func)
Set or reset the assert() callback of the environment.
MDBX_NORETURN LIBMDBX_API void MDBX_NORETURN LIBMDBX_API void mdbx_assert_fail(const MDBX_env *env, const char *msg, const char *func, unsigned line)
Panics with asserton failed message and causes abnormal process termination.
void MDBX_debug_func(MDBX_log_level_t loglevel, const char *function, int line, const char *fmt, va_list args) noexcept
A debug-logger callback function, called before printing the message and aborting.
Definition mdbx.h:970
LIBMDBX_API int mdbx_setup_debug(MDBX_log_level_t log_level, MDBX_debug_flags_t debug_flags, MDBX_debug_func *logger)
Setup global log-level, debug options and debug logger.
LIBMDBX_API int mdbx_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)
@ MDBX_LOG_EXTRA
Definition mdbx.h:900
@ MDBX_LOG_WARN
Definition mdbx.h:874
@ MDBX_LOG_TRACE
Definition mdbx.h:895
@ MDBX_LOG_DEBUG
Definition mdbx.h:890
@ MDBX_LOG_FATAL
Definition mdbx.h:862
@ MDBX_LOG_ERROR
Definition mdbx.h:868
@ MDBX_LOG_NOTICE
Definition mdbx.h:880
@ MDBX_LOG_DONTCHANGE
Definition mdbx.h:907
@ MDBX_LOG_VERBOSE
Definition mdbx.h:885
@ MDBX_DBG_ASSERT
Definition mdbx.h:923
@ MDBX_DBG_DONT_UPGRADE
Definition mdbx.h:945
@ MDBX_DBG_LEGACY_OVERLAP
Definition mdbx.h:941
@ MDBX_DBG_LEGACY_MULTIOPEN
Definition mdbx.h:938
@ MDBX_DBG_NONE
Definition mdbx.h:918
@ MDBX_DBG_DUMP
Definition mdbx.h:935
@ MDBX_DBG_DONTCHANGE
Definition mdbx.h:952
@ MDBX_DBG_AUDIT
Definition mdbx.h:927
@ MDBX_DBG_JITTER
Definition mdbx.h:931
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 ...
LIBMDBX_API const char * mdbx_strerror(int errnum)
Return a string describing a given error code.
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:6697
LIBMDBX_API const char * mdbx_strerror_ANSI2OEM(int errnum)
MDBX_error_t
Errors and return codes.
Definition mdbx.h:1860
LIBMDBX_API const char * mdbx_strerror_r(int errnum, char *buf, size_t buflen)
Return a string describing a given error code.
LIBMDBX_API const char * mdbx_strerror_r_ANSI2OEM(int errnum, char *buf, size_t buflen)
@ MDBX_PANIC
Definition mdbx.h:1887
@ MDBX_FIRST_LMDB_ERRCODE
Definition mdbx.h:1874
@ MDBX_EKEYMISMATCH
Definition mdbx.h:1975
@ MDBX_UNABLE_EXTEND_MAPSIZE
Definition mdbx.h:1921
@ MDBX_EACCESS
Definition mdbx.h:2031
@ MDBX_EIO
Definition mdbx.h:2039
@ MDBX_PAGE_NOTFOUND
Definition mdbx.h:1880
@ MDBX_TXN_FULL
Definition mdbx.h:1905
@ MDBX_DUPLICATED_CLK
Definition mdbx.h:1995
@ MDBX_VERSION_MISMATCH
Definition mdbx.h:1890
@ MDBX_WANNA_RECOVERY
Definition mdbx.h:1972
@ MDBX_TXN_OVERLAPPING
Definition mdbx.h:1986
@ MDBX_EREMOTE
Definition mdbx.h:2045
@ MDBX_TOO_LARGE
Definition mdbx.h:1979
@ MDBX_EBADSIGN
Definition mdbx.h:1968
@ MDBX_CURSOR_FULL
Definition mdbx.h:1909
@ MDBX_ENOFILE
Definition mdbx.h:2042
@ MDBX_BAD_TXN
Definition mdbx.h:1939
@ MDBX_ENODATA
Definition mdbx.h:2026
@ MDBX_LAST_LMDB_ERRCODE
Definition mdbx.h:1953
@ MDBX_CORRUPTED
Definition mdbx.h:1883
@ MDBX_EPERM
Definition mdbx.h:2040
@ MDBX_THREAD_MISMATCH
Definition mdbx.h:1983
@ MDBX_BACKLOG_DEPLETED
Definition mdbx.h:1992
@ MDBX_SUCCESS
Definition mdbx.h:1862
@ MDBX_NOTFOUND
Definition mdbx.h:1877
@ MDBX_RESULT_TRUE
Definition mdbx.h:1868
@ MDBX_INVALID
Definition mdbx.h:1893
@ MDBX_BAD_VALSIZE
Definition mdbx.h:1943
@ MDBX_BUSY
Definition mdbx.h:1957
@ MDBX_OUSTED
Definition mdbx.h:2003
@ MDBX_DBS_FULL
Definition mdbx.h:1899
@ MDBX_EINVAL
Definition mdbx.h:2030
@ MDBX_BAD_RSLOT
Definition mdbx.h:1934
@ MDBX_ENOMEM
Definition mdbx.h:2032
@ MDBX_FIRST_ADDED_ERRCODE
Definition mdbx.h:1960
@ MDBX_RESULT_FALSE
Definition mdbx.h:1865
@ MDBX_EINTR
Definition mdbx.h:2041
@ MDBX_READERS_FULL
Definition mdbx.h:1902
@ MDBX_LAST_ADDED_ERRCODE
Definition mdbx.h:2009
@ MDBX_BAD_DBI
Definition mdbx.h:1947
@ MDBX_KEYEXIST
Definition mdbx.h:1871
@ MDBX_DANGLING_DBI
Definition mdbx.h:1999
@ MDBX_EDEADLK
Definition mdbx.h:2049
@ MDBX_PAGE_FULL
Definition mdbx.h:1912
@ MDBX_MAP_FULL
Definition mdbx.h:1896
@ MDBX_PROBLEM
Definition mdbx.h:1950
@ MDBX_ENOSYS
Definition mdbx.h:2035
@ MDBX_EMULTIVAL
Definition mdbx.h:1963
@ MDBX_EROFS
Definition mdbx.h:2033
@ MDBX_MVCC_RETARDED
Definition mdbx.h:2006
@ MDBX_INCOMPATIBLE
Definition mdbx.h:1931
LIBMDBX_API int mdbx_env_create(MDBX_env **penv)
Create an MDBX environment instance.
int mdbx_env_close(MDBX_env *env)
The shortcut to calling mdbx_env_close_ex() with the dont_sync=false argument.
Definition mdbx.h:3153
MDBX_env_flags_t
Environment flags.
Definition mdbx.h:1040
LIBMDBX_API int mdbx_env_close_ex(MDBX_env *env, bool dont_sync)
Close the environment and release the memory map.
LIBMDBX_API int mdbx_preopen_snapinfoW(const wchar_t *pathname, MDBX_envinfo *info, size_t bytes)
Получает базовую информацию о БД не открывая её.
LIBMDBX_API int mdbx_env_open(MDBX_env *env, const char *pathname, MDBX_env_flags_t flags, mdbx_mode_t mode)
Open an environment instance.
LIBMDBX_API int mdbx_preopen_snapinfo(const char *pathname, MDBX_envinfo *info, size_t bytes)
Получает базовую информацию о БД не открывая её.
@ MDBX_NORDAHEAD
Definition mdbx.h:1255
@ MDBX_ENV_DEFAULTS
Definition mdbx.h:1041
@ MDBX_COALESCE
Definition mdbx.h:1291
@ MDBX_NOMETASYNC
Definition mdbx.h:1390
@ MDBX_LIFORECLAIM
Definition mdbx.h:1315
@ MDBX_SAFE_NOSYNC
Definition mdbx.h:1441
@ MDBX_NOTLS
Definition mdbx.h:1234
@ MDBX_SYNC_DURABLE
Definition mdbx.h:1372
@ MDBX_PAGEPERTURB
Definition mdbx.h:1318
@ MDBX_WRITEMAP
Definition mdbx.h:1160
@ MDBX_NOSTICKYTHREADS
Definition mdbx.h:1231
@ MDBX_EXCLUSIVE
Definition mdbx.h:1114
@ MDBX_NOMEMINIT
Definition mdbx.h:1278
@ MDBX_MAPASYNC
Definition mdbx.h:1448
@ MDBX_ACCEDE
Definition mdbx.h:1129
@ MDBX_NOSUBDIR
Definition mdbx.h:1066
@ MDBX_RDONLY
Definition mdbx.h:1084
@ MDBX_UTTERLY_NOSYNC
Definition mdbx.h:1491
@ MDBX_VALIDATION
Definition mdbx.h:1048
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.
int mdbx_env_set_mapsize(MDBX_env *env, size_t size)
Definition mdbx.h:3594
int mdbx_env_set_maxdbs(MDBX_env *env, MDBX_dbi dbs)
Set the maximum number of named tables for the environment.
Definition mdbx.h:3743
LIBMDBX_API int mdbx_env_warmup(const MDBX_env *env, const MDBX_txn *txn, MDBX_warmup_flags_t flags, unsigned timeout_seconds_16dot16)
Warms up the database by loading pages into memory, optionally lock ones.
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:3076
MDBX_option_t
MDBX environment extra runtime options.
Definition mdbx.h:2140
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:3015
MDBX_warmup_flags_t
Warming up options.
Definition mdbx.h:3239
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.
int mdbx_env_set_maxreaders(MDBX_env *env, unsigned readers)
Set the maximum number of threads/reader slots for for all processes interacts with the database.
Definition mdbx.h:3697
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:2245
@ MDBX_opt_subpage_room_threshold
Задаёт в % минимальный объём свободного места на основной странице, при отсутствии которого вложенные...
Definition mdbx.h:2418
@ MDBX_opt_subpage_limit
Задаёт в % максимальный размер вложенных страниц, используемых для размещения небольшого количества м...
Definition mdbx.h:2412
@ MDBX_opt_txn_dp_limit
Controls the in-process limit of dirty pages for a write transaction.
Definition mdbx.h:2241
@ MDBX_opt_prefer_waf_insteadof_balance
Управляет выбором между стремлением к равномерности наполнения страниц, либо уменьшением количества и...
Definition mdbx.h:2397
@ 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:2345
@ MDBX_opt_max_db
Controls the maximum number of named tables for the environment.
Definition mdbx.h:2149
@ MDBX_opt_merge_threshold_16dot16_percent
Controls the in-process threshold of semi-empty pages merge.
Definition mdbx.h:2312
@ MDBX_opt_subpage_reserve_prereq
Задаёт в % минимальный объём свободного места на основной странице, при наличии которого,...
Definition mdbx.h:2434
@ MDBX_opt_sync_bytes
Controls interprocess/shared threshold to force flush the data buffers to disk, if MDBX_SAFE_NOSYNC i...
Definition mdbx.h:2172
@ MDBX_opt_spill_min_denominator
Controls the in-process how minimal part of the dirty pages should be spilled when necessary.
Definition mdbx.h:2277
@ 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:2300
@ 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:2212
@ 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:2199
@ MDBX_opt_max_readers
Defines the maximum number of threads/reader slots for all processes interacting with the database.
Definition mdbx.h:2166
@ MDBX_opt_subpage_reserve_limit
Задаёт в % ограничение резервирования места на вложенных страницах.
Definition mdbx.h:2439
@ MDBX_opt_spill_max_denominator
Controls the in-process how maximal part of the dirty pages may be spilled when necessary.
Definition mdbx.h:2261
@ MDBX_opt_sync_period
Controls interprocess/shared relative period since the last unsteady commit to force flush the data b...
Definition mdbx.h:2178
@ MDBX_opt_dp_reserve_limit
Controls the in-process limit of a pre-allocated memory items for dirty pages.
Definition mdbx.h:2226
@ MDBX_opt_writethrough_threshold
Controls the choosing between use write-through disk writes and usual ones with followed flush by the...
Definition mdbx.h:2340
@ MDBX_opt_gc_time_limit
Controls the in-process spending time limit of searching consecutive pages inside GC.
Definition mdbx.h:2372
@ MDBX_warmup_touchlimit
Definition mdbx.h:3278
@ MDBX_warmup_force
Definition mdbx.h:3248
@ MDBX_warmup_oomsafe
Definition mdbx.h:3255
@ MDBX_warmup_release
Definition mdbx.h:3281
@ MDBX_warmup_lock
Definition mdbx.h:3270
@ MDBX_warmup_default
Definition mdbx.h:3242
LIBMDBX_API int mdbx_env_get_path(const MDBX_env *env, const char **dest)
Return the path that was used in mdbx_env_open().
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 intptr_t mdbx_limits_keysize_min(MDBX_db_flags_t flags)
Returns minimal key size in bytes for given table flags.
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:3712
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:3096
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_txn_straggler(const MDBX_txn *txn, int *percent)
Returns a lag of the reading for the given transaction.
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.
int mdbx_dbi_flags(const MDBX_txn *txn, MDBX_dbi dbi, unsigned *flags)
The shortcut to calling mdbx_dbi_flags_ex() with state=NULL for discarding it result.
Definition mdbx.h:4916
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.
LIBMDBX_API intptr_t mdbx_limits_valsize_min(MDBX_db_flags_t flags)
Returns minimal data size in bytes for given table flags.
int mdbx_env_info(const MDBX_env *env, MDBX_envinfo *info, size_t bytes)
Return information about the MDBX environment.
Definition mdbx.h:2940
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:3033
LIBMDBX_API int mdbx_enumerate_tables(const MDBX_txn *txn, MDBX_table_enum_func *func, void *ctx)
Перечисляет пользовательские именнованные таблицы.
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...
intptr_t mdbx_limits_pgsize_max(void)
Returns the maximal database page size in bytes.
Definition mdbx.h:3621
LIBMDBX_API int mdbx_dbi_dupsort_depthmask(const MDBX_txn *txn, MDBX_dbi dbi, uint32_t *mask)
Retrieve depth (bitmask) information of nested dupsort (multi-value) B+trees for given table.
LIBMDBX_API int mdbx_txn_info(const MDBX_txn *txn, MDBX_txn_info *info, bool scan_rlt)
Return information about the MDBX transaction.
LIBMDBX_API int mdbx_is_dirty(const MDBX_txn *txn, const void *ptr)
Determines whether the given address is on a dirty database page of the transaction or not.
MDBX_dbi_state_t
DBI state bits returted by mdbx_dbi_flags_ex()
Definition mdbx.h:4888
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 ...
intptr_t mdbx_limits_pgsize_min(void)
Returns the minimal database page size in bytes.
Definition mdbx.h:3617
LIBMDBX_API int mdbx_env_get_maxkeysize(const MDBX_env *env)
LIBMDBX_API int mdbx_env_get_fd(const MDBX_env *env, mdbx_filehandle_t *fd)
Return the file descriptor for the given environment.
LIBMDBX_API void * mdbx_env_get_userctx(const MDBX_env *env)
Returns an application information (a context pointer) associated with the environment.
int MDBX_reader_list_func(void *ctx, int num, int slot, mdbx_pid_t pid, mdbx_tid_t thread, uint64_t txnid, uint64_t lag, size_t bytes_used, size_t bytes_retained) noexcept
A callback function used to enumerate the reader lock table.
Definition mdbx.h:6549
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:3757
LIBMDBX_API int mdbx_env_get_pathW(const MDBX_env *env, const wchar_t **dest)
Return the path that was used in mdbx_env_open().
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 size_t mdbx_default_pagesize(void)
Returns the default size of database page for the current system.
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_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 ...
int mdbx_env_stat(const MDBX_env *env, MDBX_stat *stat, size_t bytes)
Return statistics about the MDBX environment.
Definition mdbx.h:2822
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.
int MDBX_table_enum_func(void *ctx, const MDBX_txn *txn, const MDBX_val *name, MDBX_db_flags_t flags, const struct MDBX_stat *stat, MDBX_dbi dbi) noexcept
Функция обратного вызова для перечисления пользовательских именованных таблиц.
Definition mdbx.h:4781
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.
@ MDBX_DBI_DIRTY
Definition mdbx.h:4890
@ MDBX_DBI_FRESH
Definition mdbx.h:4894
@ MDBX_DBI_STALE
Definition mdbx.h:4892
@ MDBX_DBI_CREAT
Definition mdbx.h:4896
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)
Переводит читающую транзакцию в "припаркованное" состояние.
LIBMDBX_API int mdbx_txn_begin_ex(MDBX_env *env, MDBX_txn *parent, MDBX_txn_flags_t flags, MDBX_txn **txn, void *context)
Create a transaction with a user provided context pointer for use with the environment.
LIBMDBX_API int mdbx_txn_refresh(MDBX_txn *txn)
Refresh a read-only transaction for a recent data.
int mdbx_txn_commit(MDBX_txn *txn)
Commits all the operations of the transaction into the database.
Definition mdbx.h:4326
LIBMDBX_API int mdbx_txn_commit_ex(MDBX_txn *txn, MDBX_commit_latency *latency)
Commits all changes of the transaction into a database with collecting latencies information.
LIBMDBX_API MDBX_env * mdbx_txn_env(const MDBX_txn *txn)
Returns the transaction's MDBX_env.
LIBMDBX_API int mdbx_txn_checkpoint(MDBX_txn *txn, MDBX_txn_flags_t weakening_durability, MDBX_commit_latency *latency)
Commits all the operations of the transaction and immediately starts next without releasing any locks...
LIBMDBX_API int mdbx_txn_unpark(MDBX_txn *txn, bool restart_if_ousted)
Распарковывает ранее припаркованную читающую транзакцию.
MDBX_txn_flags_t
Definition mdbx.h:1501
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:3977
LIBMDBX_API int mdbx_txn_abort(MDBX_txn *txn)
Abandon all the operations of the transaction instead of saving them.
struct MDBX_txn MDBX_txn
Opaque structure for a transaction handle.
Definition mdbx.h:724
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:1512
@ MDBX_TXN_ERROR
Definition mdbx.h:1555
@ MDBX_TXN_NOMETASYNC
Definition mdbx.h:1534
@ MDBX_TXN_SPILLS
Definition mdbx.h:1565
@ MDBX_TXN_OUSTED
Definition mdbx.h:1589
@ MDBX_TXN_NOWEAKING
Definition mdbx.h:1530
@ MDBX_TXN_HAS_CHILD
Definition mdbx.h:1570
@ MDBX_TXN_RDONLY_PREPARE
Definition mdbx.h:1521
@ MDBX_TXN_INVALID
Definition mdbx.h:1545
@ MDBX_TXN_BLOCKED
Definition mdbx.h:1594
@ MDBX_TXN_PARKED
Definition mdbx.h:1575
@ MDBX_TXN_NOSYNC
Definition mdbx.h:1538
@ MDBX_TXN_DIRTY
Definition mdbx.h:1560
@ MDBX_TXN_READWRITE
Definition mdbx.h:1506
@ MDBX_TXN_AUTOUNPARK
Definition mdbx.h:1582
@ MDBX_TXN_TRY
Definition mdbx.h:1527
@ MDBX_TXN_FINISHED
Definition mdbx.h:1550
MDBX_chk_severity_t verbosity
Definition mdbx.h:6910
MDBX_txn * txn
Definition mdbx.h:6983
void(* issue)(MDBX_chk_context_t *ctx, const char *object, uint64_t entry_number, const char *issue, const char *extra_fmt, va_list extra_args)
Definition mdbx.h:7023
struct MDBX_chk_histogram tree_density
Histogram of branch and leaf pages filling in percents.
struct MDBX_chk_histogram::@167152105014034103340112155364354016331236072167 ranges[9]
void(* print_size)(MDBX_chk_line_t *, const char *prefix, const uint64_t value, const char *suffix)
Definition mdbx.h:7040
void(* print_done)(MDBX_chk_line_t *)
Definition mdbx.h:7037
struct MDBX_chk_internal * internal
Definition mdbx.h:6981
uint8_t scope_nesting
Definition mdbx.h:6985
char * end
Definition mdbx.h:6892
uint8_t scope_depth
Definition mdbx.h:6891
struct MDBX_chk_histogram key_len
Keys length histogram.
struct MDBX_chk_histogram large_or_nested_density
Histogram of nested tree(s) branch and leaf pages filling in percents.
int(* stage_begin)(MDBX_chk_context_t *ctx, MDBX_chk_stage_t)
Definition mdbx.h:7032
int(* stage_end)(MDBX_chk_context_t *ctx, MDBX_chk_stage_t, int err)
Definition mdbx.h:7033
int(* table_conclude)(MDBX_chk_context_t *ctx, const MDBX_chk_table_t *table, MDBX_cursor *cursor, int err)
Definition mdbx.h:7026
void(* print_format)(MDBX_chk_line_t *, const char *fmt, va_list args)
Definition mdbx.h:7039
struct MDBX_chk_internal * internal
Definition mdbx.h:6907
char * begin
Definition mdbx.h:6892
size_t le1_count
Definition mdbx.h:6927
int(* scope_push)(MDBX_chk_context_t *ctx, MDBX_chk_scope_t *outer, MDBX_chk_scope_t *inner, const char *fmt, va_list args)
Definition mdbx.h:7019
size_t subtotal_issues
Definition mdbx.h:6911
size_t total_unused_bytes
uint8_t severity
Definition mdbx.h:6891
MDBX_chk_user_table_cookie_t * cookie
Definition mdbx.h:6937
void(* scope_pop)(MDBX_chk_context_t *ctx, MDBX_chk_scope_t *outer, MDBX_chk_scope_t *inner)
Definition mdbx.h:7022
struct MDBX_chk_context * ctx
Definition mdbx.h:6890
MDBX_db_flags_t flags
Definition mdbx.h:6947
int(* scope_conclude)(MDBX_chk_context_t *ctx, MDBX_chk_scope_t *outer, MDBX_chk_scope_t *inner, int err)
Definition mdbx.h:7021
size_t le1_amount
Definition mdbx.h:6927
void(* print_flush)(MDBX_chk_line_t *)
Definition mdbx.h:7036
struct MDBX_chk_issue * next
Definition mdbx.h:6898
struct MDBX_chk_histogram large_pages
Histogram of large/overflow pages length.
char * out
Definition mdbx.h:6892
struct MDBX_chk_histogram val_len
Values length histogram.
void(* print_chars)(MDBX_chk_line_t *, const char *str, size_t len)
Definition mdbx.h:7038
const MDBX_chk_table_t *const * tables
const void * object
Definition mdbx.h:6908
size_t count
Definition mdbx.h:6927
const char * caption
Definition mdbx.h:6900
MDBX_chk_stage_t stage
Definition mdbx.h:6909
size_t total_payload_bytes
struct MDBX_chk_histogram histogram_page_age
Histogram of pages age.
struct MDBX_chk_histogram height
Tree deep histogram.
struct MDBX_chk_histogram multival
Number of multi-values (aka duplicates) histogram.
struct MDBX_chk_histogram nested_height_or_gc_span_length
Histogram of nested trees height, span length for GC.
MDBX_env * env
Definition mdbx.h:6982
uint8_t empty
Definition mdbx.h:6891
size_t amount
Definition mdbx.h:6927
MDBX_chk_scope_t * scope
Definition mdbx.h:6984
MDBX_chk_issue_t * issues
Definition mdbx.h:6906
size_t payload_bytes
Definition mdbx.h:6950
size_t count
Definition mdbx.h:6899
MDBX_val name
Definition mdbx.h:6946
size_t lost_bytes
Definition mdbx.h:6950
bool(* check_break)(MDBX_chk_context_t *ctx)
Definition mdbx.h:7018
void(* table_dispose)(MDBX_chk_context_t *ctx, const MDBX_chk_table_t *table)
Definition mdbx.h:7027
int(* table_handle_kv)(MDBX_chk_context_t *ctx, const MDBX_chk_table_t *table, size_t entry_number, const MDBX_val *key, const MDBX_val *value)
Definition mdbx.h:7029
int id
Definition mdbx.h:6948
struct MDBX_chk_histogram page_age
Histogram of pages age.
LIBMDBX_API int mdbx_env_chk_encount_problem(MDBX_chk_context_t *ctx)
Вспомогательная функция для подсчета проблем детектируемых приложением, в том числе,...
LIBMDBX_API int mdbx_env_chk(MDBX_env *env, const MDBX_chk_callbacks_t *cb, MDBX_chk_context_t *ctx, const MDBX_chk_flags_t flags, MDBX_chk_severity_t verbosity, unsigned timeout_seconds_16dot16)
Проверяет целостность базы данных.
LIBMDBX_API const char * mdbx_ratio2digits(uint64_t numerator, uint64_t denominator, int precision, char *buffer, size_t buffer_size)
MDBX_chk_stage_t
Стадии проверки, сообщаемые через обратные вызовы при проверке целостности базы данных.
Definition mdbx.h:6872
LIBMDBX_API int mdbx_txn_unlock(MDBX_env *env)
Releases write-transaction lock. Provided for custom and/or complex locking scenarios.
LIBMDBX_API const char * mdbx_ratio2percents(uint64_t value, uint64_t whole, char *buffer, size_t buffer_size)
struct MDBX_chk_user_table_cookie MDBX_chk_user_table_cookie_t
Пользовательский тип для привязки дополнительных данных, связанных с некоторой таблицей ключ-значение...
Definition mdbx.h:6921
MDBX_chk_flags_t
Флаги/опции для проверки целостности базы данных.
Definition mdbx.h:6829
MDBX_chk_severity_t
Уровни логирование/детализации информации, поставляемой через обратные вызовы при проверке целостност...
Definition mdbx.h:6853
LIBMDBX_API int mdbx_txn_lock(MDBX_env *env, bool dont_wait)
Acquires write-transaction lock. Provided for custom and/or complex locking scenarios.
LIBMDBX_API int mdbx_env_turn_for_recovery(MDBX_env *env, unsigned target_meta)
Turn database to the specified meta-page.
LIBMDBX_API int mdbx_env_open_for_recovery(MDBX_env *env, const char *pathname, unsigned target_meta, bool writeable)
Open an environment instance using specific meta-page for checking and recovery.
@ MDBX_chk_gc
Definition mdbx.h:6878
@ MDBX_chk_init
Definition mdbx.h:6874
@ MDBX_chk_finalize
Definition mdbx.h:6884
@ MDBX_chk_space
Definition mdbx.h:6879
@ MDBX_chk_lock
Definition mdbx.h:6875
@ MDBX_chk_none
Definition mdbx.h:6873
@ MDBX_chk_maindb
Definition mdbx.h:6880
@ MDBX_chk_unlock
Definition mdbx.h:6883
@ MDBX_chk_meta
Definition mdbx.h:6876
@ MDBX_chk_conclude
Definition mdbx.h:6882
@ MDBX_chk_tree
Definition mdbx.h:6877
@ MDBX_chk_tables
Definition mdbx.h:6881
@ MDBX_CHK_SKIP_BTREE_TRAVERSAL
Definition mdbx.h:6838
@ MDBX_CHK_READWRITE
Definition mdbx.h:6835
@ MDBX_CHK_DEFAULTS
Definition mdbx.h:6831
@ MDBX_CHK_SKIP_KV_TRAVERSAL
Definition mdbx.h:6841
@ MDBX_CHK_IGNORE_ORDER
Definition mdbx.h:6846
@ MDBX_chk_processing
Definition mdbx.h:6862
@ MDBX_chk_result
Definition mdbx.h:6860
@ MDBX_chk_details
Definition mdbx.h:6865
@ MDBX_chk_extra
Definition mdbx.h:6866
@ MDBX_chk_severity_prio_shift
Definition mdbx.h:6854
@ MDBX_chk_severity_kind_mask
Definition mdbx.h:6855
@ MDBX_chk_notice
Definition mdbx.h:6859
@ MDBX_chk_resolution
Definition mdbx.h:6861
@ MDBX_chk_warning
Definition mdbx.h:6858
@ MDBX_chk_fatal
Definition mdbx.h:6856
@ MDBX_chk_info
Definition mdbx.h:6863
@ MDBX_chk_error
Definition mdbx.h:6857
@ MDBX_chk_verbose
Definition mdbx.h:6864
Набор функций обратного вызова используемых при проверке целостности базы данных.
Definition mdbx.h:7017
Контекст проверки целостности базы данных.
Definition mdbx.h:6980
Гистограмма с некоторой статистической информацией, собираемой при проверке целостности БД.
Definition mdbx.h:6926
Проблема обнаруженная при проверке целостности базы данных.
Definition mdbx.h:6897
Виртуальная строка отчета, формируемого при проверке целостности базы данных.
Definition mdbx.h:6889
Иерархический контекст при проверке целостности базы данных.
Definition mdbx.h:6905
Информация о некоторой таблицей ключ-значение, при проверке целостности базы данных.
Definition mdbx.h:6936
LIBMDBX_API float mdbx_float_from_key(const MDBX_val)
LIBMDBX_API int32_t mdbx_int32_from_key(const MDBX_val)
LIBMDBX_API int64_t mdbx_int64_from_key(const MDBX_val)
LIBMDBX_API double mdbx_double_from_key(const MDBX_val)
LIBMDBX_API int64_t mdbx_jsonInteger_from_key(const MDBX_val)
uint64_t mdbx_key_from_int64(const int64_t i64)
Definition mdbx.h:4827
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:4831
LIBMDBX_API uint64_t mdbx_key_from_jsonInteger(const int64_t json_integer)