libmdbx
0.11.6.39 (2022-04-13T11:05:50+03:00)
One of the fastest compact embeddable key-value ACID database without WAL.
|
|
Go to the documentation of this file.
73 #pragma warning(push, 1)
74 #pragma warning(disable : 4548)
76 #pragma warning(disable : 4530)
78 #pragma warning(disable : 4577)
175 #if !defined(NDEBUG) && !defined(assert)
179 #if defined(_WIN32) || defined(_WIN64)
182 #ifndef __mode_t_defined
193 #include <sys/types.h>
195 #define HAVE_STRUCT_IOVEC 1
212 #ifndef __has_attribute
213 #define __has_attribute(x) (0)
216 #ifndef __has_cpp_attribute
217 #define __has_cpp_attribute(x) 0
220 #ifndef __has_feature
221 #define __has_feature(x) (0)
224 #ifndef __has_extension
225 #define __has_extension(x) (0)
228 #ifndef __has_builtin
229 #define __has_builtin(x) (0)
237 #if (defined(__GNUC__) || __has_attribute(__pure__)) && \
238 (!defined(__clang__) \
239 || !defined(__cplusplus) || !__has_feature(cxx_exceptions))
240 #define MDBX_PURE_FUNCTION __attribute__((__pure__))
241 #elif defined(_MSC_VER) && !defined(__clang__) && _MSC_VER >= 1920
242 #define MDBX_PURE_FUNCTION
243 #elif defined(__cplusplus) && __has_cpp_attribute(gnu::pure) && \
244 (!defined(__clang__) || !__has_feature(cxx_exceptions))
245 #define MDBX_PURE_FUNCTION [[gnu::pure]]
247 #define MDBX_PURE_FUNCTION
252 #if defined(__GNUC__) || \
253 (__has_attribute(__pure__) && __has_attribute(__nothrow__))
254 #define MDBX_NOTHROW_PURE_FUNCTION __attribute__((__pure__, __nothrow__))
255 #elif defined(_MSC_VER) && !defined(__clang__) && _MSC_VER >= 1920
256 #if __has_cpp_attribute(pure)
257 #define MDBX_NOTHROW_PURE_FUNCTION [[pure]]
259 #define MDBX_NOTHROW_PURE_FUNCTION
261 #elif defined(__cplusplus) && __has_cpp_attribute(gnu::pure)
262 #if __has_cpp_attribute(gnu::nothrow)
263 #define MDBX_NOTHROW_PURE_FUNCTION [[gnu::pure, gnu::nothrow]]
265 #define MDBX_NOTHROW_PURE_FUNCTION [[gnu::pure]]
267 #elif defined(__cplusplus) && __has_cpp_attribute(pure)
268 #define MDBX_NOTHROW_PURE_FUNCTION [[pure]]
270 #define MDBX_NOTHROW_PURE_FUNCTION
282 #if (defined(__GNUC__) || __has_attribute(__pure__)) && \
283 (!defined(__clang__) \
284 || !defined(__cplusplus) || !__has_feature(cxx_exceptions))
285 #define MDBX_CONST_FUNCTION __attribute__((__const__))
286 #elif defined(_MSC_VER) && !defined(__clang__) && _MSC_VER >= 1920
287 #define MDBX_CONST_FUNCTION MDBX_PURE_FUNCTION
288 #elif defined(__cplusplus) && __has_cpp_attribute(gnu::const) && \
289 (!defined(__clang__) || !__has_feature(cxx_exceptions))
290 #define MDBX_CONST_FUNCTION [[gnu::const]]
292 #define MDBX_CONST_FUNCTION MDBX_PURE_FUNCTION
297 #if defined(__GNUC__) || \
298 (__has_attribute(__const__) && __has_attribute(__nothrow__))
299 #define MDBX_NOTHROW_CONST_FUNCTION __attribute__((__const__, __nothrow__))
300 #elif defined(_MSC_VER) && !defined(__clang__) && _MSC_VER >= 1920
301 #define MDBX_NOTHROW_CONST_FUNCTION MDBX_NOTHROW_PURE_FUNCTION
302 #elif defined(__cplusplus) && __has_cpp_attribute(gnu::const)
303 #if __has_cpp_attribute(gnu::nothrow)
304 #define MDBX_NOTHROW_PURE_FUNCTION [[gnu::const, gnu::nothrow]]
306 #define MDBX_NOTHROW_PURE_FUNCTION [[gnu::const]]
308 #elif defined(__cplusplus) && __has_cpp_attribute(const)
309 #define MDBX_NOTHROW_CONST_FUNCTION [[const]]
311 #define MDBX_NOTHROW_CONST_FUNCTION MDBX_NOTHROW_PURE_FUNCTION
314 #ifndef MDBX_DEPRECATED
316 #define MDBX_DEPRECATED __deprecated
317 #elif defined(__GNUC__) || __has_attribute(__deprecated__)
318 #define MDBX_DEPRECATED __attribute__((__deprecated__))
319 #elif defined(_MSC_VER)
320 #define MDBX_DEPRECATED __declspec(deprecated)
322 #define MDBX_DEPRECATED
327 #if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__) || \
328 defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__)
329 #if defined(__GNUC__) || __has_attribute(__dllexport__)
330 #define __dll_export __attribute__((__dllexport__))
331 #elif defined(_MSC_VER)
332 #define __dll_export __declspec(dllexport)
336 #elif defined(__GNUC__) || __has_attribute(__visibility__)
337 #define __dll_export __attribute__((__visibility__("default")))
344 #if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__) || \
345 defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__)
346 #if defined(__GNUC__) || __has_attribute(__dllimport__)
347 #define __dll_import __attribute__((__dllimport__))
348 #elif defined(_MSC_VER)
349 #define __dll_import __declspec(dllimport)
361 #if defined(LIBMDBX_INTERNALS) && !defined(LIBMDBX_NO_EXPORTS_LEGACY_API)
362 #define LIBMDBX_INLINE_API(TYPE, NAME, ARGS) \
363 LIBMDBX_API TYPE NAME ARGS; \
364 static __inline TYPE __inline_##NAME ARGS
366 #define LIBMDBX_INLINE_API(TYPE, NAME, ARGS) static __inline TYPE NAME ARGS
370 #ifndef MDBX_STRINGIFY
371 #define MDBX_STRINGIFY_HELPER(x) #x
372 #define MDBX_STRINGIFY(x) MDBX_STRINGIFY_HELPER(x)
389 #if !defined(DOXYGEN) && (!defined(__cpp_noexcept_function_type) || \
390 __cpp_noexcept_function_type < 201510L)
391 #define MDBX_CXX17_NOEXCEPT
393 #define MDBX_CXX17_NOEXCEPT noexcept
397 #if !defined(__cplusplus)
398 #define MDBX_CXX01_CONSTEXPR __inline
399 #define MDBX_CXX01_CONSTEXPR_VAR const
400 #elif !defined(DOXYGEN) && \
401 ((__cplusplus < 201103L && defined(__cpp_constexpr) && \
402 __cpp_constexpr < 200704L) || \
403 (defined(__LCC__) && __LCC__ < 124) || \
404 (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 407) && \
405 !defined(__clang__) && !defined(__LCC__)) || \
406 (defined(_MSC_VER) && _MSC_VER < 1910) || \
407 (defined(__clang__) && __clang_major__ < 4))
408 #define MDBX_CXX01_CONSTEXPR inline
409 #define MDBX_CXX01_CONSTEXPR_VAR const
411 #define MDBX_CXX01_CONSTEXPR constexpr
412 #define MDBX_CXX01_CONSTEXPR_VAR constexpr
415 #if !defined(__cplusplus)
416 #define MDBX_CXX11_CONSTEXPR __inline
417 #define MDBX_CXX11_CONSTEXPR_VAR const
418 #elif !defined(DOXYGEN) && \
419 (!defined(__cpp_constexpr) || __cpp_constexpr < 201304L || \
420 (defined(__LCC__) && __LCC__ < 124) || \
421 (defined(__GNUC__) && __GNUC__ < 6 && !defined(__clang__) && \
422 !defined(__LCC__)) || \
423 (defined(_MSC_VER) && _MSC_VER < 1910) || \
424 (defined(__clang__) && __clang_major__ < 5))
425 #define MDBX_CXX11_CONSTEXPR inline
426 #define MDBX_CXX11_CONSTEXPR_VAR const
428 #define MDBX_CXX11_CONSTEXPR constexpr
429 #define MDBX_CXX11_CONSTEXPR_VAR constexpr
432 #if !defined(__cplusplus)
433 #define MDBX_CXX14_CONSTEXPR __inline
434 #define MDBX_CXX14_CONSTEXPR_VAR const
435 #elif defined(DOXYGEN) || \
436 defined(__cpp_constexpr) && __cpp_constexpr >= 201304L && \
437 ((defined(_MSC_VER) && _MSC_VER >= 1910) || \
438 (defined(__clang__) && __clang_major__ > 4) || \
439 (defined(__GNUC__) && __GNUC__ > 6) || \
440 (!defined(__GNUC__) && !defined(__clang__) && !defined(_MSC_VER)))
441 #define MDBX_CXX14_CONSTEXPR constexpr
442 #define MDBX_CXX14_CONSTEXPR_VAR constexpr
444 #define MDBX_CXX14_CONSTEXPR inline
445 #define MDBX_CXX14_CONSTEXPR_VAR const
448 #if defined(__noreturn)
449 #define MDBX_NORETURN __noreturn
450 #elif defined(_Noreturn)
451 #define MDBX_NORETURN _Noreturn
452 #elif defined(__GNUC__) || __has_attribute(__noreturn__)
453 #define MDBX_NORETURN __attribute__((__noreturn__))
454 #elif defined(_MSC_VER) && !defined(__clang__)
455 #define MDBX_NORETURN __declspec(noreturn)
457 #define MDBX_NORETURN
460 #ifndef MDBX_PRINTF_ARGS
461 #if defined(__GNUC__) || __has_attribute(__format__)
462 #if defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__)
463 #define MDBX_PRINTF_ARGS(format_index, first_arg) \
464 __attribute__((__format__(__gnu_printf__, format_index, first_arg)))
466 #define MDBX_PRINTF_ARGS(format_index, first_arg) \
467 __attribute__((__format__(__printf__, format_index, first_arg)))
470 #define MDBX_PRINTF_ARGS(format_index, first_arg)
474 #if defined(DOXYGEN) || \
475 (defined(__cplusplus) && __cplusplus >= 201603 && \
476 __has_cpp_attribute(maybe_unused) && \
477 __has_cpp_attribute(maybe_unused) >= 201603) || \
478 (!defined(__cplusplus) && defined(__STDC_VERSION__) && \
479 __STDC_VERSION__ > 202005L)
480 #define MDBX_MAYBE_UNUSED [[maybe_unused]]
481 #elif defined(__GNUC__) || __has_attribute(__unused__)
482 #define MDBX_MAYBE_UNUSED __attribute__((__unused__))
484 #define MDBX_MAYBE_UNUSED
487 #if __has_attribute(no_sanitize)
488 #define MDBX_NOSANITIZE_ENUM __attribute((__no_sanitize__("enum")))
490 #define MDBX_NOSANITIZE_ENUM
498 #ifndef DEFINE_ENUM_FLAG_OPERATORS
501 #if !defined(__cpp_constexpr) || __cpp_constexpr < 200704L || \
502 (defined(__LCC__) && __LCC__ < 124) || \
503 (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 407) && \
504 !defined(__clang__) && !defined(__LCC__)) || \
505 (defined(_MSC_VER) && _MSC_VER < 1910) || \
506 (defined(__clang__) && __clang_major__ < 4)
508 #define CONSTEXPR_ENUM_FLAGS_OPERATIONS 0
511 #define CONSTEXPR_ENUM_FLAGS_OPERATIONS 1
516 #define DEFINE_ENUM_FLAG_OPERATORS(ENUM) \
518 MDBX_NOSANITIZE_ENUM MDBX_CXX01_CONSTEXPR ENUM operator|(ENUM a, ENUM b) { \
519 return ENUM(unsigned(a) | unsigned(b)); \
521 MDBX_NOSANITIZE_ENUM MDBX_CXX14_CONSTEXPR ENUM &operator|=(ENUM &a, \
525 MDBX_NOSANITIZE_ENUM MDBX_CXX01_CONSTEXPR ENUM operator&(ENUM a, ENUM b) { \
526 return ENUM(unsigned(a) & unsigned(b)); \
528 MDBX_NOSANITIZE_ENUM MDBX_CXX01_CONSTEXPR ENUM operator&(ENUM a, \
530 return ENUM(unsigned(a) & b); \
532 MDBX_NOSANITIZE_ENUM MDBX_CXX01_CONSTEXPR ENUM operator&(unsigned a, \
534 return ENUM(a & unsigned(b)); \
536 MDBX_NOSANITIZE_ENUM MDBX_CXX14_CONSTEXPR ENUM &operator&=(ENUM &a, \
540 MDBX_NOSANITIZE_ENUM MDBX_CXX14_CONSTEXPR ENUM &operator&=(ENUM &a, \
544 MDBX_CXX01_CONSTEXPR unsigned operator~(ENUM a) { return ~unsigned(a); } \
545 MDBX_NOSANITIZE_ENUM MDBX_CXX01_CONSTEXPR ENUM operator^(ENUM a, ENUM b) { \
546 return ENUM(unsigned(a) ^ unsigned(b)); \
548 MDBX_NOSANITIZE_ENUM MDBX_CXX14_CONSTEXPR ENUM &operator^=(ENUM &a, \
555 #define DEFINE_ENUM_FLAG_OPERATORS(ENUM)
556 #define CONSTEXPR_ENUM_FLAGS_OPERATIONS 1
559 #elif !defined(CONSTEXPR_ENUM_FLAGS_OPERATIONS)
563 #define CONSTEXPR_ENUM_FLAGS_OPERATIONS 0
566 #define CONSTEXPR_ENUM_FLAGS_OPERATIONS 1
583 #define MDBX_VERSION_MAJOR 0
584 #define MDBX_VERSION_MINOR 11
587 #if defined(LIBMDBX_EXPORTS)
588 #define LIBMDBX_API __dll_export
589 #elif defined(LIBMDBX_IMPORTS)
590 #define LIBMDBX_API __dll_import
597 #if defined(__clang__) || __has_attribute(type_visibility)
598 #define LIBMDBX_API_TYPE LIBMDBX_API __attribute__((type_visibility("default")))
600 #define LIBMDBX_API_TYPE LIBMDBX_API
603 #define LIBMDBX_API_TYPE
606 #if defined(LIBMDBX_IMPORTS)
607 #define LIBMDBX_VERINFO_API __dll_import
609 #define LIBMDBX_VERINFO_API __dll_export
638 #if (defined(_WIN32) || defined(_WIN64)) && !MDBX_BUILD_SHARED_LIBRARY
666 #error Non-dll build libmdbx requires target Windows version \
667 to be explicitly defined via _WIN32_WINNT for properly \
668 handling thread local storage destructors.
671 #if _WIN32_WINNT >= 0x0600
674 #define MDBX_MANUAL_MODULE_HANDLER 0
678 #define MDBX_MANUAL_MODULE_HANDLER 1
679 void LIBMDBX_API NTAPI mdbx_module_handler(PVOID module, DWORD reason,
741 #ifndef HAVE_STRUCT_IOVEC
746 #define HAVE_STRUCT_IOVEC
749 #if defined(__sun) || defined(__SVR4) || defined(__svr4__)
781 #define MDBX_LOCKNAME "/mdbx.lck"
783 #define MDBX_DATANAME "/mdbx.dat"
786 #define MDBX_LOCK_SUFFIX "-lck"
889 MDBX_DBG_MAX = ((unsigned)MDBX_LOG_MAX) << 16 |
909 int line,
const char *fmt,
913 #define MDBX_LOGGER_DONTCHANGE ((MDBX_debug_func *)(intptr_t)-1)
929 const char *
function,
953 const size_t bufsize);
1390 #if CONSTEXPR_ENUM_FLAGS_OPERATIONS || defined(DOXYGEN)
1776 #if defined(_WIN32) || defined(_WIN64)
1815 MDBX_DEPRECATED static __inline
int MDBX_MAP_RESIZED_is_deprecated() {
1818 #define MDBX_MAP_RESIZED MDBX_MAP_RESIZED_is_deprecated()
1867 #if defined(_WIN32) || defined(_WIN64) || defined(DOXYGEN)
2530 assert(proxy <= SIZE_MAX);
2532 *threshold = (size_t)proxy;
2589 if (period_seconds_16dot16) {
2593 assert(proxy <= UINT32_MAX);
2595 *period_seconds_16dot16 = (unsigned)proxy;
2904 intptr_t size_now, intptr_t size_upper,
2905 intptr_t growth_step,
2906 intptr_t shrink_threshold,
2931 intptr_t redundancy);
3020 *readers = (unsigned)proxy;
3091 intptr_t *avail_pages);
3782 return UINT64_C(0x8000000000000000) + i64;
3786 return UINT32_C(0x80000000) + i32;
3985 MDBX_val *data,
size_t *values_count);
4150 const void *src,
size_t bytes);
4155 void *preserver_context);
4641 ptrdiff_t *distance_items);
4665 ptrdiff_t *distance_items);
4694 ptrdiff_t *distance_items);
4698 #define MDBX_EPSILON ((MDBX_val *)((ptrdiff_t)-1))
4758 uint64_t increment);
4837 uint64_t lag,
size_t bytes_used,
4987 unsigned gap,
size_t space,
5047 #define MDBX_PGWALK_MAIN ((const char *)((ptrdiff_t)0))
5049 #define MDBX_PGWALK_GC ((const char *)((ptrdiff_t)-1))
5051 #define MDBX_PGWALK_META ((const char *)((ptrdiff_t)-2))
5055 const uint64_t pgno,
const unsigned number,
void *
const ctx,
const int deep,
5056 const char *
const dbi,
const size_t page_size,
const MDBX_page_type_t type,
5057 const MDBX_error_t err,
const size_t nentries,
const size_t payload_bytes,
5062 void *ctx,
bool dont_check_keys_ordering);
5071 unsigned target_meta,
5085 #if defined(MDBX_NEXENTA_ATTRS) || defined(DOXYGEN)
5259 #if defined(__e2k__) && defined(MDBX_E2K_MLHCPB_WORKAROUND) && \
5260 MDBX_E2K_MLHCPB_WORKAROUND
5261 LIBMDBX_API int mdbx_e2k_memcmp_bug_workaround(
const void *s1,
const void *s2,
5263 LIBMDBX_API int mdbx_e2k_strcmp_bug_workaround(
const char *s1,
const char *s2);
5264 LIBMDBX_API int mdbx_e2k_strncmp_bug_workaround(
const char *s1,
const char *s2,
5266 LIBMDBX_API size_t mdbx_e2k_strlen_bug_workaround(
const char *s);
5267 LIBMDBX_API size_t mdbx_e2k_strnlen_bug_workaround(
const char *s,
5271 inline int mdbx_e2k_memcmp_bug_workaround(
const void *s1,
const void *s2,
5273 return ::mdbx_e2k_memcmp_bug_workaround(s1, s2, n);
5275 inline int mdbx_e2k_strcmp_bug_workaround(
const char *s1,
const char *s2) {
5276 return ::mdbx_e2k_strcmp_bug_workaround(s1, s2);
5278 inline int mdbx_e2k_strncmp_bug_workaround(
const char *s1,
const char *s2,
5280 return ::mdbx_e2k_strncmp_bug_workaround(s1, s2, n);
5282 inline size_t mdbx_e2k_strlen_bug_workaround(
const char *s) {
5283 return ::mdbx_e2k_strlen_bug_workaround(s);
5285 inline size_t mdbx_e2k_strnlen_bug_workaround(
const char *s,
size_t maxlen) {
5286 return ::mdbx_e2k_strnlen_bug_workaround(s, maxlen);
5292 #include <strings.h>
5294 #define memcmp mdbx_e2k_memcmp_bug_workaround
5296 #define bcmp mdbx_e2k_memcmp_bug_workaround
5298 #define strcmp mdbx_e2k_strcmp_bug_workaround
5300 #define strncmp mdbx_e2k_strncmp_bug_workaround
5302 #define strlen mdbx_e2k_strlen_bug_workaround
5304 #define strnlen mdbx_e2k_strnlen_bug_workaround
@ MDBX_EXCLUSIVE
Definition: mdbx.h:1031
@ MDBX_TXN_FULL
Definition: mdbx.h:1690
const char * sourcery
Definition: mdbx.h:624
uint32_t mi_sys_pagesize
Definition: mdbx.h:2348
@ MDBX_RESERVE
Definition: mdbx.h:1497
@ MDBX_NEXT_MULTIPLE
Definition: mdbx.h:1580
@ MDBX_UTTERLY_NOSYNC
Definition: mdbx.h:1356
int mdbx_dbi_flags(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:3880
uint64_t clone
Definition: mdbx.h:2388
@ MDBX_opt_txn_dp_initial
Controls the in-process initial allocation size for dirty pages list of a write transaction....
Definition: mdbx.h:2000
uint32_t mi_since_sync_seconds16dot16
Definition: mdbx.h:2369
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API uint64_t mdbx_key_from_ptrdouble(const double *const ieee754_64bit)
MDBX_dbi_state_t
DBI state bits returted by mdbx_dbi_flags_ex()
Definition: mdbx.h:3849
@ MDBX_PAGE_NOTFOUND
Definition: mdbx.h:1665
@ MDBX_MAX_DBI
Definition: mdbx.h:765
uint64_t ms_leaf_pages
Definition: mdbx.h:2285
LIBMDBX_API int mdbx_cursor_bind(MDBX_txn *txn, MDBX_cursor *cursor, MDBX_dbi dbi)
Bind cursor to specified transaction and DBI handle.
uint64_t v
Definition: mdbx.h:3582
LIBMDBX_API int mdbx_cursor_get_attr(MDBX_cursor *cursor, MDBX_val *key, MDBX_val *data, mdbx_attr_t *pattr, MDBX_cursor_op op)
@ MDBX_PAGE_FULL
Definition: mdbx.h:1697
LIBMDBX_API int mdbx_cursor_get(MDBX_cursor *cursor, MDBX_val *key, MDBX_val *data, MDBX_cursor_op op)
Retrieve by cursor.
uint64_t split
Definition: mdbx.h:2390
@ MDBX_BAD_VALSIZE
Definition: mdbx.h:1728
const char * compiler
Definition: mdbx.h:634
@ MDBX_SET_KEY
Definition: mdbx.h:1598
uint64_t z
Definition: mdbx.h:3582
MDBX_NOTHROW_CONST_FUNCTION intptr_t mdbx_limits_pgsize_min(void)
Returns the minimal database page size in bytes.
Definition: mdbx.h:2935
@ MDBX_opt_spill_max_denominator
Controls the in-process how maximal part of the dirty pages may be spilled when necessary.
Definition: mdbx.h:2016
libmdbx version information
Definition: mdbx.h:613
@ MDBX_TXN_NOMETASYNC
Definition: mdbx.h:1401
uint64_t txn_reader_lag
Definition: mdbx.h:3304
int mdbx_filehandle_t
Definition: mdbx.h:196
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.
@ MDBX_EBADSIGN
Definition: mdbx.h:1753
LIBMDBX_API int mdbx_set_attr(MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key, MDBX_val *data, mdbx_attr_t attr)
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API double mdbx_double_from_key(const MDBX_val)
MDBX_NOTHROW_CONST_FUNCTION LIBMDBX_API uint32_t mdbx_key_from_float(const float ieee754_32bit)
LIBMDBX_VERINFO_API const struct MDBX_build_info mdbx_build
libmdbx build information
@ MDBX_CORRUPTED
Definition: mdbx.h:1668
uint64_t upper
Definition: mdbx.h:2331
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:3262
MDBX_NOTHROW_CONST_FUNCTION 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...
@ MDBX_subpage_broken
Definition: mdbx.h:5040
@ MDBX_page_leaf
Definition: mdbx.h:5036
LIBMDBX_API int mdbx_env_set_userctx(MDBX_env *env, void *ctx)
Sets application information (a context pointer) associated with the environment.
uint64_t mi_meta2_txnid
Definition: mdbx.h:2344
LIBMDBX_API int mdbx_env_get_flags(const MDBX_env *env, unsigned *flags)
Get environment flags.
@ MDBX_subpage_leaf
Definition: mdbx.h:5038
LIBMDBX_API int mdbx_cursor_open(MDBX_txn *txn, MDBX_dbi dbi, MDBX_cursor **cursor)
Create a cursor handle for the specified transaction and DBI handle.
@ MDBX_DUPFIXED
Definition: mdbx.h:1436
@ MDBX_opt_max_db
Controls the maximum number of named databases for the environment.
Definition: mdbx.h:1908
LIBMDBX_API int mdbx_env_create(MDBX_env **penv)
Create an MDBX environment instance.
@ MDBX_PREV_MULTIPLE
Definition: mdbx.h:1605
MDBX_NOTHROW_CONST_FUNCTION 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.
uint64_t txn_space_leftover
Definition: mdbx.h:3330
uint32_t write
Duration of writing dirty/modified data pages to a filesystem, i.e. the summary duration of a write()...
Definition: mdbx.h:3405
@ MDBX_SET_LOWERBOUND
Definition: mdbx.h:1619
@ MDBX_DBG_DUMP
Definition: mdbx.h:875
struct MDBX_envinfo::@3 mi_pgop_stat
@ 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:1968
MDBX_env_flags_t
Environment flags.
Definition: mdbx.h:964
const LIBMDBX_API char * mdbx_strerror_ANSI2OEM(int errnum)
#define MDBX_NOTHROW_PURE_FUNCTION
Definition: mdbx.h:270
uint32_t mi_autosync_period_seconds16dot16
Definition: mdbx.h:2372
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_txn_renew(MDBX_txn *txn)
Renew a read-only transaction.
LIBMDBX_API int mdbx_env_close_ex(MDBX_env *env, bool dont_sync)
Close the environment and release the memory map.
MDBX_NOTHROW_PURE_FUNCTION 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.
@ MDBX_BAD_TXN
Definition: mdbx.h:1724
@ MDBX_NOTFOUND
Definition: mdbx.h:1662
@ MDBX_TXN_TRY
Definition: mdbx.h:1397
LIBMDBX_API int mdbx_get_equal_or_great(MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key, MDBX_val *data)
Get equal or great item from a database.
libmdbx build information
Definition: mdbx.h:630
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.
uint64_t ms_overflow_pages
Definition: mdbx.h:2286
@ MDBX_INCOMPATIBLE
Definition: mdbx.h:1716
#define MDBX_DEPRECATED
Definition: mdbx.h:322
@ MDBX_UPSERT
Definition: mdbx.h:1474
Information about the environment.
Definition: mdbx.h:2328
@ MDBX_ACCEDE
Definition: mdbx.h:1046
MDBX_debug_flags_t
Runtime debug flags.
Definition: mdbx.h:857
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API uint64_t mdbx_txn_id(const MDBX_txn *txn)
Return the transaction's ID.
@ MDBX_MULTIPLE
Definition: mdbx.h:1510
Statistics for a database in the environment.
Definition: mdbx.h:2280
struct MDBX_version_info::@0 git
@ 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:1955
@ MDBX_LOG_EXTRA
Definition: mdbx.h:839
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API void * mdbx_txn_get_userctx(const MDBX_txn *txn)
Returns an application information (a context pointer) associated with the transaction.
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:2506
@ MDBX_READERS_FULL
Definition: mdbx.h:1687
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API int64_t mdbx_jsonInteger_from_key(const MDBX_val)
#define LIBMDBX_API
Definition: mdbx.h:592
@ MDBX_NEXT
Definition: mdbx.h:1572
@ MDBX_UNABLE_EXTEND_MAPSIZE
Definition: mdbx.h:1706
LIBMDBX_API int mdbx_env_get_option(const MDBX_env *env, const MDBX_option_t option, uint64_t *pvalue)
Gets the value of runtime options from an environment.
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.
@ MDBX_DBG_DONTCHANGE
Definition: mdbx.h:894
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:2524
@ MDBX_SUCCESS
Definition: mdbx.h:1647
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) MDBX_CXX17_NOEXCEPT
A Handle-Slow-Readers callback function to resolve database full/overflow issue due to a reader(s) wh...
Definition: mdbx.h:4985
MDBX_NOTHROW_PURE_FUNCTION 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.
uint64_t mi_unsync_volume
Definition: mdbx.h:2365
LIBMDBX_API int mdbx_dbi_flags_ex(MDBX_txn *txn, MDBX_dbi dbi, unsigned *flags, unsigned *state)
Retrieve the DB flags and status for a database handle.
@ MDBX_LOG_VERBOSE
Definition: mdbx.h:824
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:3000
LIBMDBX_API int mdbx_dbi_stat(MDBX_txn *txn, MDBX_dbi dbi, MDBX_stat *stat, size_t bytes)
Retrieve statistics for a database.
const LIBMDBX_API char * mdbx_strerror_r_ANSI2OEM(int errnum, char *buf, size_t buflen)
uint64_t cow
Definition: mdbx.h:2387
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.
uint64_t unspill
Definition: mdbx.h:2393
MDBX_NOTHROW_CONST_FUNCTION uint32_t mdbx_key_from_int32(const int32_t i32)
Definition: mdbx.h:3785
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.
void MDBX_debug_func(MDBX_log_level_t loglevel, const char *function, int line, const char *fmt, va_list args) MDBX_CXX17_NOEXCEPT
A debug-logger callback function, called before printing the message and aborting.
Definition: mdbx.h:908
@ MDBX_ENOFILE
Definition: mdbx.h:1802
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:2587
@ MDBX_EROFS
Definition: mdbx.h:1797
uint64_t x
Definition: mdbx.h:3582
LIBMDBX_API MDBX_dbi mdbx_cursor_dbi(const MDBX_cursor *cursor)
Return the cursor's database handle.
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API uint32_t mdbx_key_from_ptrfloat(const float *const ieee754_32bit)
LIBMDBX_API int mdbx_get_ex(MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key, MDBX_val *data, size_t *values_count)
Get items from a database and optionally number of data items for a given key.
LIBMDBX_API int mdbx_get_attr(MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key, MDBX_val *data, mdbx_attr_t *pattr)
@ MDBX_NOSUBDIR
Definition: mdbx.h:983
MDBX_NOTHROW_CONST_FUNCTION intptr_t mdbx_limits_pgsize_max(void)
Returns the maximal database page size in bytes.
Definition: mdbx.h:2941
MDBX_cursor_op
Cursor operations.
Definition: mdbx.h:1543
MDBX_NOTHROW_PURE_FUNCTION 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...
@ MDBX_LAST
Definition: mdbx.h:1566
uint64_t mi_meta2_sign
Definition: mdbx.h:2344
@ MDBX_EREMOTE
Definition: mdbx.h:1803
LIBMDBX_API int mdbx_cursor_put_attr(MDBX_cursor *cursor, MDBX_val *key, MDBX_val *data, mdbx_attr_t attr, MDBX_put_flags_t flags)
@ MDBX_DBG_LEGACY_MULTIOPEN
Definition: mdbx.h:878
uint64_t txn_id
Definition: mdbx.h:3298
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API MDBX_env * mdbx_txn_env(const MDBX_txn *txn)
Returns the transaction's MDBX_env.
struct MDBX_envinfo::@2::@4 meta2
uint_fast64_t mdbx_attr_t
Definition: mdbx.h:5089
@ MDBX_NOMEMINIT
Definition: mdbx.h:1144
@ MDBX_MAP_FULL
Definition: mdbx.h:1681
@ MDBX_COALESCE
Definition: mdbx.h:1156
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API void * mdbx_env_get_userctx(const MDBX_env *env)
Returns an application information (a context pointer) associated with the environment.
struct MDBX_env MDBX_env
Opaque structure for a database environment.
Definition: mdbx.h:692
uint32_t ending
Duration of transaction ending (releasing resources).
Definition: mdbx.h:3410
const char * commit
Definition: mdbx.h:621
@ MDBX_MAXDATASIZE
Definition: mdbx.h:768
pthread_t mdbx_tid_t
Definition: mdbx.h:198
MDBX_NOTHROW_PURE_FUNCTION 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.
uint32_t audit
Duration of internal audit if enabled.
Definition: mdbx.h:3402
@ MDBX_DBG_LEGACY_OVERLAP
Definition: mdbx.h:881
uint64_t mi_autosync_threshold
Definition: mdbx.h:2367
@ MDBX_ENOMEM
Definition: mdbx.h:1796
uint64_t ms_branch_pages
Definition: mdbx.h:2284
int(* MDBX_preserve_func)(void *context, MDBX_val *target, const void *src, size_t bytes)
Definition: mdbx.h:4149
@ MDBX_DBI_FRESH
Definition: mdbx.h:3855
@ MDBX_DB_DEFAULTS
Definition: mdbx.h:1419
LIBMDBX_API void mdbx_cursor_close(MDBX_cursor *cursor)
Close a cursor handle.
MDBX_NOTHROW_PURE_FUNCTION 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.
uint64_t mi_meta0_txnid
Definition: mdbx.h:2342
MDBX_NOTHROW_CONST_FUNCTION uint64_t mdbx_key_from_int64(const int64_t i64)
Definition: mdbx.h:3781
@ MDBX_PREV_NODUP
Definition: mdbx.h:1592
MDBX_NOTHROW_PURE_FUNCTION const LIBMDBX_API char * mdbx_liberr2str(int errnum)
@ MDBX_DBG_NONE
Definition: mdbx.h:858
void MDBX_assert_func(const MDBX_env *env, const char *msg, const char *function, unsigned line) MDBX_CXX17_NOEXCEPT
A callback function for most MDBX assert() failures, called before printing the message and aborting.
Definition: mdbx.h:928
@ MDBX_NODUPDATA
Definition: mdbx.h:1482
LIBMDBX_API int mdbx_drop(MDBX_txn *txn, MDBX_dbi dbi, bool del)
Empty or delete and close a database.
@ MDBX_MAX_PAGESIZE
Definition: mdbx.h:774
LIBMDBX_API int mdbx_del(MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *key, const MDBX_val *data)
Delete items from a database.
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.
@ MDBX_PAGEPERTURB
Definition: mdbx.h:1183
LIBMDBX_API int mdbx_txn_abort(MDBX_txn *txn)
Abandon all the operations of the transaction instead of saving them.
int mdbx_env_set_maxdbs(MDBX_env *env, MDBX_dbi dbs)
Set the maximum number of named databases for the environment.
Definition: mdbx.h:3046
uint8_t minor
Definition: mdbx.h:615
@ 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:2055
uint64_t mi_mapsize
Definition: mdbx.h:2336
@ MDBX_CURSOR_FULL
Definition: mdbx.h:1694
LIBMDBX_API int mdbx_cursor_set_userctx(MDBX_cursor *cursor, void *ctx)
Set application information associated with the MDBX_cursor.
LIBMDBX_API int mdbx_txn_break(MDBX_txn *txn)
Marks transaction as broken.
MDBX_DEPRECATED int mdbx_env_set_mapsize(MDBX_env *env, size_t size)
Definition: mdbx.h:2911
@ MDBX_LAST_ADDED_ERRCODE
Definition: mdbx.h:1774
MDBX_NOTHROW_CONST_FUNCTION LIBMDBX_API uint64_t mdbx_key_from_jsonInteger(const int64_t json_integer)
const char * flags
Definition: mdbx.h:635
uint64_t txn_space_retired
Definition: mdbx.h:3323
struct MDBX_envinfo::@2::@4 meta0
uint64_t current
Definition: mdbx.h:2332
@ MDBX_TXN_OVERLAPPING
Definition: mdbx.h:1771
LIBMDBX_API int mdbx_cursor_copy(const MDBX_cursor *src, MDBX_cursor *dest)
Copy cursor position and state.
@ MDBX_SET_RANGE
Definition: mdbx.h:1601
@ MDBX_VERSION_MISMATCH
Definition: mdbx.h:1675
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API float mdbx_float_from_key(const MDBX_val)
@ MDBX_REVERSEKEY
Definition: mdbx.h:1422
@ MDBX_LOG_WARN
Definition: mdbx.h:813
@ MDBX_EACCESS
Definition: mdbx.h:1795
@ MDBX_GET_CURRENT
Definition: mdbx.h:1558
@ MDBX_opt_max_readers
Defines the maximum number of threads/reader slots for all processes interacting with the database.
Definition: mdbx.h:1924
@ MDBX_NOMETASYNC
Definition: mdbx.h:1255
@ MDBX_page_meta
Definition: mdbx.h:5033
uint64_t lower
Definition: mdbx.h:2330
uint32_t MDBX_dbi
A handle for an individual database (key-value spaces) in the environment.
Definition: mdbx.h:715
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API int32_t mdbx_int32_from_key(const MDBX_val)
@ MDBX_PANIC
Definition: mdbx.h:1672
const LIBMDBX_API char * mdbx_dump_val(const MDBX_val *key, char *const buf, const size_t bufsize)
Dump given MDBX_val to the buffer.
@ MDBX_NOTLS
Definition: mdbx.h:1100
LIBMDBX_API int mdbx_txn_set_userctx(MDBX_txn *txn, void *ctx)
Sets application information associated (a context pointer) with the transaction.
uint32_t preparation
Duration of preparation (commit child transactions, update sub-databases records and cursors destroyi...
Definition: mdbx.h:3398
uint32_t mi_dxb_pagesize
Definition: mdbx.h:2347
@ MDBX_PROBLEM
Definition: mdbx.h:1735
@ MDBX_SET_UPPERBOUND
Definition: mdbx.h:1633
const char * datetime
Definition: mdbx.h:619
uint32_t ms_psize
Definition: mdbx.h:2281
MDBX_error_t
Errors and return codes.
Definition: mdbx.h:1645
@ MDBX_APPENDDUP
Definition: mdbx.h:1506
MDBX_constants
Definition: mdbx.h:763
MDBX_NOTHROW_CONST_FUNCTION 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 database flags, or -1 if pagesize is invali...
uint64_t mi_recent_txnid
Definition: mdbx.h:2338
uint32_t mi_mode
Definition: mdbx.h:2378
@ MDBX_DBG_AUDIT
Definition: mdbx.h:867
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.
@ MDBX_SYNC_DURABLE
Definition: mdbx.h:1237
uint32_t mi_numreaders
Definition: mdbx.h:2346
MDBX_option_t
MDBX environment options.
Definition: mdbx.h:1899
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.
LIBMDBX_API int mdbx_env_set_flags(MDBX_env *env, MDBX_env_flags_t flags, bool onoff)
Set environment flags.
MDBX_db_flags_t
Database flags.
Definition: mdbx.h:1417
LIBMDBX_API int mdbx_cursor_count(const MDBX_cursor *cursor, size_t *pcount)
Return count of duplicates for current key.
uint32_t revision
Definition: mdbx.h:617
uint64_t mi_self_latter_reader_txnid
Definition: mdbx.h:2340
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API size_t mdbx_default_pagesize(void)
Returns the default size of database page for the current system.
int mdbx_env_get_maxdbs(const MDBX_env *env, MDBX_dbi *dbs)
Get the maximum number of named databases for the environment.
Definition: mdbx.h:3060
uint64_t ms_mod_txnid
Definition: mdbx.h:2288
@ MDBX_NORDAHEAD
Definition: mdbx.h:1121
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)
MDBX_txn_flags_t
Definition: mdbx.h:1371
uint16_t release
Definition: mdbx.h:616
@ MDBX_FIRST_LMDB_ERRCODE
Definition: mdbx.h:1659
@ MDBX_DB_ACCEDE
Definition: mdbx.h:1459
@ MDBX_DBI_STALE
Definition: mdbx.h:3853
@ MDBX_MAPASYNC
Definition: mdbx.h:1313
MDBX_NOTHROW_PURE_FUNCTION 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 database.
Information about the transaction.
Definition: mdbx.h:3295
@ MDBX_page_dupfixed_leaf
Definition: mdbx.h:5037
uint64_t mi_last_pgno
Definition: mdbx.h:2337
@ MDBX_subpage_dupfixed_leaf
Definition: mdbx.h:5039
struct MDBX_envinfo::@2::@4 meta1
@ MDBX_LOG_NOTICE
Definition: mdbx.h:819
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:3015
@ MDBX_opt_dp_reserve_limit
Controls the in-process limit of a pre-allocated memory items for dirty pages.
Definition: mdbx.h:1982
@ MDBX_DBG_DONT_UPGRADE
Definition: mdbx.h:886
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.
@ MDBX_BAD_DBI
Definition: mdbx.h:1732
MDBX_NOTHROW_CONST_FUNCTION LIBMDBX_API uint64_t mdbx_key_from_double(const double ieee754_64bit)
LIBMDBX_API int mdbx_env_set_option(MDBX_env *env, const MDBX_option_t option, uint64_t value)
Sets the value of a runtime options for an environment.
LIBMDBX_API int mdbx_txn_info(const MDBX_txn *txn, MDBX_txn_info *info, bool scan_rlt)
Return information about the MDBX transaction.
@ MDBX_opt_spill_min_denominator
Controls the in-process how minimal part of the dirty pages should be spilled when necessary.
Definition: mdbx.h:2032
MDBX_NOTHROW_PURE_FUNCTION MDBX_DEPRECATED LIBMDBX_API int mdbx_env_get_maxkeysize(const MDBX_env *env)
@ MDBX_EINVAL
Definition: mdbx.h:1794
MDBX_put_flags_t
Data changing flags.
Definition: mdbx.h:1472
@ MDBX_FIRST
Definition: mdbx.h:1545
#define MDBX_PRINTF_ARGS(format_index, first_arg)
Definition: mdbx.h:470
uint64_t txn_space_dirty
Definition: mdbx.h:3337
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:2567
@ MDBX_INVALID
Definition: mdbx.h:1678
@ MDBX_LOG_FATAL
Definition: mdbx.h:801
@ MDBX_RDONLY
Definition: mdbx.h:1001
@ MDBX_SAFE_NOSYNC
Definition: mdbx.h:1306
@ MDBX_DBI_DIRTY
Definition: mdbx.h:3851
uint32_t ms_depth
Definition: mdbx.h:2283
uint32_t mi_maxreaders
Definition: mdbx.h:2345
LIBMDBX_API int mdbx_env_pgwalk(MDBX_txn *txn, MDBX_pgvisitor_func *visitor, void *ctx, bool dont_check_keys_ordering)
B-tree traversal function.
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API void * mdbx_cursor_get_userctx(const MDBX_cursor *cursor)
Get the application information associated with the MDBX_cursor.
uint64_t txn_space_used
Definition: mdbx.h:3308
@ MDBX_page_branch
Definition: mdbx.h:5035
MDBX_NOTHROW_PURE_FUNCTION 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 database.
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) MDBX_CXX17_NOEXCEPT
A callback function used to enumerate the reader lock table.
Definition: mdbx.h:4835
@ MDBX_opt_sync_bytes
Controls interprocess/shared threshold to force flush the data buffers to disk, if MDBX_SAFE_NOSYNC i...
Definition: mdbx.h:1930
@ MDBX_DBG_JITTER
Definition: mdbx.h:871
@ MDBX_LOG_ERROR
Definition: mdbx.h:807
@ MDBX_NOOVERWRITE
Definition: mdbx.h:1477
@ MDBX_MIN_PAGESIZE
Definition: mdbx.h:771
@ MDBX_opt_txn_dp_limit
Controls the in-process limit of dirty pages for a write transaction.
Definition: mdbx.h:1996
struct MDBX_envinfo::@2 mi_bootid
A mostly unique ID that is regenerated on each boot.
uint64_t x
Definition: mdbx.h:2360
LIBMDBX_API int mdbx_canary_get(const MDBX_txn *txn, MDBX_canary *canary)
Returns fours integers markers (aka "canary") associated with the environment.
LIBMDBX_API int mdbx_cursor_put(MDBX_cursor *cursor, const MDBX_val *key, MDBX_val *data, MDBX_put_flags_t flags)
Store by cursor.
uint64_t grow
Definition: mdbx.h:2334
uint64_t shrink
Definition: mdbx.h:2333
LIBMDBX_API int mdbx_env_turn_for_recovery(MDBX_env *env, unsigned target_meta)
Turn database to the specified meta-page.
const LIBMDBX_API char * mdbx_strerror(int errnum)
Return a string describing a given error code.
uint32_t gc
Duration of GC/freeDB handling & updation.
Definition: mdbx.h:3400
#define MDBX_NOTHROW_CONST_FUNCTION
Definition: mdbx.h:311
MDBX_NOTHROW_CONST_FUNCTION 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 database flags, or -1 if pagesize is inval...
@ MDBX_PREV
Definition: mdbx.h:1586
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 database.
uint64_t txn_space_limit_soft
Definition: mdbx.h:3311
MDBX_DEPRECATED 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)
LIBMDBX_API int mdbx_get(MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *key, MDBX_val *data)
Get items from a database.
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API int mdbx_txn_flags(const MDBX_txn *txn)
Return the transaction's flags.
LIBMDBX_API int mdbx_env_set_assert(MDBX_env *env, MDBX_assert_func *func)
Set or reset the assert() callback of the environment.
Latency of commit stages in 1/65536 of seconds units.
Definition: mdbx.h:3395
#define LIBMDBX_VERINFO_API
Definition: mdbx.h:609
LIBMDBX_API void mdbx_panic(const char *fmt,...) MDBX_PRINTF_ARGS(1
Panics with message and causes abnormal process termination.
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 database.
uint64_t mi_meta1_sign
Definition: mdbx.h:2343
uint64_t mi_meta1_txnid
Definition: mdbx.h:2343
MDBX_DEPRECATED int mdbx_env_info(const MDBX_env *env, MDBX_envinfo *info, size_t bytes)
Return information about the MDBX environment.
Definition: mdbx.h:2427
@ MDBX_TXN_READWRITE
Definition: mdbx.h:1376
@ MDBX_GET_MULTIPLE
Definition: mdbx.h:1563
@ MDBX_TXN_RDONLY
Definition: mdbx.h:1382
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:3408
MDBX_page_type_t
Page types for traverse the b-tree.
Definition: mdbx.h:5031
@ MDBX_REVERSEDUP
Definition: mdbx.h:1444
@ MDBX_SET
Definition: mdbx.h:1595
uint64_t y
Definition: mdbx.h:3582
const char * tree
Definition: mdbx.h:620
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API MDBX_txn * mdbx_cursor_txn(const MDBX_cursor *cursor)
Return the cursor's transaction handle.
const char * target
Definition: mdbx.h:632
MDBX_DEPRECATED LIBMDBX_API int mdbx_txn_straggler(const MDBX_txn *txn, int *percent)
Returns a lag of the reading for the given transaction.
struct MDBX_txn MDBX_txn
Opaque structure for a transaction handle.
Definition: mdbx.h:703
@ MDBX_page_large
Definition: mdbx.h:5034
@ MDBX_page_broken
Definition: mdbx.h:5032
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.
#define MDBX_CXX17_NOEXCEPT
Definition: mdbx.h:393
const char * datetime
Definition: mdbx.h:631
@ MDBX_BAD_RSLOT
Definition: mdbx.h:1720
uint64_t mi_meta0_sign
Definition: mdbx.h:2342
@ MDBX_RESULT_FALSE
Definition: mdbx.h:1650
@ MDBX_TXN_RDONLY_PREPARE
Definition: mdbx.h:1391
LIBMDBX_API int mdbx_dbi_sequence(MDBX_txn *txn, MDBX_dbi dbi, uint64_t *result, uint64_t increment)
Sequence generation for a database.
@ MDBX_APPEND
Definition: mdbx.h:1501
LIBMDBX_API int mdbx_dbi_close(MDBX_env *env, MDBX_dbi dbi)
Close a database handle. Normally unnecessary.
@ MDBX_CURRENT
Definition: mdbx.h:1488
@ MDBX_LOG_DEBUG
Definition: mdbx.h:829
uint64_t newly
Definition: mdbx.h:2386
@ MDBX_THREAD_MISMATCH
Definition: mdbx.h:1768
@ MDBX_NEXT_NODUP
Definition: mdbx.h:1583
LIBMDBX_API int mdbx_env_get_fd(const MDBX_env *env, mdbx_filehandle_t *fd)
Return the file descriptor for the given environment.
@ MDBX_LOG_DONTCHANGE
Definition: mdbx.h:846
@ MDBX_TOO_LARGE
Definition: mdbx.h:1764
uint64_t y
Definition: mdbx.h:2360
uint64_t txn_space_limit_hard
Definition: mdbx.h:3315
LIBMDBX_API int mdbx_dbi_open(MDBX_txn *txn, const char *name, MDBX_db_flags_t flags, MDBX_dbi *dbi)
Open or Create a database in the environment.
@ MDBX_LOG_TRACE
Definition: mdbx.h:834
LIBMDBX_API int mdbx_txn_reset(MDBX_txn *txn)
Reset a read-only transaction.
@ MDBX_WANNA_RECOVERY
Definition: mdbx.h:1757
@ MDBX_LIFORECLAIM
Definition: mdbx.h:1180
const char * describe
Definition: mdbx.h:622
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 ...
uint32_t whole
The total duration of a commit.
Definition: mdbx.h:3412
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...
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API int64_t mdbx_int64_from_key(const MDBX_val)
@ MDBX_EINTR
Definition: mdbx.h:1801
@ MDBX_DBS_FULL
Definition: mdbx.h:1684
@ MDBX_INTEGERDUP
Definition: mdbx.h:1441
struct MDBX_envinfo::@1 mi_geo
LIBMDBX_API int mdbx_dbi_dupsort_depthmask(MDBX_txn *txn, MDBX_dbi dbi, uint32_t *mask)
Retrieve depth (bitmask) information of nested dupsort (multi-value) B+trees for given database.
@ MDBX_GET_BOTH_RANGE
Definition: mdbx.h:1555
@ MDBX_RESULT_TRUE
Definition: mdbx.h:1653
pid_t mdbx_pid_t
Definition: mdbx.h:197
@ MDBX_KEYEXIST
Definition: mdbx.h:1656
int MDBX_pgvisitor_func(const uint64_t pgno, const unsigned number, void *const ctx, const int deep, const char *const dbi, const size_t page_size, const MDBX_page_type_t type, const MDBX_error_t err, const size_t nentries, const size_t payload_bytes, const size_t header_bytes, const size_t unused_bytes) MDBX_CXX17_NOEXCEPT
Callback function for traverse the b-tree.
Definition: mdbx.h:5054
@ MDBX_EKEYMISMATCH
Definition: mdbx.h:1760
@ MDBX_ALLDUPS
Definition: mdbx.h:1493
LIBMDBX_API MDBX_cursor * mdbx_cursor_create(void *context)
Create a cursor handle but not bind it to transaction nor DBI handle.
@ MDBX_NEXT_DUP
Definition: mdbx.h:1575
@ MDBX_LAST_DUP
Definition: mdbx.h:1569
@ MDBX_WRITEMAP
Definition: mdbx.h:1077
@ MDBX_ENODATA
Definition: mdbx.h:1792
@ MDBX_PREV_DUP
Definition: mdbx.h:1589
MDBX_DEPRECATED int mdbx_env_stat(const MDBX_env *env, MDBX_stat *stat, size_t bytes)
Return statistics about the MDBX environment.
Definition: mdbx.h:2320
struct iovec MDBX_val
Generic structure used for passing keys and data in and out of the database.
Definition: mdbx.h:760
@ MDBX_FIRST_ADDED_ERRCODE
Definition: mdbx.h:1745
@ MDBX_BUSY
Definition: mdbx.h:1742
MDBX_NOTHROW_PURE_FUNCTION 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_FIRST_DUP
Definition: mdbx.h:1548
mode_t mdbx_mode_t
Definition: mdbx.h:199
LIBMDBX_API int mdbx_cursor_renew(MDBX_txn *txn, MDBX_cursor *cursor)
Renew a cursor handle.
@ MDBX_LAST_LMDB_ERRCODE
Definition: mdbx.h:1738
LIBMDBX_API int mdbx_cursor_del(MDBX_cursor *cursor, MDBX_put_flags_t flags)
Delete current key/data pair.
@ MDBX_DBG_ASSERT
Definition: mdbx.h:863
uint64_t ms_entries
Definition: mdbx.h:2287
int mdbx_txn_commit(MDBX_txn *txn)
Commit all the operations of a transaction into the database.
Definition: mdbx.h:3463
@ MDBX_ENV_DEFAULTS
Definition: mdbx.h:965
uint64_t merge
Definition: mdbx.h:2391
@ MDBX_EIO
Definition: mdbx.h:1799
@ MDBX_INTEGERKEY
Definition: mdbx.h:1432
int mdbx_env_close(MDBX_env *env)
The shortcut to calling mdbx_env_close_ex() with the dont_sync=false argument.
Definition: mdbx.h:2643
@ MDBX_EPERM
Definition: mdbx.h:1800
#define DEFINE_ENUM_FLAG_OPERATORS(ENUM)
Definition: mdbx.h:555
@ MDBX_EMULTIVAL
Definition: mdbx.h:1748
@ MDBX_GET_BOTH
Definition: mdbx.h:1551
LIBMDBX_VERINFO_API const struct MDBX_version_info mdbx_version
libmdbx version information
uint64_t mi_latter_reader_txnid
Definition: mdbx.h:2339
@ MDBX_opt_merge_threshold_16dot16_percent
Controls the in-process threshold of semi-empty pages merge.
Definition: mdbx.h:2066
@ MDBX_DUPSORT
Definition: mdbx.h:1425
uint32_t mi_since_reader_check_seconds16dot16
Definition: mdbx.h:2375
The fours integers markers (aka "canary") associated with the environment.
Definition: mdbx.h:3581
@ MDBX_ENOSYS
Definition: mdbx.h:1798
MDBX_NOTHROW_PURE_FUNCTION 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...
const LIBMDBX_API char * mdbx_strerror_r(int errnum, char *buf, size_t buflen)
Return a string describing a given error code.
LIBMDBX_API int mdbx_put_attr(MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key, MDBX_val *data, mdbx_attr_t attr, MDBX_put_flags_t flags)
@ MDBX_DBI_CREAT
Definition: mdbx.h:3857
@ MDBX_opt_sync_period
Controls interprocess/shared relative period since the last unsteady commit to force flush the data b...
Definition: mdbx.h:1936
MDBX_log_level_t
Definition: mdbx.h:797
const char * options
Definition: mdbx.h:633
uint8_t major
Definition: mdbx.h:614
@ MDBX_TXN_NOSYNC
Definition: mdbx.h:1405
uint64_t spill
Definition: mdbx.h:2392
int() MDBX_cmp_func(const MDBX_val *a, const MDBX_val *b) MDBX_CXX17_NOEXCEPT
A callback function used to compare two keys in a database.
Definition: mdbx.h:3641
MDBX_NOTHROW_CONST_FUNCTION 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.
@ MDBX_CREATE
Definition: mdbx.h:1447
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.
uint64_t wops
Definition: mdbx.h:2394
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 ...
struct MDBX_cursor MDBX_cursor
Opaque structure for navigating through a database.
Definition: mdbx.h:722
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_estimate_range(MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *begin_key, MDBX_val *begin_data, MDBX_val *end_key, MDBX_val *end_data, ptrdiff_t *distance_items)
Estimates the size of a range as a number of elements.