libmdbx 0.13.2.20 (2024-12-20T11:46:01+03:00)
One of the fastest compact embeddable key-value ACID storage engine without WAL.
 
Loading...
Searching...
No Matches
mdbx.h
Go to the documentation of this file.
1
38#pragma once
39#ifndef LIBMDBX_H
40#define LIBMDBX_H
41
42#if defined(__riscv) || defined(__riscv__) || defined(__RISCV) || defined(__RISCV__)
43#warning "The RISC-V architecture is intentionally insecure by design. \
44 Please delete this admonition at your own risk, \
45 if you make such decision informed and consciously. \
46 Refer to https://clck.ru/32d9xH for more information."
47#endif /* RISC-V */
48
49#ifdef _MSC_VER
50#pragma warning(push, 1)
51#pragma warning(disable : 4548) /* expression before comma has no effect; \
52 expected expression with side - effect */
53#pragma warning(disable : 4530) /* C++ exception handler used, but unwind \
54 * semantics are not enabled. Specify /EHsc */
55#pragma warning(disable : 4577) /* 'noexcept' used with no exception handling \
56 * mode specified; termination on exception is \
57 * not guaranteed. Specify /EHsc */
58#endif /* _MSC_VER (warnings) */
59
60/* *INDENT-OFF* */
61/* clang-format off */
144/* *INDENT-ON* */
145/* clang-format on */
146
147#include <stdarg.h>
148#include <stddef.h>
149#include <stdint.h>
150#if !defined(NDEBUG) && !defined(assert)
151#include <assert.h>
152#endif /* NDEBUG */
153
154#if defined(_WIN32) || defined(_WIN64)
155#include <windows.h>
156#include <winnt.h>
157#ifndef __mode_t_defined
158typedef unsigned short mdbx_mode_t;
159#else
160typedef mode_t mdbx_mode_t;
161#endif /* __mode_t_defined */
162typedef HANDLE mdbx_filehandle_t;
163typedef DWORD mdbx_pid_t;
164typedef DWORD mdbx_tid_t;
165#else /* Windows */
166#include <errno.h> /* for error codes */
167#include <pthread.h> /* for pthread_t */
168#include <sys/types.h> /* for pid_t */
169#include <sys/uio.h> /* for struct iovec */
170#define HAVE_STRUCT_IOVEC 1
172typedef pid_t mdbx_pid_t;
173typedef pthread_t mdbx_tid_t;
174typedef mode_t mdbx_mode_t;
175#endif /* !Windows */
176
177#ifdef _MSC_VER
178#pragma warning(pop)
179#endif
180
186/*----------------------------------------------------------------------------*/
187
188#ifndef __has_attribute
189#define __has_attribute(x) (0)
190#endif /* __has_attribute */
191
192#ifndef __has_c_attribute
193#define __has_c_attribute(x) (0)
194#define __has_c_attribute_qualified(x) 0
195#elif !defined(__STDC_VERSION__) || __STDC_VERSION__ < 202311L
196#define __has_c_attribute_qualified(x) 0
197#elif defined(_MSC_VER)
198/* MSVC don't support `namespace::attr` syntax */
199#define __has_c_attribute_qualified(x) 0
200#else
201#define __has_c_attribute_qualified(x) __has_c_attribute(x)
202#endif /* __has_c_attribute */
203
204#ifndef __has_cpp_attribute
205#define __has_cpp_attribute(x) 0
206#define __has_cpp_attribute_qualified(x) 0
207#elif defined(_MSC_VER)
208/* MSVC don't support `namespace::attr` syntax */
209#define __has_cpp_attribute_qualified(x) 0
210#else
211#define __has_cpp_attribute_qualified(x) __has_cpp_attribute(x)
212#endif /* __has_cpp_attribute */
213
214#ifndef __has_C23_or_CXX_attribute
215#if defined(__cplusplus)
216#define __has_C23_or_CXX_attribute(x) __has_cpp_attribute_qualified(x)
217#else
218#define __has_C23_or_CXX_attribute(x) __has_c_attribute_qualified(x)
219#endif
220#endif /* __has_C23_or_CXX_attribute */
221
222#ifndef __has_feature
223#define __has_feature(x) (0)
224#define __has_exceptions_disabled (0)
225#elif !defined(__has_exceptions_disabled)
226#define __has_exceptions_disabled (__has_feature(cxx_noexcept) && !__has_feature(cxx_exceptions))
227#endif /* __has_feature */
228
229#ifndef __has_extension
230#define __has_extension(x) __has_feature(x)
231#endif /* __has_extension */
232
233#ifndef __has_builtin
234#define __has_builtin(x) (0)
235#endif /* __has_builtin */
236
243#if defined(DOXYGEN)
244#define MDBX_PURE_FUNCTION [[gnu::pure]]
245#elif __has_C23_or_CXX_attribute(gnu::pure)
246#define MDBX_PURE_FUNCTION [[gnu::pure]]
247#elif (defined(__GNUC__) || __has_attribute(__pure__)) && \
248 (!defined(__clang__) /* https://bugs.llvm.org/show_bug.cgi?id=43275 */ || !defined(__cplusplus) || \
249 __has_exceptions_disabled)
250#define MDBX_PURE_FUNCTION __attribute__((__pure__))
251#else
252#define MDBX_PURE_FUNCTION
253#endif /* MDBX_PURE_FUNCTION */
254
258#if defined(DOXYGEN)
259#define MDBX_NOTHROW_PURE_FUNCTION [[gnu::pure, gnu::nothrow]]
260#elif __has_C23_or_CXX_attribute(gnu::pure)
261#if __has_C23_or_CXX_attribute(gnu::nothrow)
262#define MDBX_NOTHROW_PURE_FUNCTION [[gnu::pure, gnu::nothrow]]
263#else
264#define MDBX_NOTHROW_PURE_FUNCTION [[gnu::pure]]
265#endif
266#elif defined(__GNUC__) || (__has_attribute(__pure__) && __has_attribute(__nothrow__))
267#define MDBX_NOTHROW_PURE_FUNCTION __attribute__((__pure__, __nothrow__))
268#elif __has_cpp_attribute(pure)
269#define MDBX_NOTHROW_PURE_FUNCTION [[pure]]
270#else
271#define MDBX_NOTHROW_PURE_FUNCTION
272#endif /* MDBX_NOTHROW_PURE_FUNCTION */
273
284#if defined(DOXYGEN)
285#define MDBX_CONST_FUNCTION [[gnu::const]]
286#elif __has_C23_or_CXX_attribute(gnu::const)
287#define MDBX_CONST_FUNCTION [[gnu::const]]
288#elif (defined(__GNUC__) || __has_attribute(__const__)) && \
289 (!defined(__clang__) /* https://bugs.llvm.org/show_bug.cgi?id=43275 */ || !defined(__cplusplus) || \
290 __has_exceptions_disabled)
291#define MDBX_CONST_FUNCTION __attribute__((__const__))
292#else
293#define MDBX_CONST_FUNCTION MDBX_PURE_FUNCTION
294#endif /* MDBX_CONST_FUNCTION */
295
299#if defined(DOXYGEN)
300#define MDBX_NOTHROW_CONST_FUNCTION [[gnu::const, gnu::nothrow]]
301#elif __has_C23_or_CXX_attribute(gnu::const)
302#if __has_C23_or_CXX_attribute(gnu::nothrow)
303#define MDBX_NOTHROW_CONST_FUNCTION [[gnu::const, gnu::nothrow]]
304#else
305#define MDBX_NOTHROW_CONST_FUNCTION [[gnu::const]]
306#endif
307#elif defined(__GNUC__) || (__has_attribute(__const__) && __has_attribute(__nothrow__))
308#define MDBX_NOTHROW_CONST_FUNCTION __attribute__((__const__, __nothrow__))
309#elif __has_cpp_attribute_qualified(const)
310#define MDBX_NOTHROW_CONST_FUNCTION [[const]]
311#else
312#define MDBX_NOTHROW_CONST_FUNCTION MDBX_NOTHROW_PURE_FUNCTION
313#endif /* MDBX_NOTHROW_CONST_FUNCTION */
314
318#ifndef MDBX_DEPRECATED
319#ifdef __deprecated
320#define MDBX_DEPRECATED __deprecated
321#elif defined(DOXYGEN) || ((!defined(__GNUC__) || defined(__clang__) || __GNUC__ > 5) && \
322 ((defined(__cplusplus) && __cplusplus >= 201403L && __has_cpp_attribute(deprecated) && \
323 __has_cpp_attribute(deprecated) >= 201309L) || \
324 (!defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202304L)))
325#define MDBX_DEPRECATED [[deprecated]]
326#elif (defined(__GNUC__) && __GNUC__ > 5) || \
327 (__has_attribute(__deprecated__) && (!defined(__GNUC__) || defined(__clang__) || __GNUC__ > 5))
328#define MDBX_DEPRECATED __attribute__((__deprecated__))
329#elif defined(_MSC_VER)
330#define MDBX_DEPRECATED __declspec(deprecated)
331#else
332#define MDBX_DEPRECATED
333#endif
334#endif /* MDBX_DEPRECATED */
335
336#ifndef MDBX_DEPRECATED_ENUM
337#ifdef __deprecated_enum
338#define MDBX_DEPRECATED_ENUM __deprecated_enum
339#elif defined(DOXYGEN) || \
340 (!defined(_MSC_VER) || (defined(__cplusplus) && __cplusplus >= 201403L && __has_cpp_attribute(deprecated) && \
341 __has_cpp_attribute(deprecated) >= 201309L))
342#define MDBX_DEPRECATED_ENUM MDBX_DEPRECATED
343#else
344#define MDBX_DEPRECATED_ENUM /* avoid madness MSVC */
345#endif
346#endif /* MDBX_DEPRECATED_ENUM */
347
348#ifndef __dll_export
349#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__) || defined(__MINGW__) || defined(__MINGW32__) || \
350 defined(__MINGW64__)
351#if defined(__GNUC__) || __has_attribute(__dllexport__)
352#define __dll_export __attribute__((__dllexport__))
353#elif defined(_MSC_VER)
354#define __dll_export __declspec(dllexport)
355#else
356#define __dll_export
357#endif
358#elif defined(__GNUC__) || __has_attribute(__visibility__)
359#define __dll_export __attribute__((__visibility__("default")))
360#else
361#define __dll_export
362#endif
363#endif /* __dll_export */
364
365#ifndef __dll_import
366#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__) || defined(__MINGW__) || defined(__MINGW32__) || \
367 defined(__MINGW64__)
368#if defined(__GNUC__) || __has_attribute(__dllimport__)
369#define __dll_import __attribute__((__dllimport__))
370#elif defined(_MSC_VER)
371#define __dll_import __declspec(dllimport)
372#else
373#define __dll_import
374#endif
375#else
376#define __dll_import
377#endif
378#endif /* __dll_import */
379
384#if defined(LIBMDBX_INTERNALS) && !defined(LIBMDBX_NO_EXPORTS_LEGACY_API)
385#define LIBMDBX_INLINE_API(TYPE, NAME, ARGS) \
386 /* proto of exported which uses common impl */ LIBMDBX_API TYPE NAME ARGS; \
387 /* definition of common impl */ static __inline TYPE __inline_##NAME ARGS
388#else
389#define LIBMDBX_INLINE_API(TYPE, NAME, ARGS) static __inline TYPE NAME ARGS
390#endif /* LIBMDBX_INLINE_API */
391
393#ifndef MDBX_STRINGIFY
394#define MDBX_STRINGIFY_HELPER(x) #x
395#define MDBX_STRINGIFY(x) MDBX_STRINGIFY_HELPER(x)
396#endif /* MDBX_STRINGIFY */
397
398/*----------------------------------------------------------------------------*/
399
400#ifndef __cplusplus
401#ifndef bool
402#define bool _Bool
403#endif
404#ifndef true
405#define true (1)
406#endif
407#ifndef false
408#define false (0)
409#endif
410#endif /* bool without __cplusplus */
411
413#if defined(DOXYGEN)
414#define MDBX_CXX17_NOEXCEPT noexcept
415#elif !defined(__cpp_noexcept_function_type) || __cpp_noexcept_function_type < 201510L
416#define MDBX_CXX17_NOEXCEPT
417#else
418#define MDBX_CXX17_NOEXCEPT noexcept
419#endif /* MDBX_CXX17_NOEXCEPT */
420
422#if defined(DOXYGEN)
423#define MDBX_CXX01_CONSTEXPR constexpr
424#define MDBX_CXX01_CONSTEXPR_VAR constexpr
425#elif !defined(__cplusplus)
426#define MDBX_CXX01_CONSTEXPR __inline
427#define MDBX_CXX01_CONSTEXPR_VAR const
428#elif !defined(DOXYGEN) && \
429 ((__cplusplus < 201103L && defined(__cpp_constexpr) && __cpp_constexpr < 200704L) || \
430 (defined(__LCC__) && __LCC__ < 124) || \
431 (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 407) && !defined(__clang__) && !defined(__LCC__)) || \
432 (defined(_MSC_VER) && _MSC_VER < 1910) || (defined(__clang__) && __clang_major__ < 4))
433#define MDBX_CXX01_CONSTEXPR inline
434#define MDBX_CXX01_CONSTEXPR_VAR const
435#else
436#define MDBX_CXX01_CONSTEXPR constexpr
437#define MDBX_CXX01_CONSTEXPR_VAR constexpr
438#endif /* MDBX_CXX01_CONSTEXPR */
439
442#if defined(DOXYGEN)
443#define MDBX_CXX11_CONSTEXPR constexpr
444#define MDBX_CXX11_CONSTEXPR_VAR constexpr
445#elif !defined(__cplusplus)
446#define MDBX_CXX11_CONSTEXPR __inline
447#define MDBX_CXX11_CONSTEXPR_VAR const
448#elif !defined(DOXYGEN) && \
449 (!defined(__cpp_constexpr) || __cpp_constexpr < 201304L || (defined(__LCC__) && __LCC__ < 124) || \
450 (defined(__GNUC__) && __GNUC__ < 6 && !defined(__clang__) && !defined(__LCC__)) || \
451 (defined(_MSC_VER) && _MSC_VER < 1910) || (defined(__clang__) && __clang_major__ < 5))
452#define MDBX_CXX11_CONSTEXPR inline
453#define MDBX_CXX11_CONSTEXPR_VAR const
454#else
455#define MDBX_CXX11_CONSTEXPR constexpr
456#define MDBX_CXX11_CONSTEXPR_VAR constexpr
457#endif /* MDBX_CXX11_CONSTEXPR */
458
461#if defined(DOXYGEN)
462#define MDBX_CXX14_CONSTEXPR constexpr
463#define MDBX_CXX14_CONSTEXPR_VAR constexpr
464#elif !defined(__cplusplus)
465#define MDBX_CXX14_CONSTEXPR __inline
466#define MDBX_CXX14_CONSTEXPR_VAR const
467#elif defined(DOXYGEN) || \
468 defined(__cpp_constexpr) && __cpp_constexpr >= 201304L && \
469 ((defined(_MSC_VER) && _MSC_VER >= 1910) || (defined(__clang__) && __clang_major__ > 4) || \
470 (defined(__GNUC__) && __GNUC__ > 6) || (!defined(__GNUC__) && !defined(__clang__) && !defined(_MSC_VER)))
471#define MDBX_CXX14_CONSTEXPR constexpr
472#define MDBX_CXX14_CONSTEXPR_VAR constexpr
473#else
474#define MDBX_CXX14_CONSTEXPR inline
475#define MDBX_CXX14_CONSTEXPR_VAR const
476#endif /* MDBX_CXX14_CONSTEXPR */
477
478#if defined(__noreturn)
479#define MDBX_NORETURN __noreturn
480#elif defined(_Noreturn)
481#define MDBX_NORETURN _Noreturn
482#elif defined(DOXYGEN) || (defined(__cplusplus) && __cplusplus >= 201103L) || \
483 (!defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ > 202005L)
484#define MDBX_NORETURN [[noreturn]]
485#elif defined(__GNUC__) || __has_attribute(__noreturn__)
486#define MDBX_NORETURN __attribute__((__noreturn__))
487#elif defined(_MSC_VER) && !defined(__clang__)
488#define MDBX_NORETURN __declspec(noreturn)
489#else
490#define MDBX_NORETURN
491#endif /* MDBX_NORETURN */
492
493#ifndef MDBX_PRINTF_ARGS
494#if defined(__GNUC__) || __has_attribute(__format__) || defined(DOXYGEN)
495#if defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__)
496#define MDBX_PRINTF_ARGS(format_index, first_arg) __attribute__((__format__(__gnu_printf__, format_index, first_arg)))
497#else
498#define MDBX_PRINTF_ARGS(format_index, first_arg) __attribute__((__format__(__printf__, format_index, first_arg)))
499#endif /* MinGW */
500#else
501#define MDBX_PRINTF_ARGS(format_index, first_arg)
502#endif
503#endif /* MDBX_PRINTF_ARGS */
504
505#if defined(DOXYGEN) || \
506 (defined(__cplusplus) && __cplusplus >= 201603L && __has_cpp_attribute(maybe_unused) && \
507 __has_cpp_attribute(maybe_unused) >= 201603L) || \
508 (!defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ > 202005L)
509#define MDBX_MAYBE_UNUSED [[maybe_unused]]
510#elif defined(__GNUC__) || __has_attribute(__unused__)
511#define MDBX_MAYBE_UNUSED __attribute__((__unused__))
512#else
513#define MDBX_MAYBE_UNUSED
514#endif /* MDBX_MAYBE_UNUSED */
515
516#if __has_attribute(no_sanitize) || defined(DOXYGEN)
517#define MDBX_NOSANITIZE_ENUM __attribute((__no_sanitize__("enum")))
518#else
519#define MDBX_NOSANITIZE_ENUM
520#endif /* MDBX_NOSANITIZE_ENUM */
521
522/* Oh, below are some songs and dances since:
523 * - C++ requires explicit definition of the necessary operators.
524 * - the proper implementation of DEFINE_ENUM_FLAG_OPERATORS for C++ required
525 * the constexpr feature which is broken in most old compilers;
526 * - DEFINE_ENUM_FLAG_OPERATORS may be defined broken as in the Windows SDK. */
527#if !defined(DEFINE_ENUM_FLAG_OPERATORS) && !defined(DOXYGEN)
528
529#ifdef __cplusplus
530#if !defined(__cpp_constexpr) || __cpp_constexpr < 200704L || (defined(__LCC__) && __LCC__ < 124) || \
531 (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 407) && !defined(__clang__) && !defined(__LCC__)) || \
532 (defined(_MSC_VER) && _MSC_VER < 1910) || (defined(__clang__) && __clang_major__ < 4)
533/* The constexpr feature is not available or (may be) broken */
534#define CONSTEXPR_ENUM_FLAGS_OPERATIONS 0
535#else
536/* C always allows these operators for enums */
537#define CONSTEXPR_ENUM_FLAGS_OPERATIONS 1
538#endif /* __cpp_constexpr */
539
542#define DEFINE_ENUM_FLAG_OPERATORS(ENUM) \
543 extern "C++" { \
544 MDBX_NOSANITIZE_ENUM MDBX_CXX01_CONSTEXPR ENUM operator|(ENUM a, ENUM b) { return ENUM(unsigned(a) | unsigned(b)); } \
545 MDBX_NOSANITIZE_ENUM MDBX_CXX14_CONSTEXPR ENUM &operator|=(ENUM &a, ENUM b) { return a = a | b; } \
546 MDBX_NOSANITIZE_ENUM MDBX_CXX01_CONSTEXPR ENUM operator&(ENUM a, ENUM b) { return ENUM(unsigned(a) & unsigned(b)); } \
547 MDBX_NOSANITIZE_ENUM MDBX_CXX01_CONSTEXPR ENUM operator&(ENUM a, unsigned b) { return ENUM(unsigned(a) & b); } \
548 MDBX_NOSANITIZE_ENUM MDBX_CXX01_CONSTEXPR ENUM operator&(unsigned a, ENUM b) { return ENUM(a & unsigned(b)); } \
549 MDBX_NOSANITIZE_ENUM MDBX_CXX14_CONSTEXPR ENUM &operator&=(ENUM &a, ENUM b) { return a = a & b; } \
550 MDBX_NOSANITIZE_ENUM MDBX_CXX14_CONSTEXPR ENUM &operator&=(ENUM &a, unsigned b) { return a = a & b; } \
551 MDBX_CXX01_CONSTEXPR unsigned operator~(ENUM a) { return ~unsigned(a); } \
552 MDBX_NOSANITIZE_ENUM MDBX_CXX01_CONSTEXPR ENUM operator^(ENUM a, ENUM b) { return ENUM(unsigned(a) ^ unsigned(b)); } \
553 MDBX_NOSANITIZE_ENUM MDBX_CXX14_CONSTEXPR ENUM &operator^=(ENUM &a, ENUM b) { return a = a ^ b; } \
554 }
555#else /* __cplusplus */
556/* nope for C since it always allows these operators for enums */
557#define DEFINE_ENUM_FLAG_OPERATORS(ENUM)
558#define CONSTEXPR_ENUM_FLAGS_OPERATIONS 1
559#endif /* !__cplusplus */
560
561#elif !defined(CONSTEXPR_ENUM_FLAGS_OPERATIONS)
562
563#ifdef __cplusplus
564/* DEFINE_ENUM_FLAG_OPERATORS may be defined broken as in the Windows SDK */
565#define CONSTEXPR_ENUM_FLAGS_OPERATIONS 0
566#else
567/* C always allows these operators for enums */
568#define CONSTEXPR_ENUM_FLAGS_OPERATIONS 1
569#endif
570
571#endif /* DEFINE_ENUM_FLAG_OPERATORS */
572
575/*----------------------------------------------------------------------------*/
576
580#ifdef __cplusplus
581extern "C" {
582#endif
583
584/* MDBX version 0.13.x */
585#define MDBX_VERSION_MAJOR 0
586#define MDBX_VERSION_MINOR 13
587
588#ifndef LIBMDBX_API
589#if defined(LIBMDBX_EXPORTS) || defined(DOXYGEN)
590#define LIBMDBX_API __dll_export
591#elif defined(LIBMDBX_IMPORTS)
592#define LIBMDBX_API __dll_import
593#else
594#define LIBMDBX_API
595#endif
596#endif /* LIBMDBX_API */
597
598#ifdef __cplusplus
599#if defined(__clang__) || __has_attribute(type_visibility) || defined(DOXYGEN)
600#define LIBMDBX_API_TYPE LIBMDBX_API __attribute__((type_visibility("default")))
601#else
602#define LIBMDBX_API_TYPE LIBMDBX_API
603#endif
604#else
605#define LIBMDBX_API_TYPE
606#endif /* LIBMDBX_API_TYPE */
607
608#if defined(LIBMDBX_IMPORTS)
609#define LIBMDBX_VERINFO_API __dll_import
610#else
611#define LIBMDBX_VERINFO_API __dll_export
612#endif /* LIBMDBX_VERINFO_API */
613
616 uint16_t major;
617 uint16_t minor;
618 uint16_t patch;
619 uint16_t tweak;
620 const char *semver_prerelease;
621 struct {
622 const char *datetime;
623 const char *tree;
624 const char *commit;
625 const char *describe;
626 } git;
627 const char *sourcery;
629
634 const char *datetime;
635 const char *target;
636 const char *options;
637 const char *compiler;
638 const char *flags;
639 const char *metadata;
643
644#if (defined(_WIN32) || defined(_WIN64)) && !MDBX_BUILD_SHARED_LIBRARY
645/* MDBX internally uses global and thread local storage destructors to
646 * automatically (de)initialization, releasing reader lock table slots
647 * and so on.
648 *
649 * If MDBX built as a DLL this is done out-of-the-box by DllEntry() function,
650 * which called automatically by Windows core with passing corresponding reason
651 * argument.
652 *
653 * Otherwise, if MDBX was built not as a DLL, some black magic
654 * may be required depending of Windows version:
655 *
656 * - Modern Windows versions, including Windows Vista and later, provides
657 * support for "TLS Directory" (e.g .CRT$XL[A-Z] sections in executable
658 * or dll file). In this case, MDBX capable of doing all automatically,
659 * therefore you DON'T NEED to call mdbx_module_handler()
660 * so the MDBX_MANUAL_MODULE_HANDLER defined as 0.
661 *
662 * - Obsolete versions of Windows, prior to Windows Vista, REQUIRES calling
663 * mdbx_module_handler() manually from corresponding DllMain() or WinMain()
664 * of your DLL or application,
665 * so the MDBX_MANUAL_MODULE_HANDLER defined as 1.
666 *
667 * Therefore, building MDBX as a DLL is recommended for all version of Windows.
668 * So, if you doubt, just build MDBX as the separate DLL and don't care about
669 * the MDBX_MANUAL_MODULE_HANDLER. */
670
671#ifndef _WIN32_WINNT
672#error Non-dll build libmdbx requires target Windows version \
673 to be explicitly defined via _WIN32_WINNT for properly \
674 handling thread local storage destructors.
675#endif /* _WIN32_WINNT */
676
677#if _WIN32_WINNT >= 0x0600 /* Windows Vista */
678/* As described above mdbx_module_handler() is NOT needed for Windows Vista
679 * and later. */
680#define MDBX_MANUAL_MODULE_HANDLER 0
681#else
682/* As described above mdbx_module_handler() IS REQUIRED for Windows versions
683 * prior to Windows Vista. */
684#define MDBX_MANUAL_MODULE_HANDLER 1
685void LIBMDBX_API NTAPI mdbx_module_handler(PVOID module, DWORD reason, PVOID reserved);
686#endif
687
688#endif /* Windows && !DLL && MDBX_MANUAL_MODULE_HANDLER */
689
690/* OPACITY STRUCTURES *********************************************************/
691
696#ifndef __cplusplus
697typedef struct MDBX_env MDBX_env;
698#else
699struct MDBX_env;
700#endif
701
707#ifndef __cplusplus
708typedef struct MDBX_txn MDBX_txn;
709#else
710struct MDBX_txn;
711#endif
712
720typedef uint32_t MDBX_dbi;
721
726#ifndef __cplusplus
728#else
729struct MDBX_cursor;
730#endif
731
746#ifndef HAVE_STRUCT_IOVEC
747struct iovec {
748 void *iov_base;
749 size_t iov_len;
750};
751#define HAVE_STRUCT_IOVEC
752#endif /* HAVE_STRUCT_IOVEC */
753
754#if defined(__sun) || defined(__SVR4) || defined(__svr4__)
755/* The `iov_len` is signed on Sun/Solaris.
756 * So define custom MDBX_val to avoid a lot of warnings. */
757struct MDBX_val {
758 void *iov_base;
759 size_t iov_len;
760};
761#ifndef __cplusplus
762typedef struct MDBX_val MDBX_val;
763#endif
764#else /* SunOS */
765typedef struct iovec MDBX_val;
766#endif /* ! SunOS */
767
770 MDBX_MAX_DBI = UINT32_C(32765),
771
773 MDBX_MAXDATASIZE = UINT32_C(0x7fff0000),
774
777
780};
781
782/* THE FILES *******************************************************************
783 * At the file system level, the environment corresponds to a pair of files. */
784
785#ifndef MDBX_LOCKNAME
788#if !(defined(_WIN32) || defined(_WIN64))
789#define MDBX_LOCKNAME "/mdbx.lck"
790#else
791#define MDBX_LOCKNAME_W L"\\mdbx.lck"
792#define MDBX_LOCKNAME_A "\\mdbx.lck"
793#ifdef UNICODE
794#define MDBX_LOCKNAME MDBX_LOCKNAME_W
795#else
796#define MDBX_LOCKNAME MDBX_LOCKNAME_A
797#endif /* UNICODE */
798#endif /* Windows */
799#endif /* MDBX_LOCKNAME */
800#ifndef MDBX_DATANAME
803#if !(defined(_WIN32) || defined(_WIN64))
804#define MDBX_DATANAME "/mdbx.dat"
805#else
806#define MDBX_DATANAME_W L"\\mdbx.dat"
807#define MDBX_DATANAME_A "\\mdbx.dat"
808#ifdef UNICODE
809#define MDBX_DATANAME MDBX_DATANAME_W
810#else
811#define MDBX_DATANAME MDBX_DATANAME_A
812#endif /* UNICODE */
813#endif /* Windows */
814#endif /* MDBX_DATANAME */
815
816#ifndef MDBX_LOCK_SUFFIX
818#if !(defined(_WIN32) || defined(_WIN64))
819#define MDBX_LOCK_SUFFIX "-lck"
820#else
821#define MDBX_LOCK_SUFFIX_W L"-lck"
822#define MDBX_LOCK_SUFFIX_A "-lck"
823#ifdef UNICODE
824#define MDBX_LOCK_SUFFIX MDBX_LOCK_SUFFIX_W
825#else
826#define MDBX_LOCK_SUFFIX MDBX_LOCK_SUFFIX_A
827#endif /* UNICODE */
828#endif /* Windows */
829#endif /* MDBX_LOCK_SUFFIX */
830
831/* DEBUG & LOGGING ************************************************************/
832
840typedef enum MDBX_log_level {
845
851
857
863
868
873
878
883
884#ifdef ENABLE_UBSAN
885 MDBX_LOG_MAX = 7 /* avoid UBSAN false-positive trap by a tests */,
886#endif /* ENABLE_UBSAN */
887
891
897typedef enum MDBX_debug_flags {
899
904
908
912
916
919
922
927
928#ifdef ENABLE_UBSAN
929 MDBX_DBG_MAX = ((unsigned)MDBX_LOG_MAX) << 16 | 127 /* avoid UBSAN false-positive trap by a tests */,
930#endif /* ENABLE_UBSAN */
931
935DEFINE_ENUM_FLAG_OPERATORS(MDBX_debug_flags)
936
937
951typedef void MDBX_debug_func(MDBX_log_level_t loglevel, const char *function, int line, const char *fmt,
952 va_list args) MDBX_CXX17_NOEXCEPT;
953
955#define MDBX_LOGGER_DONTCHANGE ((MDBX_debug_func *)(intptr_t)-1)
956#define MDBX_LOGGER_NOFMT_DONTCHANGE ((MDBX_debug_func_nofmt *)(intptr_t)-1)
957
962
963typedef void MDBX_debug_func_nofmt(MDBX_log_level_t loglevel, const char *function, int line, const char *msg,
964 unsigned length) MDBX_CXX17_NOEXCEPT;
965
967 MDBX_debug_func_nofmt *logger, char *logger_buffer, size_t logger_buffer_size);
968
979typedef void MDBX_assert_func(const MDBX_env *env, const char *msg, const char *function,
980 unsigned line) MDBX_CXX17_NOEXCEPT;
981
992
1002LIBMDBX_API const char *mdbx_dump_val(const MDBX_val *key, char *const buf, const size_t bufsize);
1003
1005MDBX_NORETURN LIBMDBX_API void mdbx_panic(const char *fmt, ...) MDBX_PRINTF_ARGS(1, 2);
1006
1009MDBX_NORETURN LIBMDBX_API void mdbx_assert_fail(const MDBX_env *env, const char *msg, const char *func, unsigned line);
1016typedef enum MDBX_env_flags {
1018
1024 MDBX_VALIDATION = UINT32_C(0x00002000),
1025
1042 MDBX_NOSUBDIR = UINT32_C(0x4000),
1043
1060 MDBX_RDONLY = UINT32_C(0x20000),
1061
1090 MDBX_EXCLUSIVE = UINT32_C(0x400000),
1091
1105 MDBX_ACCEDE = UINT32_C(0x40000000),
1106
1136 MDBX_WRITEMAP = UINT32_C(0x80000),
1137
1207 MDBX_NOSTICKYTHREADS = UINT32_C(0x200000),
1208
1210 MDBX_NOTLS MDBX_DEPRECATED_ENUM = MDBX_NOSTICKYTHREADS,
1211
1231 MDBX_NORDAHEAD = UINT32_C(0x800000),
1232
1254 MDBX_NOMEMINIT = UINT32_C(0x1000000),
1255
1267 MDBX_COALESCE MDBX_DEPRECATED_ENUM = UINT32_C(0x2000000),
1268
1291 MDBX_LIFORECLAIM = UINT32_C(0x4000000),
1292
1294 MDBX_PAGEPERTURB = UINT32_C(0x8000000),
1295
1296 /* SYNC MODES****************************************************************/
1349
1366 MDBX_NOMETASYNC = UINT32_C(0x40000),
1367
1417 MDBX_SAFE_NOSYNC = UINT32_C(0x10000),
1418
1425
1468
1471DEFINE_ENUM_FLAG_OPERATORS(MDBX_env_flags)
1472
1473
1477typedef enum MDBX_txn_flags {
1483
1489
1496#if CONSTEXPR_ENUM_FLAGS_OPERATIONS || defined(DOXYGEN)
1498#else
1499 MDBX_TXN_RDONLY_PREPARE = uint32_t(MDBX_RDONLY) | uint32_t(MDBX_NOMEMINIT),
1500#endif
1501
1503 MDBX_TXN_TRY = UINT32_C(0x10000000),
1504
1508
1512
1513 /* Transaction state flags ---------------------------------------------- */
1514
1518 MDBX_TXN_INVALID = INT32_MIN,
1519
1524
1529
1534
1539
1544
1549
1556
1563
1569DEFINE_ENUM_FLAG_OPERATORS(MDBX_txn_flags)
1570
1571
1575typedef enum MDBX_db_flags {
1578
1580 MDBX_REVERSEKEY = UINT32_C(0x02),
1581
1583 MDBX_DUPSORT = UINT32_C(0x04),
1584
1590 MDBX_INTEGERKEY = UINT32_C(0x08),
1591
1594 MDBX_DUPFIXED = UINT32_C(0x10),
1595
1599 MDBX_INTEGERDUP = UINT32_C(0x20),
1600
1602 MDBX_REVERSEDUP = UINT32_C(0x40),
1603
1605 MDBX_CREATE = UINT32_C(0x40000),
1606
1619DEFINE_ENUM_FLAG_OPERATORS(MDBX_db_flags)
1620
1621
1625typedef enum MDBX_put_flags {
1628
1630 MDBX_NOOVERWRITE = UINT32_C(0x10),
1631
1634 MDBX_NODUPDATA = UINT32_C(0x20),
1635
1640 MDBX_CURRENT = UINT32_C(0x40),
1641
1645 MDBX_ALLDUPS = UINT32_C(0x80),
1646
1649 MDBX_RESERVE = UINT32_C(0x10000),
1650
1653 MDBX_APPEND = UINT32_C(0x20000),
1654
1658 MDBX_APPENDDUP = UINT32_C(0x40000),
1659
1662 MDBX_MULTIPLE = UINT32_C(0x80000)
1664DEFINE_ENUM_FLAG_OPERATORS(MDBX_put_flags)
1665
1666
1696DEFINE_ENUM_FLAG_OPERATORS(MDBX_copy_flags)
1697
1698
1815
1821typedef enum MDBX_error {
1824
1827
1830
1833
1836
1839
1842
1845
1848 MDBX_PANIC = -30795,
1849
1852
1855
1858
1861
1864
1867
1871
1874
1883
1893
1897
1902
1906
1910
1913
1916
1919 MDBX_BUSY = -30778,
1920
1923
1926
1931
1935
1938
1942
1946
1949
1955
1958
1962
1965 MDBX_OUSTED = -30411,
1966
1970
1971 /* The last of MDBX-added error codes */
1973
1974#if defined(_WIN32) || defined(_WIN64)
1975 MDBX_ENODATA = ERROR_HANDLE_EOF,
1976 MDBX_EINVAL = ERROR_INVALID_PARAMETER,
1977 MDBX_EACCESS = ERROR_ACCESS_DENIED,
1978 MDBX_ENOMEM = ERROR_OUTOFMEMORY,
1979 MDBX_EROFS = ERROR_FILE_READ_ONLY,
1980 MDBX_ENOSYS = ERROR_NOT_SUPPORTED,
1981 MDBX_EIO = ERROR_WRITE_FAULT,
1982 MDBX_EPERM = ERROR_INVALID_FUNCTION,
1983 MDBX_EINTR = ERROR_CANCELLED,
1984 MDBX_ENOFILE = ERROR_FILE_NOT_FOUND,
1985 MDBX_EREMOTE = ERROR_REMOTE_STORAGE_MEDIA_ERROR,
1986 MDBX_EDEADLK = ERROR_POSSIBLE_DEADLOCK
1987#else /* Windows */
1988#ifdef ENODATA
1989 MDBX_ENODATA = ENODATA,
1990#else
1991 MDBX_ENODATA = 9919 /* for compatibility with LLVM's C++ libraries/headers */,
1992#endif /* ENODATA */
1993 MDBX_EINVAL = EINVAL,
1995 MDBX_ENOMEM = ENOMEM,
1996 MDBX_EROFS = EROFS,
1997 MDBX_ENOSYS = ENOSYS,
1999 MDBX_EPERM = EPERM,
2000 MDBX_EINTR = EINTR,
2002 MDBX_EREMOTE = ENOTBLK,
2003 MDBX_EDEADLK = EDEADLK
2004#endif /* !Windows */
2006
2011MDBX_DEPRECATED static __inline int MDBX_MAP_RESIZED_is_deprecated(void) { return MDBX_UNABLE_EXTEND_MAPSIZE; }
2012#define MDBX_MAP_RESIZED MDBX_MAP_RESIZED_is_deprecated()
2013
2032LIBMDBX_API const char *mdbx_strerror(int errnum);
2033
2058LIBMDBX_API const char *mdbx_strerror_r(int errnum, char *buf, size_t buflen);
2060
2061#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
2066LIBMDBX_API const char *mdbx_strerror_ANSI2OEM(int errnum);
2067
2072LIBMDBX_API const char *mdbx_strerror_r_ANSI2OEM(int errnum, char *buf, size_t buflen);
2073#endif /* Bit of Windows' madness */
2074
2090
2394
2405LIBMDBX_API int mdbx_env_set_option(MDBX_env *env, const MDBX_option_t option, uint64_t value);
2406
2417LIBMDBX_API int mdbx_env_get_option(const MDBX_env *env, const MDBX_option_t option, uint64_t *pvalue);
2418
2491LIBMDBX_API int mdbx_env_open(MDBX_env *env, const char *pathname, MDBX_env_flags_t flags, mdbx_mode_t mode);
2492
2493#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
2497LIBMDBX_API int mdbx_env_openW(MDBX_env *env, const wchar_t *pathname, MDBX_env_flags_t flags, mdbx_mode_t mode);
2498#define mdbx_env_openT(env, pathname, flags, mode) mdbx_env_openW(env, pathname, flags, mode)
2499#else
2500#define mdbx_env_openT(env, pathname, flags, mode) mdbx_env_open(env, pathname, flags, mode)
2501#endif /* Windows */
2502
2521
2542
2543#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
2548LIBMDBX_API int mdbx_env_deleteW(const wchar_t *pathname, MDBX_env_delete_mode_t mode);
2549#define mdbx_env_deleteT(pathname, mode) mdbx_env_deleteW(pathname, mode)
2550#else
2551#define mdbx_env_deleteT(pathname, mode) mdbx_env_delete(pathname, mode)
2552#endif /* Windows */
2553
2607LIBMDBX_API int mdbx_env_copy(MDBX_env *env, const char *dest, MDBX_copy_flags_t flags);
2608
2663
2664#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
2669LIBMDBX_API int mdbx_env_copyW(MDBX_env *env, const wchar_t *dest, MDBX_copy_flags_t flags);
2670#define mdbx_env_copyT(env, dest, flags) mdbx_env_copyW(env, dest, flags)
2671
2677#define mdbx_txn_copy2pathnameT(txn, dest, flags) mdbx_txn_copy2pathnameW(txn, dest, path)
2678#else
2679#define mdbx_env_copyT(env, dest, flags) mdbx_env_copy(env, dest, flags)
2680#define mdbx_txn_copy2pathnameT(txn, dest, flags) mdbx_txn_copy2pathname(txn, dest, path)
2681#endif /* Windows */
2682
2708
2733
2738 uint32_t ms_psize;
2740 uint32_t ms_depth;
2742 uint64_t ms_leaf_pages;
2744 uint64_t ms_entries;
2745 uint64_t ms_mod_txnid;
2746};
2747#ifndef __cplusplus
2749typedef struct MDBX_stat MDBX_stat;
2750#endif
2751
2771LIBMDBX_API int mdbx_env_stat_ex(const MDBX_env *env, const MDBX_txn *txn, MDBX_stat *stat, size_t bytes);
2772
2776MDBX_DEPRECATED inline int mdbx_env_stat(const MDBX_env *env, MDBX_stat *stat, size_t bytes) {
2777 return mdbx_env_stat_ex(env, NULL, stat, bytes);
2778}
2779
2784 struct {
2785 uint64_t lower;
2786 uint64_t upper;
2787 uint64_t current;
2788 uint64_t shrink;
2789 uint64_t grow;
2791 uint64_t mi_mapsize;
2792 uint64_t mi_last_pgno;
2798 uint32_t mi_maxreaders;
2799 uint32_t mi_numreaders;
2811 struct {
2812 struct {
2813 uint64_t x, y;
2814 } current, meta[3];
2816
2833 uint32_t mi_mode;
2834
2840 struct {
2841 uint64_t newly;
2842 uint64_t cow;
2843 uint64_t clone;
2845 uint64_t split;
2846 uint64_t merge;
2847 uint64_t spill;
2848 uint64_t unspill;
2849 uint64_t wops;
2851 uint64_t prefault;
2852 uint64_t mincore;
2853 uint64_t msync;
2854 uint64_t fsync;
2856
2857 /* GUID of the database DXB file. */
2858 struct {
2859 uint64_t x, y;
2861};
2862#ifndef __cplusplus
2864typedef struct MDBX_envinfo MDBX_envinfo;
2865#endif
2866
2887LIBMDBX_API int mdbx_env_info_ex(const MDBX_env *env, const MDBX_txn *txn, MDBX_envinfo *info, size_t bytes);
2891MDBX_DEPRECATED inline int mdbx_env_info(const MDBX_env *env, MDBX_envinfo *info, size_t bytes) {
2892 return mdbx_env_info_ex(env, NULL, info, bytes);
2893}
2894
2931LIBMDBX_API int mdbx_env_sync_ex(MDBX_env *env, bool force, bool nonblock);
2932
2936inline int mdbx_env_sync(MDBX_env * env) { return mdbx_env_sync_ex(env, true, false); }
2937
2941inline int mdbx_env_sync_poll(MDBX_env * env) { return mdbx_env_sync_ex(env, false, true); }
2942
2966inline int mdbx_env_set_syncbytes(MDBX_env * env, size_t threshold) {
2967 return mdbx_env_set_option(env, MDBX_opt_sync_bytes, threshold);
2968}
2969
2984inline int mdbx_env_get_syncbytes(const MDBX_env *env, size_t *threshold) {
2985 int rc = MDBX_EINVAL;
2986 if (threshold) {
2987 uint64_t proxy = 0;
2988 rc = mdbx_env_get_option(env, MDBX_opt_sync_bytes, &proxy);
2989#ifdef assert
2990 assert(proxy <= SIZE_MAX);
2991#endif /* assert */
2992 *threshold = (size_t)proxy;
2993 }
2994 return rc;
2995}
2996
3027inline int mdbx_env_set_syncperiod(MDBX_env * env, unsigned seconds_16dot16) {
3028 return mdbx_env_set_option(env, MDBX_opt_sync_period, seconds_16dot16);
3029}
3030
3047inline int mdbx_env_get_syncperiod(const MDBX_env *env, unsigned *period_seconds_16dot16) {
3048 int rc = MDBX_EINVAL;
3049 if (period_seconds_16dot16) {
3050 uint64_t proxy = 0;
3051 rc = mdbx_env_get_option(env, MDBX_opt_sync_period, &proxy);
3052#ifdef assert
3053 assert(proxy <= UINT32_MAX);
3054#endif /* assert */
3055 *period_seconds_16dot16 = (unsigned)proxy;
3056 }
3057 return rc;
3058}
3059
3099LIBMDBX_API int mdbx_env_close_ex(MDBX_env *env, bool dont_sync);
3100
3104inline int mdbx_env_close(MDBX_env * env) { return mdbx_env_close_ex(env, false); }
3105
3106#if defined(DOXYGEN) || !(defined(_WIN32) || defined(_WIN64))
3184#endif /* Windows */
3185
3234DEFINE_ENUM_FLAG_OPERATORS(MDBX_warmup_flags)
3235
3236
3268 unsigned timeout_seconds_16dot16);
3269
3291
3302LIBMDBX_API int mdbx_env_get_flags(const MDBX_env *env, unsigned *flags);
3303
3317LIBMDBX_API int mdbx_env_get_path(const MDBX_env *env, const char **dest);
3318
3319#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
3324LIBMDBX_API int mdbx_env_get_pathW(const MDBX_env *env, const wchar_t **dest);
3325#define mdbx_env_get_pathT(env, dest) mdbx_env_get_pathW(env, dest)
3326#else
3327#define mdbx_env_get_pathT(env, dest) mdbx_env_get_path(env, dest)
3328#endif /* Windows */
3329
3343
3540LIBMDBX_API int mdbx_env_set_geometry(MDBX_env *env, intptr_t size_lower, intptr_t size_now, intptr_t size_upper,
3541 intptr_t growth_step, intptr_t shrink_threshold, intptr_t pagesize);
3542
3545MDBX_DEPRECATED inline int mdbx_env_set_mapsize(MDBX_env * env, size_t size) {
3546 return mdbx_env_set_geometry(env, size, size, size, -1, -1, -1);
3547}
3548
3564LIBMDBX_API int mdbx_is_readahead_reasonable(size_t volume, intptr_t redundancy);
3565
3569
3573
3578
3583
3589
3594
3600
3605
3611 MDBX_db_flags_t flags);
3612
3619
3624
3648inline int mdbx_env_set_maxreaders(MDBX_env * env, unsigned readers) {
3649 return mdbx_env_set_option(env, MDBX_opt_max_readers, readers);
3650}
3651
3663inline int mdbx_env_get_maxreaders(const MDBX_env *env, unsigned *readers) {
3664 int rc = MDBX_EINVAL;
3665 if (readers) {
3666 uint64_t proxy = 0;
3667 rc = mdbx_env_get_option(env, MDBX_opt_max_readers, &proxy);
3668 *readers = (unsigned)proxy;
3669 }
3670 return rc;
3671}
3672
3694inline int mdbx_env_set_maxdbs(MDBX_env * env, MDBX_dbi dbs) {
3695 return mdbx_env_set_option(env, MDBX_opt_max_db, dbs);
3696}
3697
3708inline int mdbx_env_get_maxdbs(const MDBX_env *env, MDBX_dbi *dbs) {
3709 int rc = MDBX_EINVAL;
3710 if (dbs) {
3711 uint64_t proxy = 0;
3712 rc = mdbx_env_get_option(env, MDBX_opt_max_db, &proxy);
3713 *dbs = (MDBX_dbi)proxy;
3714 }
3715 return rc;
3716}
3717
3723
3738LIBMDBX_API int mdbx_get_sysraminfo(intptr_t *page_size, intptr_t *total_pages, intptr_t *avail_pages);
3739
3750
3761
3766
3778
3790
3801
3811
3872 void *context);
3873
3928inline int mdbx_txn_begin(MDBX_env * env, MDBX_txn *parent, MDBX_txn_flags_t flags, MDBX_txn **txn) {
3929 return mdbx_txn_begin_ex(env, parent, flags, txn, NULL);
3930}
3931
3943
3955
3962 uint64_t txn_id;
3963
3969
3973
3976
3980
3988
3995
4002};
4003#ifndef __cplusplus
4005typedef struct MDBX_txn_info MDBX_txn_info;
4006#endif
4007
4021LIBMDBX_API int mdbx_txn_info(const MDBX_txn *txn, MDBX_txn_info *info, bool scan_rlt);
4022
4028
4039
4052
4060 uint32_t preparation;
4064 uint32_t audit;
4067 uint32_t write;
4070 uint32_t sync;
4072 uint32_t ending;
4074 uint32_t whole;
4076 uint32_t gc_cputime;
4077
4085 struct {
4088 uint32_t wloops;
4090 uint32_t coalescences;
4093 uint32_t wipes;
4097 uint32_t flushes;
4101 uint32_t kicks;
4102
4105 uint32_t work_counter;
4108 uint32_t work_rtime_monotonic;
4112 uint32_t work_xtime_cpu;
4115 uint32_t work_rsteps;
4118 uint32_t work_xpages;
4121 uint32_t work_majflt;
4122
4125 uint32_t self_counter;
4128 uint32_t self_rtime_monotonic;
4132 uint32_t self_xtime_cpu;
4135 uint32_t self_rsteps;
4138 uint32_t self_xpages;
4141 uint32_t self_majflt;
4142 /* Для разборок с pnl_merge() */
4143 struct {
4144 uint32_t time;
4145 uint64_t volume;
4146 uint32_t calls;
4147 } pnl_merge_work, pnl_merge_self;
4149};
4150#ifndef __cplusplus
4153#endif
4154
4161
4200inline int mdbx_txn_commit(MDBX_txn * txn) { return mdbx_txn_commit_ex(txn, NULL); }
4201
4236
4249
4284
4328LIBMDBX_API int mdbx_txn_park(MDBX_txn *txn, bool autounpark);
4329
4371LIBMDBX_API int mdbx_txn_unpark(MDBX_txn *txn, bool restart_if_ousted);
4372
4394
4406 uint64_t x, y, z, v;
4407};
4408#ifndef __cplusplus
4410typedef struct MDBX_canary MDBX_canary;
4411#endif
4412
4432
4444
4465typedef int(MDBX_cmp_func)(const MDBX_val *a, const MDBX_val *b) MDBX_CXX17_NOEXCEPT;
4466
4556LIBMDBX_API int mdbx_dbi_open(MDBX_txn *txn, const char *name, MDBX_db_flags_t flags, MDBX_dbi *dbi);
4560
4577MDBX_DEPRECATED LIBMDBX_API int mdbx_dbi_open_ex(MDBX_txn *txn, const char *name, MDBX_db_flags_t flags, MDBX_dbi *dbi,
4578 MDBX_cmp_func *keycmp, MDBX_cmp_func *datacmp);
4581MDBX_DEPRECATED LIBMDBX_API int mdbx_dbi_open_ex2(MDBX_txn *txn, const MDBX_val *name, MDBX_db_flags_t flags,
4582 MDBX_dbi *dbi, MDBX_cmp_func *keycmp, MDBX_cmp_func *datacmp);
4583
4599LIBMDBX_API int mdbx_dbi_rename(MDBX_txn *txn, MDBX_dbi dbi, const char *name);
4603
4623typedef int(MDBX_table_enum_func)(void *ctx, const MDBX_txn *txn, const MDBX_val *name, MDBX_db_flags_t flags,
4624 const struct MDBX_stat *stat, MDBX_dbi dbi) MDBX_CXX17_NOEXCEPT;
4625
4647
4660
4662
4663MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API uint64_t mdbx_key_from_ptrdouble(const double *const ieee754_64bit);
4664
4666
4667MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API uint32_t mdbx_key_from_ptrfloat(const float *const ieee754_32bit);
4668
4669MDBX_NOTHROW_CONST_FUNCTION inline uint64_t mdbx_key_from_int64(const int64_t i64) {
4670 return UINT64_C(0x8000000000000000) + i64;
4671}
4672
4673MDBX_NOTHROW_CONST_FUNCTION inline uint32_t mdbx_key_from_int32(const int32_t i32) {
4674 return UINT32_C(0x80000000) + i32;
4675}
4684
4686
4688
4690
4708LIBMDBX_API int mdbx_dbi_stat(const MDBX_txn *txn, MDBX_dbi dbi, MDBX_stat *stat, size_t bytes);
4709
4725LIBMDBX_API int mdbx_dbi_dupsort_depthmask(const MDBX_txn *txn, MDBX_dbi dbi, uint32_t *mask);
4726
4730typedef enum MDBX_dbi_state {
4740DEFINE_ENUM_FLAG_OPERATORS(MDBX_dbi_state)
4741
4742
4753LIBMDBX_API int mdbx_dbi_flags_ex(const MDBX_txn *txn, MDBX_dbi dbi, unsigned *flags, unsigned *state);
4758inline int mdbx_dbi_flags(const MDBX_txn *txn, MDBX_dbi dbi, unsigned *flags) {
4759 unsigned state;
4760 return mdbx_dbi_flags_ex(txn, dbi, flags, &state);
4761}
4762
4789
4801LIBMDBX_API int mdbx_drop(MDBX_txn *txn, MDBX_dbi dbi, bool del);
4802
4837LIBMDBX_API int mdbx_get(const MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *key, MDBX_val *data);
4838
4869LIBMDBX_API int mdbx_get_ex(const MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key, MDBX_val *data, size_t *values_count);
4870
4900
4982LIBMDBX_API int mdbx_put(MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *key, MDBX_val *data, MDBX_put_flags_t flags);
4983
5027LIBMDBX_API int mdbx_replace(MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *key, MDBX_val *new_data, MDBX_val *old_data,
5028 MDBX_put_flags_t flags);
5029
5030typedef int (*MDBX_preserve_func)(void *context, MDBX_val *target, const void *src, size_t bytes);
5031LIBMDBX_API int mdbx_replace_ex(MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *key, MDBX_val *new_data,
5032 MDBX_val *old_data, MDBX_put_flags_t flags, MDBX_preserve_func preserver,
5033 void *preserver_context);
5034
5060LIBMDBX_API int mdbx_del(MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *key, const MDBX_val *data);
5061
5085
5096
5107
5134
5157
5171
5203
5219
5240
5266
5272
5278
5290
5312LIBMDBX_API int mdbx_cursor_compare(const MDBX_cursor *left, const MDBX_cursor *right, bool ignore_multival);
5313
5346
5361
5391typedef int(MDBX_predicate_func)(void *context, MDBX_val *key, MDBX_val *value, void *arg) MDBX_CXX17_NOEXCEPT;
5392
5461LIBMDBX_API int mdbx_cursor_scan(MDBX_cursor *cursor, MDBX_predicate_func *predicate, void *context,
5462 MDBX_cursor_op start_op, MDBX_cursor_op turn_op, void *arg);
5463
5549 MDBX_cursor_op from_op, MDBX_val *from_key, MDBX_val *from_value,
5550 MDBX_cursor_op turn_op, void *arg);
5551
5593LIBMDBX_API int mdbx_cursor_get_batch(MDBX_cursor *cursor, size_t *count, MDBX_val *pairs, size_t limit,
5594 MDBX_cursor_op op);
5595
5677
5709
5727LIBMDBX_API int mdbx_cursor_count(const MDBX_cursor *cursor, size_t *count);
5728
5751LIBMDBX_API int mdbx_cursor_count_ex(const MDBX_cursor *cursor, size_t *count, MDBX_stat *stat, size_t bytes);
5752
5766
5779
5792
5805
5818
5863LIBMDBX_API int mdbx_estimate_distance(const MDBX_cursor *first, const MDBX_cursor *last, ptrdiff_t *distance_items);
5864
5886 ptrdiff_t *distance_items);
5887
5912LIBMDBX_API int mdbx_estimate_range(const MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *begin_key,
5913 const MDBX_val *begin_data, const MDBX_val *end_key, const MDBX_val *end_data,
5914 ptrdiff_t *distance_items);
5915
5918#define MDBX_EPSILON ((MDBX_val *)((ptrdiff_t)-1))
5919
5954
5976LIBMDBX_API int mdbx_dbi_sequence(MDBX_txn *txn, MDBX_dbi dbi, uint64_t *result, uint64_t increment);
5977
5994 const MDBX_val *b);
5995
5999
6016 const MDBX_val *b);
6017
6021
6047typedef int(MDBX_reader_list_func)(void *ctx, int num, int slot, mdbx_pid_t pid, mdbx_tid_t thread, uint64_t txnid,
6048 uint64_t lag, size_t bytes_used, size_t bytes_retained) MDBX_CXX17_NOEXCEPT;
6049
6062
6072
6085MDBX_DEPRECATED LIBMDBX_API int mdbx_txn_straggler(const MDBX_txn *txn, int *percent);
6086
6106
6121
6195typedef int(MDBX_hsr_func)(const MDBX_env *env, const MDBX_txn *txn, mdbx_pid_t pid, mdbx_tid_t tid, uint64_t laggard,
6196 unsigned gap, size_t space, int retry) MDBX_CXX17_NOEXCEPT;
6197
6217
6231
6241LIBMDBX_API int mdbx_txn_lock(MDBX_env *env, bool dont_wait);
6242
6247
6257LIBMDBX_API int mdbx_env_open_for_recovery(MDBX_env *env, const char *pathname, unsigned target_meta, bool writeable);
6258
6259#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
6264LIBMDBX_API int mdbx_env_open_for_recoveryW(MDBX_env *env, const wchar_t *pathname, unsigned target_meta,
6265 bool writeable);
6266#define mdbx_env_open_for_recoveryT(env, pathname, target_mets, writeable) \
6267 mdbx_env_open_for_recoveryW(env, pathname, target_mets, writeable)
6268#else
6269#define mdbx_env_open_for_recoveryT(env, pathname, target_mets, writeable) \
6270 mdbx_env_open_for_recovery(env, pathname, target_mets, writeable)
6271#endif /* Windows */
6272
6278LIBMDBX_API int mdbx_env_turn_for_recovery(MDBX_env *env, unsigned target_meta);
6279
6311LIBMDBX_API int mdbx_preopen_snapinfo(const char *pathname, MDBX_envinfo *info, size_t bytes);
6312#if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
6317LIBMDBX_API int mdbx_preopen_snapinfoW(const wchar_t *pathname, MDBX_envinfo *info, size_t bytes);
6318#define mdbx_preopen_snapinfoT(pathname, info, bytes) mdbx_preopen_snapinfoW(pathname, info, bytes)
6319#else
6320#define mdbx_preopen_snapinfoT(pathname, info, bytes) mdbx_preopen_snapinfo(pathname, info, bytes)
6321#endif /* Windows */
6322
6346DEFINE_ENUM_FLAG_OPERATORS(MDBX_chk_flags)
6347
6348
6366
6384
6387typedef struct MDBX_chk_line {
6388 struct MDBX_chk_context *ctx;
6389 uint8_t severity, scope_depth, empty;
6390 char *begin, *end, *out;
6392
6395typedef struct MDBX_chk_issue {
6396 struct MDBX_chk_issue *next;
6397 size_t count;
6398 const char *caption;
6400
6403typedef struct MDBX_chk_scope {
6405 struct MDBX_chk_internal *internal;
6406 const void *object;
6410 union {
6411 void *ptr;
6412 size_t number;
6413 } usr_z, usr_v, usr_o;
6415
6419typedef struct MDBX_chk_user_table_cookie MDBX_chk_user_table_cookie_t;
6420
6426 struct {
6427 size_t begin, end, amount, count;
6429};
6430
6434typedef struct MDBX_chk_table {
6436
6438#define MDBX_CHK_MAIN ((void *)((ptrdiff_t)0))
6440#define MDBX_CHK_GC ((void *)((ptrdiff_t)-1))
6442#define MDBX_CHK_META ((void *)((ptrdiff_t)-2))
6443
6446 int id;
6447
6448 size_t payload_bytes, lost_bytes;
6449 struct {
6450 size_t all, empty, other;
6451 size_t branch, leaf;
6452 size_t nested_branch, nested_leaf, nested_subleaf;
6453 } pages;
6454 struct {
6456 struct MDBX_chk_histogram deep;
6458 struct MDBX_chk_histogram large_pages;
6460 struct MDBX_chk_histogram nested_tree;
6462 struct MDBX_chk_histogram key_len;
6464 struct MDBX_chk_histogram val_len;
6465 } histogram;
6467
6470typedef struct MDBX_chk_context {
6471 struct MDBX_chk_internal *internal;
6476 struct {
6477 size_t total_payload_bytes;
6478 size_t table_total, table_processed;
6479 size_t total_unused_bytes, unused_pages;
6480 size_t processed_pages, reclaimable_pages, gc_pages, alloc_pages, backed_pages;
6481 size_t problems_meta, tree_problems, gc_tree_problems, kv_tree_problems, problems_gc, problems_kv, total_problems;
6482 uint64_t steady_txnid, recent_txnid;
6486 const MDBX_chk_table_t *const *tables;
6487 } result;
6489
6505typedef struct MDBX_chk_callbacks {
6506 bool (*check_break)(MDBX_chk_context_t *ctx);
6507 int (*scope_push)(MDBX_chk_context_t *ctx, MDBX_chk_scope_t *outer, MDBX_chk_scope_t *inner, const char *fmt,
6508 va_list args);
6509 int (*scope_conclude)(MDBX_chk_context_t *ctx, MDBX_chk_scope_t *outer, MDBX_chk_scope_t *inner, int err);
6510 void (*scope_pop)(MDBX_chk_context_t *ctx, MDBX_chk_scope_t *outer, MDBX_chk_scope_t *inner);
6511 void (*issue)(MDBX_chk_context_t *ctx, const char *object, uint64_t entry_number, const char *issue,
6512 const char *extra_fmt, va_list extra_args);
6514 int (*table_conclude)(MDBX_chk_context_t *ctx, const MDBX_chk_table_t *table, MDBX_cursor *cursor, int err);
6515 void (*table_dispose)(MDBX_chk_context_t *ctx, const MDBX_chk_table_t *table);
6516
6517 int (*table_handle_kv)(MDBX_chk_context_t *ctx, const MDBX_chk_table_t *table, size_t entry_number,
6518 const MDBX_val *key, const MDBX_val *value);
6519
6520 int (*stage_begin)(MDBX_chk_context_t *ctx, MDBX_chk_stage_t);
6521 int (*stage_end)(MDBX_chk_context_t *ctx, MDBX_chk_stage_t, int err);
6522
6524 void (*print_flush)(MDBX_chk_line_t *);
6525 void (*print_done)(MDBX_chk_line_t *);
6526 void (*print_chars)(MDBX_chk_line_t *, const char *str, size_t len);
6527 void (*print_format)(MDBX_chk_line_t *, const char *fmt, va_list args);
6528 void (*print_size)(MDBX_chk_line_t *, const char *prefix, const uint64_t value, const char *suffix);
6530
6561 const MDBX_chk_flags_t flags, MDBX_chk_severity_t verbosity,
6562 unsigned timeout_seconds_16dot16);
6563
6570
6575#ifdef __cplusplus
6576} /* extern "C" */
6577#endif
6578
6579#endif /* LIBMDBX_H */
#define MDBX_NOTHROW_CONST_FUNCTION
The 'const nothrow' function attribute for optimization.
Definition mdbx.h:300
#define MDBX_CXX17_NOEXCEPT
Definition mdbx.h:414
#define MDBX_NOTHROW_PURE_FUNCTION
The 'pure nothrow' function attribute for optimization.
Definition mdbx.h:259
#define MDBX_NORETURN
Definition mdbx.h:484
uint64_t mi_mapsize
Definition mdbx.h:2791
uint64_t txn_space_dirty
Definition mdbx.h:4001
uint32_t gc_cputime
User-mode CPU time spent on GC update.
Definition mdbx.h:4076
uint32_t mi_dxb_pagesize
Definition mdbx.h:2800
uint32_t mi_maxreaders
Definition mdbx.h:2798
uint64_t v
Definition mdbx.h:4406
uint32_t mi_numreaders
Definition mdbx.h:2799
struct MDBX_envinfo::@3 mi_pgop_stat
uint16_t patch
Definition mdbx.h:618
const char * metadata
Definition mdbx.h:639
uint32_t mi_since_sync_seconds16dot16
Definition mdbx.h:2824
uint16_t major
Definition mdbx.h:616
uint64_t txn_reader_lag
Definition mdbx.h:3968
uint64_t mi_meta_txnid[3]
Definition mdbx.h:2797
struct MDBX_envinfo::@2 mi_bootid
A mostly unique ID that is regenerated on each boot.
uint64_t txn_space_leftover
Definition mdbx.h:3994
uint64_t txn_space_used
Definition mdbx.h:3972
const char * datetime
Definition mdbx.h:634
uint64_t mi_recent_txnid
Definition mdbx.h:2793
uint64_t mi_autosync_threshold
Definition mdbx.h:2820
const char * semver_prerelease
Definition mdbx.h:620
uint64_t ms_branch_pages
Definition mdbx.h:2741
uint64_t ms_entries
Definition mdbx.h:2744
uint32_t gc_wallclock
Duration of GC update by wall clock.
Definition mdbx.h:4062
uint16_t minor
Definition mdbx.h:617
struct MDBX_commit_latency::@6 gc_prof
Информация для профилирования работы GC.
uint32_t mi_since_reader_check_seconds16dot16
Definition mdbx.h:2830
uint64_t y
Definition mdbx.h:4406
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:4070
uint64_t txn_space_limit_soft
Definition mdbx.h:3975
uint32_t mi_mode
Definition mdbx.h:2833
const char * options
Definition mdbx.h:636
uint64_t txn_id
Definition mdbx.h:3962
const char * sourcery
Definition mdbx.h:627
uint64_t mi_latter_reader_txnid
Definition mdbx.h:2794
struct MDBX_envinfo::@1 mi_geo
uint64_t ms_overflow_pages
Definition mdbx.h:2743
uint32_t preparation
Duration of preparation (commit child transactions, update table's records and cursors destroying).
Definition mdbx.h:4060
uint64_t z
Definition mdbx.h:4406
uint64_t txn_space_limit_hard
Definition mdbx.h:3979
uint32_t whole
The total duration of a commit.
Definition mdbx.h:4074
const char * flags
Definition mdbx.h:638
uint64_t mi_meta_sign[3]
Definition mdbx.h:2797
uint32_t ms_psize
Definition mdbx.h:2738
uint32_t audit
Duration of internal audit if enabled.
Definition mdbx.h:4064
uint16_t tweak
Definition mdbx.h:619
const char * target
Definition mdbx.h:635
uint32_t write
Duration of writing dirty/modified data pages to a filesystem, i.e. the summary duration of a write()...
Definition mdbx.h:4067
uint64_t txn_space_retired
Definition mdbx.h:3987
uint32_t ms_depth
Definition mdbx.h:2740
struct MDBX_version_info::@0 git
uint64_t mi_last_pgno
Definition mdbx.h:2792
uint32_t ending
Duration of transaction ending (releasing resources).
Definition mdbx.h:4072
uint64_t ms_mod_txnid
Definition mdbx.h:2745
uint64_t mi_self_latter_reader_txnid
Definition mdbx.h:2795
uint64_t ms_leaf_pages
Definition mdbx.h:2742
uint64_t x
Definition mdbx.h:4406
uint32_t mi_autosync_period_seconds16dot16
Definition mdbx.h:2827
uint64_t mi_unsync_volume
Definition mdbx.h:2818
uint32_t mi_sys_pagesize
Definition mdbx.h:2801
struct MDBX_envinfo::@4 mi_dxbid
const char * compiler
Definition mdbx.h:637
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:768
mode_t mdbx_mode_t
Definition mdbx.h:174
int(* MDBX_preserve_func)(void *context, MDBX_val *target, const void *src, size_t bytes)
Definition mdbx.h:5030
#define LIBMDBX_API
Definition mdbx.h:590
struct iovec MDBX_val
Generic structure used for passing keys and data in and out of the table. .
Definition mdbx.h:765
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)
LIBMDBX_VERINFO_API const struct MDBX_version_info mdbx_version
libmdbx version information
pthread_t mdbx_tid_t
Definition mdbx.h:173
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:697
int mdbx_filehandle_t
Definition mdbx.h:171
LIBMDBX_API const char * mdbx_liberr2str(int errnum)
pid_t mdbx_pid_t
Definition mdbx.h:172
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:611
@ MDBX_MAX_PAGESIZE
Definition mdbx.h:779
@ MDBX_MAXDATASIZE
Definition mdbx.h:773
@ MDBX_MAX_DBI
Definition mdbx.h:770
@ MDBX_MIN_PAGESIZE
Definition mdbx.h:776
libmdbx build information
Definition mdbx.h:633
The fours integers markers (aka "canary") associated with the environment.
Definition mdbx.h:4405
Latency of commit stages in 1/65536 of seconds units.
Definition mdbx.h:4057
Information about the environment.
Definition mdbx.h:2783
Statistics for a table in the environment.
Definition mdbx.h:2737
Information about the transaction.
Definition mdbx.h:3959
libmdbx version information,
Definition mdbx.h:615
LIBMDBX_API int mdbx_cursor_del(MDBX_cursor *cursor, MDBX_put_flags_t flags)
Delete current key/data pair.
LIBMDBX_API int mdbx_dbi_sequence(MDBX_txn *txn, MDBX_dbi dbi, uint64_t *result, uint64_t increment)
Sequence generation for a table.
LIBMDBX_API int mdbx_get_equal_or_great(const MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key, MDBX_val *data)
Get equal or great item from a table.
LIBMDBX_API int mdbx_cursor_scan(MDBX_cursor *cursor, MDBX_predicate_func *predicate, void *context, MDBX_cursor_op start_op, MDBX_cursor_op turn_op, void *arg)
Сканирует таблицу с использованием передаваемого предиката, с уменьшением сопутствующих накладных рас...
LIBMDBX_API int mdbx_canary_put(MDBX_txn *txn, const MDBX_canary *canary)
Set integers markers (aka "canary") associated with the environment.
LIBMDBX_API int mdbx_canary_get(const MDBX_txn *txn, MDBX_canary *canary)
Returns fours integers markers (aka "canary") associated with the environment.
MDBX_put_flags_t
Data changing flags.
Definition mdbx.h:1625
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.
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.
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:4465
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)
Replace items 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:5391
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_MULTIPLE
Definition mdbx.h:1662
@ MDBX_ALLDUPS
Definition mdbx.h:1645
@ MDBX_CURRENT
Definition mdbx.h:1640
@ MDBX_APPENDDUP
Definition mdbx.h:1658
@ MDBX_NODUPDATA
Definition mdbx.h:1634
@ MDBX_APPEND
Definition mdbx.h:1653
@ MDBX_UPSERT
Definition mdbx.h:1627
@ MDBX_RESERVE
Definition mdbx.h:1649
@ MDBX_NOOVERWRITE
Definition mdbx.h:1630
LIBMDBX_API int mdbx_cursor_on_first_dup(const MDBX_cursor *cursor)
Определяет стоит ли курсор на первом или единственном мульти-значении соответствующем ключу.
LIBMDBX_API int mdbx_cursor_renew(const MDBX_txn *txn, MDBX_cursor *cursor)
Renew a cursor handle for use within the given transaction.
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:1702
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_reset(MDBX_cursor *cursor)
Сбрасывает состояние курсора.
struct MDBX_cursor MDBX_cursor
Opaque structure for navigating through a table.
Definition mdbx.h:727
LIBMDBX_API int mdbx_cursor_set_userctx(MDBX_cursor *cursor, void *ctx)
Set application information associated with the cursor.
LIBMDBX_API int mdbx_cursor_open(const 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_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_bind(const MDBX_txn *txn, MDBX_cursor *cursor, MDBX_dbi dbi)
Bind cursor to specified transaction and DBI-handle.
LIBMDBX_API void * mdbx_cursor_get_userctx(const MDBX_cursor *cursor)
Get the application information associated with the MDBX_cursor.
LIBMDBX_API void mdbx_cursor_close(MDBX_cursor *cursor)
Close a cursor handle.
LIBMDBX_API MDBX_txn * mdbx_cursor_txn(const MDBX_cursor *cursor)
Return the cursor's transaction handle.
LIBMDBX_API int mdbx_txn_release_all_cursors(const MDBX_txn *txn, bool unbind)
Unbind or closes all cursors of a given transaction.
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:1778
@ MDBX_GET_CURRENT
Definition mdbx.h:1717
@ MDBX_GET_BOTH
Definition mdbx.h:1710
@ MDBX_TO_KEY_EQUAL
Definition mdbx.h:1797
@ MDBX_GET_BOTH_RANGE
Definition mdbx.h:1714
@ MDBX_SET_KEY
Definition mdbx.h:1757
@ MDBX_FIRST_DUP
Definition mdbx.h:1707
@ MDBX_TO_KEY_LESSER_OR_EQUAL
Definition mdbx.h:1796
@ MDBX_GET_MULTIPLE
Definition mdbx.h:1722
@ MDBX_TO_EXACT_KEY_VALUE_GREATER_THAN
Definition mdbx.h:1807
@ MDBX_NEXT_NODUP
Definition mdbx.h:1742
@ MDBX_TO_EXACT_KEY_VALUE_LESSER_OR_EQUAL
Definition mdbx.h:1804
@ MDBX_TO_EXACT_KEY_VALUE_EQUAL
Definition mdbx.h:1805
@ MDBX_TO_PAIR_LESSER_OR_EQUAL
Definition mdbx.h:1810
@ MDBX_PREV_MULTIPLE
Definition mdbx.h:1764
@ MDBX_SET_RANGE
Definition mdbx.h:1760
@ MDBX_LAST_DUP
Definition mdbx.h:1728
@ MDBX_PREV
Definition mdbx.h:1745
@ MDBX_TO_PAIR_GREATER_OR_EQUAL
Definition mdbx.h:1812
@ MDBX_TO_PAIR_GREATER_THAN
Definition mdbx.h:1813
@ MDBX_LAST
Definition mdbx.h:1725
@ MDBX_TO_KEY_LESSER_THAN
Definition mdbx.h:1795
@ MDBX_PREV_DUP
Definition mdbx.h:1748
@ MDBX_TO_EXACT_KEY_VALUE_LESSER_THAN
Definition mdbx.h:1803
@ MDBX_SET
Definition mdbx.h:1754
@ MDBX_NEXT
Definition mdbx.h:1731
@ MDBX_TO_KEY_GREATER_OR_EQUAL
Definition mdbx.h:1798
@ MDBX_TO_PAIR_LESSER_THAN
Definition mdbx.h:1809
@ MDBX_NEXT_MULTIPLE
Definition mdbx.h:1739
@ MDBX_PREV_NODUP
Definition mdbx.h:1751
@ MDBX_TO_PAIR_EQUAL
Definition mdbx.h:1811
@ MDBX_NEXT_DUP
Definition mdbx.h:1734
@ MDBX_TO_EXACT_KEY_VALUE_GREATER_OR_EQUAL
Definition mdbx.h:1806
@ MDBX_SET_UPPERBOUND
Definition mdbx.h:1792
@ MDBX_TO_KEY_GREATER_THAN
Definition mdbx.h:1799
@ MDBX_FIRST
Definition mdbx.h:1704
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:720
MDBX_db_flags_t
Table flags.
Definition mdbx.h:1575
@ MDBX_INTEGERDUP
Definition mdbx.h:1599
@ MDBX_DB_ACCEDE
Definition mdbx.h:1617
@ MDBX_DB_DEFAULTS
Definition mdbx.h:1577
@ MDBX_REVERSEKEY
Definition mdbx.h:1580
@ MDBX_DUPFIXED
Definition mdbx.h:1594
@ MDBX_INTEGERKEY
Definition mdbx.h:1590
@ MDBX_REVERSEDUP
Definition mdbx.h:1602
@ MDBX_CREATE
Definition mdbx.h:1605
@ MDBX_DUPSORT
Definition mdbx.h:1583
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:963
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:979
MDBX_log_level_t
Definition mdbx.h:840
MDBX_debug_flags_t
Runtime debug flags.
Definition mdbx.h:897
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:951
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:882
@ MDBX_LOG_WARN
Definition mdbx.h:856
@ MDBX_LOG_TRACE
Definition mdbx.h:877
@ MDBX_LOG_DEBUG
Definition mdbx.h:872
@ MDBX_LOG_FATAL
Definition mdbx.h:844
@ MDBX_LOG_ERROR
Definition mdbx.h:850
@ MDBX_LOG_NOTICE
Definition mdbx.h:862
@ MDBX_LOG_DONTCHANGE
Definition mdbx.h:889
@ MDBX_LOG_VERBOSE
Definition mdbx.h:867
@ MDBX_DBG_ASSERT
Definition mdbx.h:903
@ MDBX_DBG_DONT_UPGRADE
Definition mdbx.h:926
@ MDBX_DBG_LEGACY_OVERLAP
Definition mdbx.h:921
@ MDBX_DBG_LEGACY_MULTIOPEN
Definition mdbx.h:918
@ MDBX_DBG_NONE
Definition mdbx.h:898
@ MDBX_DBG_DUMP
Definition mdbx.h:915
@ MDBX_DBG_DONTCHANGE
Definition mdbx.h:933
@ MDBX_DBG_AUDIT
Definition mdbx.h:907
@ MDBX_DBG_JITTER
Definition mdbx.h:911
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:6195
LIBMDBX_API const char * mdbx_strerror_ANSI2OEM(int errnum)
MDBX_error_t
Errors and return codes.
Definition mdbx.h:1821
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:1848
@ MDBX_FIRST_LMDB_ERRCODE
Definition mdbx.h:1835
@ MDBX_EKEYMISMATCH
Definition mdbx.h:1937
@ MDBX_UNABLE_EXTEND_MAPSIZE
Definition mdbx.h:1882
@ MDBX_EACCESS
Definition mdbx.h:1994
@ MDBX_EIO
Definition mdbx.h:1998
@ MDBX_PAGE_NOTFOUND
Definition mdbx.h:1841
@ MDBX_TXN_FULL
Definition mdbx.h:1866
@ MDBX_DUPLICATED_CLK
Definition mdbx.h:1957
@ MDBX_VERSION_MISMATCH
Definition mdbx.h:1851
@ MDBX_WANNA_RECOVERY
Definition mdbx.h:1934
@ MDBX_TXN_OVERLAPPING
Definition mdbx.h:1948
@ MDBX_EREMOTE
Definition mdbx.h:2002
@ MDBX_TOO_LARGE
Definition mdbx.h:1941
@ MDBX_EBADSIGN
Definition mdbx.h:1930
@ MDBX_CURSOR_FULL
Definition mdbx.h:1870
@ MDBX_ENOFILE
Definition mdbx.h:2001
@ MDBX_BAD_TXN
Definition mdbx.h:1901
@ MDBX_ENODATA
Definition mdbx.h:1991
@ MDBX_LAST_LMDB_ERRCODE
Definition mdbx.h:1915
@ MDBX_CORRUPTED
Definition mdbx.h:1844
@ MDBX_EPERM
Definition mdbx.h:1999
@ MDBX_THREAD_MISMATCH
Definition mdbx.h:1945
@ MDBX_BACKLOG_DEPLETED
Definition mdbx.h:1954
@ MDBX_SUCCESS
Definition mdbx.h:1823
@ MDBX_NOTFOUND
Definition mdbx.h:1838
@ MDBX_RESULT_TRUE
Definition mdbx.h:1829
@ MDBX_INVALID
Definition mdbx.h:1854
@ MDBX_BAD_VALSIZE
Definition mdbx.h:1905
@ MDBX_BUSY
Definition mdbx.h:1919
@ MDBX_OUSTED
Definition mdbx.h:1965
@ MDBX_DBS_FULL
Definition mdbx.h:1860
@ MDBX_EINVAL
Definition mdbx.h:1993
@ MDBX_BAD_RSLOT
Definition mdbx.h:1896
@ MDBX_ENOMEM
Definition mdbx.h:1995
@ MDBX_FIRST_ADDED_ERRCODE
Definition mdbx.h:1922
@ MDBX_RESULT_FALSE
Definition mdbx.h:1826
@ MDBX_EINTR
Definition mdbx.h:2000
@ MDBX_READERS_FULL
Definition mdbx.h:1863
@ MDBX_LAST_ADDED_ERRCODE
Definition mdbx.h:1972
@ MDBX_BAD_DBI
Definition mdbx.h:1909
@ MDBX_KEYEXIST
Definition mdbx.h:1832
@ MDBX_DANGLING_DBI
Definition mdbx.h:1961
@ MDBX_EDEADLK
Definition mdbx.h:2003
@ MDBX_PAGE_FULL
Definition mdbx.h:1873
@ MDBX_MAP_FULL
Definition mdbx.h:1857
@ MDBX_PROBLEM
Definition mdbx.h:1912
@ MDBX_ENOSYS
Definition mdbx.h:1997
@ MDBX_EMULTIVAL
Definition mdbx.h:1925
@ MDBX_EROFS
Definition mdbx.h:1996
@ MDBX_MVCC_RETARDED
Definition mdbx.h:1969
@ MDBX_INCOMPATIBLE
Definition mdbx.h:1892
LIBMDBX_API MDBX_cmp_func * mdbx_get_datacmp(MDBX_db_flags_t flags)
Returns default internal data's comparator for given table flags.
LIBMDBX_API int mdbx_reader_check(MDBX_env *env, int *dead)
Check for stale entries in the reader lock table.
LIBMDBX_API int mdbx_env_copy(MDBX_env *env, const char *dest, MDBX_copy_flags_t flags)
Copy an MDBX environment to the specified path, with options.
LIBMDBX_API int mdbx_txn_copy2pathname(MDBX_txn *txn, const char *dest, MDBX_copy_flags_t flags)
Copy an MDBX environment by given read transaction to the specified path, with options.
MDBX_copy_flags_t
Environment copy flags.
Definition mdbx.h:1669
int mdbx_env_sync(MDBX_env *env)
The shortcut to calling mdbx_env_sync_ex() with the force=true and nonblock=false arguments.
Definition mdbx.h:2936
LIBMDBX_API MDBX_cmp_func * mdbx_get_keycmp(MDBX_db_flags_t flags)
Returns default internal key's comparator for given table flags.
LIBMDBX_API int mdbx_is_readahead_reasonable(size_t volume, intptr_t redundancy)
Find out whether to use readahead or not, based on the given database size and the amount of availabl...
LIBMDBX_API int mdbx_thread_register(const MDBX_env *env)
Registers the current thread as a reader for the environment.
int mdbx_env_sync_poll(MDBX_env *env)
The shortcut to calling mdbx_env_sync_ex() with the force=false and nonblock=true arguments.
Definition mdbx.h:2941
LIBMDBX_API int mdbx_env_deleteW(const wchar_t *pathname, MDBX_env_delete_mode_t mode)
Delete the environment's files in a proper and multiprocess-safe way.
LIBMDBX_API int mdbx_env_resurrect_after_fork(MDBX_env *env)
Восстанавливает экземпляр среды в дочернем процессе после ветвления родительского процесса посредство...
MDBX_env_delete_mode_t
Deletion modes for mdbx_env_delete().
Definition mdbx.h:2506
LIBMDBX_API int mdbx_env_copy2fd(MDBX_env *env, mdbx_filehandle_t fd, MDBX_copy_flags_t flags)
Copy an environment to the specified file descriptor, with options.
LIBMDBX_API int mdbx_cursor_ignord(MDBX_cursor *cursor)
Служебная функция для использования в утилитах.
LIBMDBX_API int mdbx_env_copyW(MDBX_env *env, const wchar_t *dest, MDBX_copy_flags_t flags)
Copy an MDBX environment to the specified path, with options.
LIBMDBX_API int mdbx_thread_unregister(const MDBX_env *env)
Unregisters the current thread as a reader for the environment.
LIBMDBX_API int mdbx_env_sync_ex(MDBX_env *env, bool force, bool nonblock)
Flush the environment data buffers to disk.
LIBMDBX_API int mdbx_txn_copy2fd(MDBX_txn *txn, mdbx_filehandle_t fd, MDBX_copy_flags_t flags)
Copy an environment by given read transaction to the specified file descriptor, with options.
LIBMDBX_API int mdbx_env_delete(const char *pathname, MDBX_env_delete_mode_t mode)
Delete the environment's files in a proper and multiprocess-safe way.
LIBMDBX_API int mdbx_env_open_for_recoveryW(MDBX_env *env, const wchar_t *pathname, unsigned target_meta, bool writeable)
Open an environment instance using specific meta-page for checking and recovery.
LIBMDBX_API int mdbx_txn_copy2pathnameW(MDBX_txn *txn, const wchar_t *dest, MDBX_copy_flags_t flags)
Copy an MDBX environment by given read transaction to the specified path, with options.
@ MDBX_CP_DISPOSE_TXN
Definition mdbx.h:1688
@ MDBX_CP_DEFAULTS
Definition mdbx.h:1670
@ MDBX_CP_COMPACT
Definition mdbx.h:1674
@ MDBX_CP_RENEW_TXN
Definition mdbx.h:1693
@ MDBX_CP_THROTTLE_MVCC
Definition mdbx.h:1684
@ MDBX_CP_FORCE_DYNAMIC_SIZE
Definition mdbx.h:1677
@ MDBX_CP_DONT_FLUSH
Definition mdbx.h:1680
@ MDBX_ENV_WAIT_FOR_UNUSED
Wait until other processes closes the environment before deletion.
Definition mdbx.h:2519
@ MDBX_ENV_JUST_DELETE
Just delete the environment's files and directory if any.
Definition mdbx.h:2513
@ MDBX_ENV_ENSURE_UNUSED
Make sure that the environment is not being used by other processes, or return an error otherwise.
Definition mdbx.h:2516
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:3104
MDBX_env_flags_t
Environment flags.
Definition mdbx.h:1016
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:1231
@ MDBX_ENV_DEFAULTS
Definition mdbx.h:1017
@ MDBX_COALESCE
Definition mdbx.h:1267
@ MDBX_NOMETASYNC
Definition mdbx.h:1366
@ MDBX_LIFORECLAIM
Definition mdbx.h:1291
@ MDBX_SAFE_NOSYNC
Definition mdbx.h:1417
@ MDBX_NOTLS
Definition mdbx.h:1210
@ MDBX_SYNC_DURABLE
Definition mdbx.h:1348
@ MDBX_PAGEPERTURB
Definition mdbx.h:1294
@ MDBX_WRITEMAP
Definition mdbx.h:1136
@ MDBX_NOSTICKYTHREADS
Definition mdbx.h:1207
@ MDBX_EXCLUSIVE
Definition mdbx.h:1090
@ MDBX_NOMEMINIT
Definition mdbx.h:1254
@ MDBX_MAPASYNC
Definition mdbx.h:1424
@ MDBX_ACCEDE
Definition mdbx.h:1105
@ MDBX_NOSUBDIR
Definition mdbx.h:1042
@ MDBX_RDONLY
Definition mdbx.h:1060
@ MDBX_UTTERLY_NOSYNC
Definition mdbx.h:1467
@ MDBX_VALIDATION
Definition mdbx.h:1024
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:3545
int mdbx_env_set_maxdbs(MDBX_env *env, MDBX_dbi dbs)
Set the maximum number of named tables for the environment.
Definition mdbx.h:3694
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:3027
MDBX_option_t
MDBX environment extra runtime options.
Definition mdbx.h:2094
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:2966
MDBX_warmup_flags_t
Warming up options.
Definition mdbx.h:3190
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:3648
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:2198
@ MDBX_opt_subpage_room_threshold
Задаёт в % минимальный объём свободного места на основной странице, при отсутствии которого вложенные...
Definition mdbx.h:2371
@ MDBX_opt_subpage_limit
Задаёт в % максимальный размер вложенных страниц, используемых для размещения небольшого количества м...
Definition mdbx.h:2365
@ MDBX_opt_txn_dp_limit
Controls the in-process limit of dirty pages for a write transaction.
Definition mdbx.h:2194
@ MDBX_opt_prefer_waf_insteadof_balance
Управляет выбором между стремлением к равномерности наполнения страниц, либо уменьшением количества и...
Definition mdbx.h:2350
@ 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:2298
@ MDBX_opt_max_db
Controls the maximum number of named tables for the environment.
Definition mdbx.h:2103
@ MDBX_opt_merge_threshold_16dot16_percent
Controls the in-process threshold of semi-empty pages merge.
Definition mdbx.h:2265
@ MDBX_opt_subpage_reserve_prereq
Задаёт в % минимальный объём свободного места на основной странице, при наличии которого,...
Definition mdbx.h:2387
@ MDBX_opt_sync_bytes
Controls interprocess/shared threshold to force flush the data buffers to disk, if MDBX_SAFE_NOSYNC i...
Definition mdbx.h:2126
@ MDBX_opt_spill_min_denominator
Controls the in-process how minimal part of the dirty pages should be spilled when necessary.
Definition mdbx.h:2230
@ 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:2253
@ 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:2166
@ 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:2153
@ MDBX_opt_max_readers
Defines the maximum number of threads/reader slots for all processes interacting with the database.
Definition mdbx.h:2120
@ MDBX_opt_subpage_reserve_limit
Задаёт в % ограничение резервирования места на вложенных страницах.
Definition mdbx.h:2392
@ MDBX_opt_spill_max_denominator
Controls the in-process how maximal part of the dirty pages may be spilled when necessary.
Definition mdbx.h:2214
@ MDBX_opt_sync_period
Controls interprocess/shared relative period since the last unsteady commit to force flush the data b...
Definition mdbx.h:2132
@ MDBX_opt_dp_reserve_limit
Controls the in-process limit of a pre-allocated memory items for dirty pages.
Definition mdbx.h:2180
@ MDBX_opt_writethrough_threshold
Controls the choosing between use write-through disk writes and usual ones with followed flush by the...
Definition mdbx.h:2293
@ MDBX_opt_gc_time_limit
Controls the in-process spending time limit of searching consecutive pages inside GC.
Definition mdbx.h:2325
@ MDBX_warmup_touchlimit
Definition mdbx.h:3229
@ MDBX_warmup_force
Definition mdbx.h:3199
@ MDBX_warmup_oomsafe
Definition mdbx.h:3206
@ MDBX_warmup_release
Definition mdbx.h:3232
@ MDBX_warmup_lock
Definition mdbx.h:3221
@ MDBX_warmup_default
Definition mdbx.h:3193
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:3663
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:3047
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:4758
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:2891
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:2984
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:3572
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:4730
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:3568
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:6047
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:3708
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:2776
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:4623
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:4732
@ MDBX_DBI_FRESH
Definition mdbx.h:4736
@ MDBX_DBI_STALE
Definition mdbx.h:4734
@ MDBX_DBI_CREAT
Definition mdbx.h:4738
LIBMDBX_API int mdbx_txn_break(MDBX_txn *txn)
Marks transaction as broken.
LIBMDBX_API int mdbx_txn_set_userctx(MDBX_txn *txn, void *ctx)
Sets application information associated (a context pointer) with the transaction.
LIBMDBX_API int mdbx_txn_park(MDBX_txn *txn, bool autounpark)
Переводит читающую транзакцию в "припаркованное" состояние.
LIBMDBX_API int mdbx_txn_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.
int mdbx_txn_commit(MDBX_txn *txn)
Commit all the operations of a transaction into the database.
Definition mdbx.h:4200
LIBMDBX_API int mdbx_txn_commit_ex(MDBX_txn *txn, MDBX_commit_latency *latency)
Commit all the operations of a transaction into the database and collect latency information.
LIBMDBX_API MDBX_env * mdbx_txn_env(const MDBX_txn *txn)
Returns the transaction's MDBX_env.
LIBMDBX_API int mdbx_txn_unpark(MDBX_txn *txn, bool restart_if_ousted)
Распарковывает ранее припаркованную читающую транзакцию.
MDBX_txn_flags_t
Definition mdbx.h:1477
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:3928
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:708
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:1488
@ MDBX_TXN_ERROR
Definition mdbx.h:1528
@ MDBX_TXN_NOMETASYNC
Definition mdbx.h:1507
@ MDBX_TXN_SPILLS
Definition mdbx.h:1538
@ MDBX_TXN_OUSTED
Definition mdbx.h:1562
@ MDBX_TXN_HAS_CHILD
Definition mdbx.h:1543
@ MDBX_TXN_RDONLY_PREPARE
Definition mdbx.h:1497
@ MDBX_TXN_INVALID
Definition mdbx.h:1518
@ MDBX_TXN_BLOCKED
Definition mdbx.h:1567
@ MDBX_TXN_PARKED
Definition mdbx.h:1548
@ MDBX_TXN_NOSYNC
Definition mdbx.h:1511
@ MDBX_TXN_DIRTY
Definition mdbx.h:1533
@ MDBX_TXN_READWRITE
Definition mdbx.h:1482
@ MDBX_TXN_AUTOUNPARK
Definition mdbx.h:1555
@ MDBX_TXN_TRY
Definition mdbx.h:1503
@ MDBX_TXN_FINISHED
Definition mdbx.h:1523
MDBX_chk_severity_t verbosity
Definition mdbx.h:6408
MDBX_txn * txn
Definition mdbx.h:6473
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:6511
size_t pad
Definition mdbx.h:6425
struct MDBX_chk_internal * internal
Definition mdbx.h:6471
uint8_t scope_nesting
Definition mdbx.h:6475
size_t ones
Definition mdbx.h:6425
struct MDBX_chk_internal * internal
Definition mdbx.h:6405
char * begin
Definition mdbx.h:6390
size_t subtotal_issues
Definition mdbx.h:6409
MDBX_chk_user_table_cookie_t * cookie
Definition mdbx.h:6435
struct MDBX_chk_context * ctx
Definition mdbx.h:6388
MDBX_db_flags_t flags
Definition mdbx.h:6445
struct MDBX_chk_issue * next
Definition mdbx.h:6396
const void * object
Definition mdbx.h:6406
size_t count
Definition mdbx.h:6425
const char * caption
Definition mdbx.h:6398
struct MDBX_chk_histogram::@9 ranges[9]
MDBX_chk_stage_t stage
Definition mdbx.h:6407
MDBX_env * env
Definition mdbx.h:6472
uint8_t empty
Definition mdbx.h:6389
size_t amount
Definition mdbx.h:6425
MDBX_chk_scope_t * scope
Definition mdbx.h:6474
MDBX_chk_issue_t * issues
Definition mdbx.h:6404
size_t count
Definition mdbx.h:6397
MDBX_val name
Definition mdbx.h:6444
size_t lost_bytes
Definition mdbx.h:6448
int id
Definition mdbx.h:6446
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)
Проверяет целостность базы данных.
MDBX_chk_stage_t
Стадии проверки, сообщаемые через обратные вызовы при проверке целостности базы данных.
Definition mdbx.h:6370
LIBMDBX_API int mdbx_txn_unlock(MDBX_env *env)
Releases write-transaction lock. Provided for custom and/or complex locking scenarios.
struct MDBX_chk_user_table_cookie MDBX_chk_user_table_cookie_t
Пользовательский тип для привязки дополнительных данных, связанных с некоторой таблицей ключ-значение...
Definition mdbx.h:6419
MDBX_chk_flags_t
Флаги/опции для проверки целостности базы данных.
Definition mdbx.h:6327
MDBX_chk_severity_t
Уровни логирование/детализации информации, поставляемой через обратные вызовы при проверке целостност...
Definition mdbx.h:6351
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:6376
@ MDBX_chk_init
Definition mdbx.h:6372
@ MDBX_chk_finalize
Definition mdbx.h:6382
@ MDBX_chk_space
Definition mdbx.h:6377
@ MDBX_chk_lock
Definition mdbx.h:6373
@ MDBX_chk_none
Definition mdbx.h:6371
@ MDBX_chk_maindb
Definition mdbx.h:6378
@ MDBX_chk_unlock
Definition mdbx.h:6381
@ MDBX_chk_meta
Definition mdbx.h:6374
@ MDBX_chk_conclude
Definition mdbx.h:6380
@ MDBX_chk_tree
Definition mdbx.h:6375
@ MDBX_chk_tables
Definition mdbx.h:6379
@ MDBX_CHK_SKIP_BTREE_TRAVERSAL
Definition mdbx.h:6336
@ MDBX_CHK_READWRITE
Definition mdbx.h:6333
@ MDBX_CHK_DEFAULTS
Definition mdbx.h:6329
@ MDBX_CHK_SKIP_KV_TRAVERSAL
Definition mdbx.h:6339
@ MDBX_CHK_IGNORE_ORDER
Definition mdbx.h:6344
@ MDBX_chk_processing
Definition mdbx.h:6360
@ MDBX_chk_result
Definition mdbx.h:6358
@ MDBX_chk_details
Definition mdbx.h:6363
@ MDBX_chk_extra
Definition mdbx.h:6364
@ MDBX_chk_severity_prio_shift
Definition mdbx.h:6352
@ MDBX_chk_severity_kind_mask
Definition mdbx.h:6353
@ MDBX_chk_notice
Definition mdbx.h:6357
@ MDBX_chk_resolution
Definition mdbx.h:6359
@ MDBX_chk_warning
Definition mdbx.h:6356
@ MDBX_chk_fatal
Definition mdbx.h:6354
@ MDBX_chk_info
Definition mdbx.h:6361
@ MDBX_chk_error
Definition mdbx.h:6355
@ MDBX_chk_verbose
Definition mdbx.h:6362
Набор функций обратного вызова используемых при проверке целостности базы данных.
Definition mdbx.h:6505
Контекст проверки целостности базы данных.
Definition mdbx.h:6470
Гистограмма с некоторой статистической информацией, собираемой при проверке целостности БД.
Definition mdbx.h:6424
Проблема обнаруженная при проверке целостности базы данных.
Definition mdbx.h:6395
Виртуальная строка отчета, формируемого при проверке целостности базы данных.
Definition mdbx.h:6387
Иерархический контекст при проверке целостности базы данных.
Definition mdbx.h:6403
Информация о некоторой таблицей ключ-значение, при проверке целостности базы данных.
Definition mdbx.h:6434
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:4669
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:4673
LIBMDBX_API uint64_t mdbx_key_from_jsonInteger(const int64_t json_integer)