libmdbx 0.13.2.0 (2024-12-11T21:51:56+03:00)
One of the fastest compact embeddable key-value ACID storage engine without WAL.
 
Loading...
Searching...
No Matches
mdbx.h File Reference

The libmdbx C API header file. More...

#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <assert.h>
#include <errno.h>
#include <pthread.h>
#include <sys/types.h>
#include <sys/uio.h>

Go to the source code of this file.

Classes

struct  MDBX_version_info
 libmdbx version information, More...
 
struct  MDBX_build_info
 libmdbx build information More...
 
struct  MDBX_stat
 Statistics for a table in the environment. More...
 
struct  MDBX_envinfo
 Information about the environment. More...
 
struct  MDBX_txn_info
 Information about the transaction. More...
 
struct  MDBX_commit_latency
 Latency of commit stages in 1/65536 of seconds units. More...
 
struct  MDBX_canary
 The fours integers markers (aka "canary") associated with the environment. More...
 
struct  MDBX_chk_line_t
 Виртуальная строка отчета, формируемого при проверке целостности базы данных. More...
 
struct  MDBX_chk_issue_t
 Проблема обнаруженная при проверке целостности базы данных. More...
 
struct  MDBX_chk_scope_t
 Иерархический контекст при проверке целостности базы данных. More...
 
struct  MDBX_chk_histogram
 Гистограмма с некоторой статистической информацией, собираемой при проверке целостности БД. More...
 
struct  MDBX_chk_table_t
 Информация о некоторой таблицей ключ-значение, при проверке целостности базы данных. More...
 
struct  MDBX_chk_context_t
 Контекст проверки целостности базы данных. More...
 
struct  MDBX_chk_callbacks_t
 Набор функций обратного вызова используемых при проверке целостности базы данных. More...
 
struct  MDBX_version_info.git
 
struct  MDBX_envinfo.mi_geo
 
struct  MDBX_envinfo.mi_bootid
 A mostly unique ID that is regenerated on each boot. More...
 
struct  MDBX_envinfo.mi_bootid.current
 
struct  MDBX_envinfo.mi_bootid.meta
 
struct  MDBX_envinfo.mi_pgop_stat
 
struct  MDBX_envinfo.mi_dxbid
 
struct  MDBX_commit_latency.gc_prof
 Информация для профилирования работы GC. More...
 
union  MDBX_chk_scope_t.usr_z
 
union  MDBX_chk_scope_t.usr_v
 
union  MDBX_chk_scope_t.usr_o
 
struct  MDBX_chk_histogram.ranges
 
struct  MDBX_chk_table_t.pages
 
struct  MDBX_chk_table_t.histogram
 
struct  MDBX_chk_context_t.result
 

Macros

#define LIBMDBX_H
 
#define __has_c_attribute(x)   (0)
 
#define __has_c_attribute_qualified(x)   0
 
#define __has_cpp_attribute_qualified(x)   0
 
#define __has_C23_or_CXX_attribute(x)   __has_c_attribute_qualified(x)
 
#define __has_exceptions_disabled   (0)
 
#define MDBX_PURE_FUNCTION   [[gnu::pure]]
 The 'pure' function attribute for optimization.
 
#define MDBX_NOTHROW_PURE_FUNCTION   [[gnu::pure, gnu::nothrow]]
 The 'pure nothrow' function attribute for optimization.
 
#define MDBX_CONST_FUNCTION   [[gnu::const]]
 The 'const' function attribute for optimization.
 
#define MDBX_NOTHROW_CONST_FUNCTION   [[gnu::const, gnu::nothrow]]
 The 'const nothrow' function attribute for optimization.
 
#define LIBMDBX_INLINE_API(TYPE, NAME, ARGS)   static __inline TYPE NAME ARGS
 Auxiliary macro for robustly define the both inline version of API function and non-inline fallback dll-exported version for applications linked with old version of libmdbx, with a strictly ODR-common implementation. Thus, we emulate __extern_inline for all compilers, including non-GNU ones.
 
#define MDBX_CXX17_NOEXCEPT   noexcept
 
#define MDBX_CXX01_CONSTEXPR   constexpr
 
#define MDBX_CXX01_CONSTEXPR_VAR   constexpr
 
#define MDBX_CXX11_CONSTEXPR   constexpr
 
#define MDBX_CXX11_CONSTEXPR_VAR   constexpr
 
#define MDBX_CXX14_CONSTEXPR   constexpr
 
#define MDBX_CXX14_CONSTEXPR_VAR   constexpr
 
#define MDBX_NORETURN   [[noreturn]]
 
#define MDBX_MAYBE_UNUSED   [[maybe_unused]]
 
#define MDBX_VERSION_MAJOR   0
 
#define MDBX_VERSION_MINOR   13
 
#define LIBMDBX_API   __dll_export
 
#define LIBMDBX_API_TYPE
 
#define LIBMDBX_VERINFO_API   __dll_export
 
#define MDBX_LOCKNAME   "/mdbx.lck"
 The name of the lock file in the environment without using MDBX_NOSUBDIR.
 
#define MDBX_DATANAME   "/mdbx.dat"
 The name of the data file in the environment without using MDBX_NOSUBDIR.
 
#define MDBX_LOCK_SUFFIX   "-lck"
 The suffix of the lock file when MDBX_NOSUBDIR is used.
 
#define MDBX_LOGGER_DONTCHANGE   ((MDBX_debug_func *)(intptr_t)-1)
 The "don't change `logger`" value for mdbx_setup_debug()
 
#define MDBX_LOGGER_NOFMT_DONTCHANGE   ((MDBX_debug_func_nofmt *)(intptr_t)-1)
 
#define MDBX_MAP_RESIZED   MDBX_MAP_RESIZED_is_deprecated()
 
#define mdbx_env_openT(env, pathname, flags, mode)   mdbx_env_openW(env, pathname, flags, mode)
 
#define mdbx_env_deleteT(pathname, mode)   mdbx_env_deleteW(pathname, mode)
 
#define mdbx_env_copyT(env, dest, flags)   mdbx_env_copyW(env, dest, flags)
 
#define mdbx_txn_copy2pathnameT(txn, dest, flags)   mdbx_txn_copy2pathnameW(txn, dest, path)
 
#define mdbx_env_get_pathT(env, dest)   mdbx_env_get_pathW(env, dest)
 
#define MDBX_EPSILON   ((MDBX_val *)((ptrdiff_t)-1))
 The EPSILON value for mdbx_estimate_range()
 
#define mdbx_env_open_for_recoveryT(env, pathname, target_mets, writeable)    mdbx_env_open_for_recoveryW(env, pathname, target_mets, writeable)
 
#define mdbx_preopen_snapinfoT(pathname, info, bytes)   mdbx_preopen_snapinfoW(pathname, info, bytes)
 
#define MDBX_CHK_MAIN   ((void *)((ptrdiff_t)0))
 Pseudo-name for MainDB.
 
#define MDBX_CHK_GC   ((void *)((ptrdiff_t)-1))
 Pseudo-name for GarbageCollectorDB.
 
#define MDBX_CHK_META   ((void *)((ptrdiff_t)-2))
 Pseudo-name for MetaPages.
 

Typedefs

typedef int mdbx_filehandle_t
 
typedef pid_t mdbx_pid_t
 
typedef pthread_t mdbx_tid_t
 
typedef mode_t mdbx_mode_t
 
typedef struct MDBX_env MDBX_env
 Opaque structure for a database environment.
 
typedef struct MDBX_txn MDBX_txn
 Opaque structure for a transaction handle.
 
typedef uint32_t MDBX_dbi
 A handle for an individual table (key-value spaces) in the environment.
 
typedef struct MDBX_cursor MDBX_cursor
 Opaque structure for navigating through a table.
 
typedef struct iovec MDBX_val
 Generic structure used for passing keys and data in and out of the table. .
 
typedef 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.
 
typedef void MDBX_debug_func_nofmt(MDBX_log_level_t loglevel, const char *function, int line, const char *msg, unsigned length) noexcept
 
typedef 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.
 
typedef int() MDBX_cmp_func(const MDBX_val *a, const MDBX_val *b) noexcept
 A callback function used to compare two keys in a table.
 
typedef 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
 Функция обратного вызова для перечисления пользовательских именованных таблиц.
 
typedef int(* MDBX_preserve_func) (void *context, MDBX_val *target, const void *src, size_t bytes)
 
typedef int() MDBX_predicate_func(void *context, MDBX_val *key, MDBX_val *value, void *arg) noexcept
 Тип предикативных функций обратного вызова используемых mdbx_cursor_scan() и mdbx_cursor_scan_from() для пробирования пар ключ-значения.
 
typedef 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.
 
typedef 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) which prevents the old data from being recycled.
 
typedef struct MDBX_chk_user_table_cookie MDBX_chk_user_table_cookie_t
 Пользовательский тип для привязки дополнительных данных, связанных с некоторой таблицей ключ-значение, при проверке целостности базы данных.
 

Enumerations

enum  MDBX_constants { MDBX_MAX_DBI = UINT32_C(32765) , MDBX_MAXDATASIZE = UINT32_C(0x7fff0000) , MDBX_MIN_PAGESIZE = 256 , MDBX_MAX_PAGESIZE = 65536 }
 
enum  MDBX_log_level_t {
  MDBX_LOG_FATAL = 0 , MDBX_LOG_ERROR = 1 , MDBX_LOG_WARN = 2 , MDBX_LOG_NOTICE = 3 ,
  MDBX_LOG_VERBOSE = 4 , MDBX_LOG_DEBUG = 5 , MDBX_LOG_TRACE = 6 , MDBX_LOG_EXTRA = 7 ,
  MDBX_LOG_DONTCHANGE = -1
}
 
enum  MDBX_debug_flags_t {
  MDBX_DBG_NONE = 0 , MDBX_DBG_ASSERT = 1 , MDBX_DBG_AUDIT = 2 , MDBX_DBG_JITTER = 4 ,
  MDBX_DBG_DUMP = 8 , MDBX_DBG_LEGACY_MULTIOPEN = 16 , MDBX_DBG_LEGACY_OVERLAP = 32 , MDBX_DBG_DONT_UPGRADE = 64 ,
  MDBX_DBG_DONTCHANGE = -1
}
 Runtime debug flags. More...
 
enum  MDBX_env_flags_t {
  MDBX_ENV_DEFAULTS = 0 , MDBX_VALIDATION = UINT32_C(0x00002000) , MDBX_NOSUBDIR = UINT32_C(0x4000) , MDBX_RDONLY = UINT32_C(0x20000) ,
  MDBX_EXCLUSIVE = UINT32_C(0x400000) , MDBX_ACCEDE = UINT32_C(0x40000000) , MDBX_WRITEMAP = UINT32_C(0x80000) , MDBX_NOSTICKYTHREADS = UINT32_C(0x200000) ,
  MDBX_NOTLS = MDBX_NOSTICKYTHREADS , MDBX_NORDAHEAD = UINT32_C(0x800000) , MDBX_NOMEMINIT = UINT32_C(0x1000000) , MDBX_COALESCE = UINT32_C(0x2000000) ,
  MDBX_LIFORECLAIM = UINT32_C(0x4000000) , MDBX_PAGEPERTURB = UINT32_C(0x8000000) , MDBX_SYNC_DURABLE = 0 , MDBX_NOMETASYNC = UINT32_C(0x40000) ,
  MDBX_SAFE_NOSYNC = UINT32_C(0x10000) , MDBX_MAPASYNC = MDBX_SAFE_NOSYNC , MDBX_UTTERLY_NOSYNC = MDBX_SAFE_NOSYNC | UINT32_C(0x100000)
}
 Environment flags. More...
 
enum  MDBX_txn_flags_t {
  MDBX_TXN_READWRITE = 0 , MDBX_TXN_RDONLY = MDBX_RDONLY , MDBX_TXN_RDONLY_PREPARE = MDBX_RDONLY | MDBX_NOMEMINIT , MDBX_TXN_TRY = UINT32_C(0x10000000) ,
  MDBX_TXN_NOMETASYNC = MDBX_NOMETASYNC , MDBX_TXN_NOSYNC = MDBX_SAFE_NOSYNC , MDBX_TXN_INVALID = INT32_MIN , MDBX_TXN_FINISHED = 0x01 ,
  MDBX_TXN_ERROR = 0x02 , MDBX_TXN_DIRTY = 0x04 , MDBX_TXN_SPILLS = 0x08 , MDBX_TXN_HAS_CHILD = 0x10 ,
  MDBX_TXN_PARKED = 0x20 , MDBX_TXN_AUTOUNPARK = 0x40 , MDBX_TXN_OUSTED = 0x80 , MDBX_TXN_BLOCKED = MDBX_TXN_FINISHED | MDBX_TXN_ERROR | MDBX_TXN_HAS_CHILD | MDBX_TXN_PARKED
}
 
enum  MDBX_db_flags_t {
  MDBX_DB_DEFAULTS = 0 , MDBX_REVERSEKEY = UINT32_C(0x02) , MDBX_DUPSORT = UINT32_C(0x04) , MDBX_INTEGERKEY = UINT32_C(0x08) ,
  MDBX_DUPFIXED = UINT32_C(0x10) , MDBX_INTEGERDUP = UINT32_C(0x20) , MDBX_REVERSEDUP = UINT32_C(0x40) , MDBX_CREATE = UINT32_C(0x40000) ,
  MDBX_DB_ACCEDE = MDBX_ACCEDE
}
 Table flags. More...
 
enum  MDBX_put_flags_t {
  MDBX_UPSERT = 0 , MDBX_NOOVERWRITE = UINT32_C(0x10) , MDBX_NODUPDATA = UINT32_C(0x20) , MDBX_CURRENT = UINT32_C(0x40) ,
  MDBX_ALLDUPS = UINT32_C(0x80) , MDBX_RESERVE = UINT32_C(0x10000) , MDBX_APPEND = UINT32_C(0x20000) , MDBX_APPENDDUP = UINT32_C(0x40000) ,
  MDBX_MULTIPLE = UINT32_C(0x80000)
}
 Data changing flags. More...
 
enum  MDBX_copy_flags_t {
  MDBX_CP_DEFAULTS = 0 , MDBX_CP_COMPACT = 1u , MDBX_CP_FORCE_DYNAMIC_SIZE = 2u , MDBX_CP_DONT_FLUSH = 4u ,
  MDBX_CP_THROTTLE_MVCC = 8u , MDBX_CP_DISPOSE_TXN = 16u , MDBX_CP_RENEW_TXN = 32u
}
 Environment copy flags. More...
 
enum  MDBX_cursor_op {
  MDBX_FIRST , MDBX_FIRST_DUP , MDBX_GET_BOTH , MDBX_GET_BOTH_RANGE ,
  MDBX_GET_CURRENT , MDBX_GET_MULTIPLE , MDBX_LAST , MDBX_LAST_DUP ,
  MDBX_NEXT , MDBX_NEXT_DUP , MDBX_NEXT_MULTIPLE , MDBX_NEXT_NODUP ,
  MDBX_PREV , MDBX_PREV_DUP , MDBX_PREV_NODUP , MDBX_SET ,
  MDBX_SET_KEY , MDBX_SET_RANGE , MDBX_PREV_MULTIPLE , MDBX_SET_LOWERBOUND ,
  MDBX_SET_UPPERBOUND , MDBX_TO_KEY_LESSER_THAN , MDBX_TO_KEY_LESSER_OR_EQUAL , MDBX_TO_KEY_EQUAL ,
  MDBX_TO_KEY_GREATER_OR_EQUAL , MDBX_TO_KEY_GREATER_THAN , MDBX_TO_EXACT_KEY_VALUE_LESSER_THAN , MDBX_TO_EXACT_KEY_VALUE_LESSER_OR_EQUAL ,
  MDBX_TO_EXACT_KEY_VALUE_EQUAL , MDBX_TO_EXACT_KEY_VALUE_GREATER_OR_EQUAL , MDBX_TO_EXACT_KEY_VALUE_GREATER_THAN , MDBX_TO_PAIR_LESSER_THAN ,
  MDBX_TO_PAIR_LESSER_OR_EQUAL , MDBX_TO_PAIR_EQUAL , MDBX_TO_PAIR_GREATER_OR_EQUAL , MDBX_TO_PAIR_GREATER_THAN
}
 Cursor operationsThis is the set of all operations for retrieving data using a cursor. More...
 
enum  MDBX_error_t {
  MDBX_SUCCESS = 0 , MDBX_RESULT_FALSE = MDBX_SUCCESS , MDBX_RESULT_TRUE = -1 , MDBX_KEYEXIST = -30799 ,
  MDBX_FIRST_LMDB_ERRCODE = MDBX_KEYEXIST , MDBX_NOTFOUND = -30798 , MDBX_PAGE_NOTFOUND = -30797 , MDBX_CORRUPTED = -30796 ,
  MDBX_PANIC = -30795 , MDBX_VERSION_MISMATCH = -30794 , MDBX_INVALID = -30793 , MDBX_MAP_FULL = -30792 ,
  MDBX_DBS_FULL = -30791 , MDBX_READERS_FULL = -30790 , MDBX_TXN_FULL = -30788 , MDBX_CURSOR_FULL = -30787 ,
  MDBX_PAGE_FULL = -30786 , MDBX_UNABLE_EXTEND_MAPSIZE = -30785 , MDBX_INCOMPATIBLE = -30784 , MDBX_BAD_RSLOT = -30783 ,
  MDBX_BAD_TXN = -30782 , MDBX_BAD_VALSIZE = -30781 , MDBX_BAD_DBI = -30780 , MDBX_PROBLEM = -30779 ,
  MDBX_LAST_LMDB_ERRCODE = MDBX_PROBLEM , MDBX_BUSY = -30778 , MDBX_FIRST_ADDED_ERRCODE = MDBX_BUSY , MDBX_EMULTIVAL = -30421 ,
  MDBX_EBADSIGN = -30420 , MDBX_WANNA_RECOVERY = -30419 , MDBX_EKEYMISMATCH = -30418 , MDBX_TOO_LARGE = -30417 ,
  MDBX_THREAD_MISMATCH = -30416 , MDBX_TXN_OVERLAPPING = -30415 , MDBX_BACKLOG_DEPLETED = -30414 , MDBX_DUPLICATED_CLK = -30413 ,
  MDBX_DANGLING_DBI = -30412 , MDBX_OUSTED = -30411 , MDBX_MVCC_RETARDED = -30410 , MDBX_LAST_ADDED_ERRCODE = MDBX_MVCC_RETARDED ,
  MDBX_ENODATA = 9919 , MDBX_EINVAL = EINVAL , MDBX_EACCESS = EACCES , MDBX_ENOMEM = ENOMEM ,
  MDBX_EROFS = EROFS , MDBX_ENOSYS = ENOSYS , MDBX_EIO = EIO , MDBX_EPERM = EPERM ,
  MDBX_EINTR = EINTR , MDBX_ENOFILE = ENOENT , MDBX_EREMOTE = ENOTBLK , MDBX_EDEADLK = EDEADLK
}
 Errors and return codes. More...
 
enum  MDBX_option_t {
  MDBX_opt_max_db , MDBX_opt_max_readers , MDBX_opt_sync_bytes , MDBX_opt_sync_period ,
  MDBX_opt_rp_augment_limit , MDBX_opt_loose_limit , MDBX_opt_dp_reserve_limit , MDBX_opt_txn_dp_limit ,
  MDBX_opt_txn_dp_initial , MDBX_opt_spill_max_denominator , MDBX_opt_spill_min_denominator , MDBX_opt_spill_parent4child_denominator ,
  MDBX_opt_merge_threshold_16dot16_percent , MDBX_opt_writethrough_threshold , MDBX_opt_prefault_write_enable , MDBX_opt_gc_time_limit ,
  MDBX_opt_prefer_waf_insteadof_balance , MDBX_opt_subpage_limit , MDBX_opt_subpage_room_threshold , MDBX_opt_subpage_reserve_prereq ,
  MDBX_opt_subpage_reserve_limit
}
 MDBX environment extra runtime options. More...
 
enum  MDBX_env_delete_mode_t { MDBX_ENV_JUST_DELETE = 0 , MDBX_ENV_ENSURE_UNUSED = 1 , MDBX_ENV_WAIT_FOR_UNUSED = 2 }
 Deletion modes for mdbx_env_delete(). More...
 
enum  MDBX_warmup_flags_t {
  MDBX_warmup_default = 0 , MDBX_warmup_force = 1 , MDBX_warmup_oomsafe = 2 , MDBX_warmup_lock = 4 ,
  MDBX_warmup_touchlimit = 8 , MDBX_warmup_release = 16
}
 Warming up options. More...
 
enum  MDBX_dbi_state_t { MDBX_DBI_DIRTY = 0x01 , MDBX_DBI_STALE = 0x02 , MDBX_DBI_FRESH = 0x04 , MDBX_DBI_CREAT = 0x08 }
 DBI state bits returted by mdbx_dbi_flags_ex() More...
 
enum  MDBX_chk_flags_t {
  MDBX_CHK_DEFAULTS = 0 , MDBX_CHK_READWRITE = 1 , MDBX_CHK_SKIP_BTREE_TRAVERSAL = 2 , MDBX_CHK_SKIP_KV_TRAVERSAL = 4 ,
  MDBX_CHK_IGNORE_ORDER = 8
}
 Флаги/опции для проверки целостности базы данных. More...
 
enum  MDBX_chk_severity_t {
  MDBX_chk_severity_prio_shift = 4 , MDBX_chk_severity_kind_mask = 0xF , MDBX_chk_fatal = 0x00u , MDBX_chk_error = 0x11u ,
  MDBX_chk_warning = 0x22u , MDBX_chk_notice = 0x33u , MDBX_chk_result = 0x44u , MDBX_chk_resolution = 0x55u ,
  MDBX_chk_processing = 0x56u , MDBX_chk_info = 0x67u , MDBX_chk_verbose = 0x78u , MDBX_chk_details = 0x89u ,
  MDBX_chk_extra = 0x9Au
}
 Уровни логирование/детализации информации, поставляемой через обратные вызовы при проверке целостности базы данных. More...
 
enum  MDBX_chk_stage_t {
  MDBX_chk_none , MDBX_chk_init , MDBX_chk_lock , MDBX_chk_meta ,
  MDBX_chk_tree , MDBX_chk_gc , MDBX_chk_space , MDBX_chk_maindb ,
  MDBX_chk_tables , MDBX_chk_conclude , MDBX_chk_unlock , MDBX_chk_finalize
}
 Стадии проверки, сообщаемые через обратные вызовы при проверке целостности базы данных. More...
 

Functions

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)
 
LIBMDBX_API int mdbx_env_set_assert (MDBX_env *env, MDBX_assert_func *func)
 Set or reset the assert() callback of the environment.
 
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.
 
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.
 
LIBMDBX_API const char * mdbx_strerror (int errnum)
 Return a string describing a given error code.
 
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_liberr2str (int errnum)
 
LIBMDBX_API const char * mdbx_strerror_ANSI2OEM (int errnum)
 
LIBMDBX_API const char * mdbx_strerror_r_ANSI2OEM (int errnum, char *buf, size_t buflen)
 
LIBMDBX_API int mdbx_env_create (MDBX_env **penv)
 Create an MDBX environment instance.
 
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_get_option (const MDBX_env *env, const MDBX_option_t option, uint64_t *pvalue)
 Gets the value of extra runtime options from an environment.
 
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_env_openW (MDBX_env *env, const wchar_t *pathname, MDBX_env_flags_t flags, mdbx_mode_t mode)
 Open an environment instance.
 
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_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_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.
 
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_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.
 
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_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_stat_ex (const MDBX_env *env, const MDBX_txn *txn, MDBX_stat *stat, size_t bytes)
 Return statistics about the MDBX environment.
 
int mdbx_env_stat (const MDBX_env *env, MDBX_stat *stat, size_t bytes)
 Return statistics about the MDBX environment.
 
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_info (const MDBX_env *env, MDBX_envinfo *info, size_t bytes)
 Return information about the MDBX environment.
 
LIBMDBX_API int mdbx_env_sync_ex (MDBX_env *env, bool force, bool nonblock)
 Flush the environment data buffers to disk.
 
int mdbx_env_sync (MDBX_env *env)
 The shortcut to calling mdbx_env_sync_ex() with the force=true and nonblock=false arguments.
 
int mdbx_env_sync_poll (MDBX_env *env)
 The shortcut to calling mdbx_env_sync_ex() with the force=false and nonblock=true arguments.
 
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 environment.
 
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 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, even of MDBX_SAFE_NOSYNC flag in the environment.
 
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, even of MDBX_SAFE_NOSYNC flag in the environment.
 
LIBMDBX_API int mdbx_env_close_ex (MDBX_env *env, bool dont_sync)
 Close the environment and release the memory map.
 
int mdbx_env_close (MDBX_env *env)
 The shortcut to calling mdbx_env_close_ex() with the dont_sync=false argument.
 
LIBMDBX_API int mdbx_env_resurrect_after_fork (MDBX_env *env)
 Восстанавливает экземпляр среды в дочернем процессе после ветвления родительского процесса посредством fork() и родственных системных вызовов.
 
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_set_flags (MDBX_env *env, MDBX_env_flags_t flags, bool onoff)
 Set environment flags.
 
LIBMDBX_API int mdbx_env_get_flags (const MDBX_env *env, unsigned *flags)
 Get environment flags.
 
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_env_get_pathW (const MDBX_env *env, const wchar_t **dest)
 Return the path that was used in mdbx_env_open().
 
LIBMDBX_API int mdbx_env_get_fd (const MDBX_env *env, mdbx_filehandle_t *fd)
 Return the file descriptor for the given environment.
 
LIBMDBX_API int mdbx_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 memory map.
 
int mdbx_env_set_mapsize (MDBX_env *env, size_t size)
 
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 available memory.
 
intptr_t mdbx_limits_pgsize_min (void)
 Returns the minimal database page size in bytes.
 
intptr_t mdbx_limits_pgsize_max (void)
 Returns the maximal database page size in bytes.
 
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 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_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 intptr_t mdbx_limits_keysize_min (MDBX_db_flags_t flags)
 Returns minimal key size in bytes for given table flags.
 
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 intptr_t mdbx_limits_valsize_min (MDBX_db_flags_t flags)
 Returns minimal data size in bytes for given table flags.
 
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, or -1 if pagesize is invalid.
 
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 page size and table flags, or -1 if pagesize is invalid.
 
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 given page size, or -1 if pagesize is invalid.
 
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.
 
int mdbx_env_get_maxreaders (const MDBX_env *env, unsigned *readers)
 Get the maximum number of threads/reader slots for the environment.
 
int mdbx_env_set_maxdbs (MDBX_env *env, MDBX_dbi dbs)
 Set the maximum number of named tables for the environment.
 
int mdbx_env_get_maxdbs (const MDBX_env *env, MDBX_dbi *dbs)
 Get the maximum number of named tables for the environment.
 
LIBMDBX_API size_t mdbx_default_pagesize (void)
 Returns the default size of database page for the current system.
 
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 about available RAM and can be useful in that it returns the same information that libmdbx uses internally to adjust various options and control readahead.
 
LIBMDBX_API int mdbx_env_get_maxkeysize_ex (const MDBX_env *env, MDBX_db_flags_t flags)
 Returns the maximum size of keys can put.
 
LIBMDBX_API int mdbx_env_get_maxvalsize_ex (const MDBX_env *env, MDBX_db_flags_t flags)
 Returns the maximum size of data we can put.
 
LIBMDBX_API int mdbx_env_get_maxkeysize (const MDBX_env *env)
 
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 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 table flags.
 
LIBMDBX_API int mdbx_env_set_userctx (MDBX_env *env, void *ctx)
 Sets application information (a context pointer) associated with the environment.
 
LIBMDBX_API void * mdbx_env_get_userctx (const MDBX_env *env)
 Returns an application information (a context pointer) associated with the environment.
 
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_begin (MDBX_env *env, MDBX_txn *parent, MDBX_txn_flags_t flags, MDBX_txn **txn)
 Create a transaction for use with the environment.
 
LIBMDBX_API int mdbx_txn_set_userctx (MDBX_txn *txn, void *ctx)
 Sets application information associated (a context pointer) with the transaction.
 
LIBMDBX_API void * mdbx_txn_get_userctx (const MDBX_txn *txn)
 Returns an application information (a context pointer) associated with the transaction.
 
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 MDBX_envmdbx_txn_env (const MDBX_txn *txn)
 Returns the transaction's MDBX_env.
 
LIBMDBX_API MDBX_txn_flags_t mdbx_txn_flags (const MDBX_txn *txn)
 Return the transaction's flags.
 
LIBMDBX_API uint64_t mdbx_txn_id (const MDBX_txn *txn)
 Return the transaction's ID.
 
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.
 
int mdbx_txn_commit (MDBX_txn *txn)
 Commit all the operations of a transaction into the database.
 
LIBMDBX_API int mdbx_txn_abort (MDBX_txn *txn)
 Abandon all the operations of the transaction instead of saving them.
 
LIBMDBX_API int mdbx_txn_break (MDBX_txn *txn)
 Marks transaction as broken.
 
LIBMDBX_API int mdbx_txn_reset (MDBX_txn *txn)
 Reset a read-only transaction.
 
LIBMDBX_API int mdbx_txn_park (MDBX_txn *txn, bool autounpark)
 Переводит читающую транзакцию в "припаркованное" состояние.
 
LIBMDBX_API int mdbx_txn_unpark (MDBX_txn *txn, bool restart_if_ousted)
 Распарковывает ранее припаркованную читающую транзакцию.
 
LIBMDBX_API int mdbx_txn_renew (MDBX_txn *txn)
 Renew a read-only transaction.
 
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.
 
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.
 
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_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_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_enumerate_tables (const MDBX_txn *txn, MDBX_table_enum_func *func, void *ctx)
 Перечисляет пользовательские именнованные таблицы.
 
LIBMDBX_API uint64_t mdbx_key_from_jsonInteger (const int64_t json_integer)
 
LIBMDBX_API uint64_t mdbx_key_from_double (const double ieee754_64bit)
 
LIBMDBX_API uint64_t mdbx_key_from_ptrdouble (const double *const ieee754_64bit)
 
LIBMDBX_API uint32_t mdbx_key_from_float (const float ieee754_32bit)
 
LIBMDBX_API uint32_t mdbx_key_from_ptrfloat (const float *const ieee754_32bit)
 
uint64_t mdbx_key_from_int64 (const int64_t i64)
 
uint32_t mdbx_key_from_int32 (const int32_t i32)
 
LIBMDBX_API int64_t mdbx_jsonInteger_from_key (const MDBX_val)
 
LIBMDBX_API double mdbx_double_from_key (const MDBX_val)
 
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 int mdbx_dbi_stat (const MDBX_txn *txn, MDBX_dbi dbi, MDBX_stat *stat, size_t bytes)
 Retrieve statistics for a table.
 
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_dbi_flags_ex (const MDBX_txn *txn, MDBX_dbi dbi, unsigned *flags, unsigned *state)
 Retrieve the DB flags and status for a table handle.
 
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.
 
LIBMDBX_API int mdbx_dbi_close (MDBX_env *env, MDBX_dbi dbi)
 Close a table handle. Normally unnecessary.
 
LIBMDBX_API int mdbx_drop (MDBX_txn *txn, MDBX_dbi dbi, bool del)
 Empty or delete and close a table.
 
LIBMDBX_API int mdbx_get (const MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *key, MDBX_val *data)
 Get items from a table.
 
LIBMDBX_API int mdbx_get_ex (const MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key, MDBX_val *data, size_t *values_count)
 Get items from a table and optionally number of data items for a given key.
 
LIBMDBX_API int mdbx_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_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_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_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_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 MDBX_cursormdbx_cursor_create (void *context)
 Create a cursor handle but not bind it to transaction nor DBI-handle.
 
LIBMDBX_API int mdbx_cursor_set_userctx (MDBX_cursor *cursor, void *ctx)
 Set application information associated with the cursor.
 
LIBMDBX_API void * mdbx_cursor_get_userctx (const MDBX_cursor *cursor)
 Get the application information associated with the MDBX_cursor.
 
LIBMDBX_API int mdbx_cursor_bind (const MDBX_txn *txn, MDBX_cursor *cursor, MDBX_dbi dbi)
 Bind cursor to specified transaction and DBI-handle.
 
LIBMDBX_API int mdbx_cursor_unbind (MDBX_cursor *cursor)
 Unbind cursor from a transaction.
 
LIBMDBX_API int mdbx_cursor_reset (MDBX_cursor *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 void mdbx_cursor_close (MDBX_cursor *cursor)
 Close a cursor 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_renew (const MDBX_txn *txn, MDBX_cursor *cursor)
 Renew a cursor handle for use within the given transaction.
 
LIBMDBX_API MDBX_txnmdbx_cursor_txn (const MDBX_cursor *cursor)
 Return the cursor's transaction handle.
 
LIBMDBX_API MDBX_dbi mdbx_cursor_dbi (const MDBX_cursor *cursor)
 Return the cursor's table handle.
 
LIBMDBX_API int mdbx_cursor_copy (const MDBX_cursor *src, MDBX_cursor *dest)
 Copy cursor position and state.
 
LIBMDBX_API int mdbx_cursor_compare (const MDBX_cursor *left, const MDBX_cursor *right, bool ignore_multival)
 Сравнивает позицию курсоров.
 
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_cursor_ignord (MDBX_cursor *cursor)
 Служебная функция для использования в утилитах.
 
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_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_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_put (MDBX_cursor *cursor, const MDBX_val *key, MDBX_val *data, MDBX_put_flags_t flags)
 Store by cursor.
 
LIBMDBX_API int mdbx_cursor_del (MDBX_cursor *cursor, MDBX_put_flags_t flags)
 Delete current key/data pair.
 
LIBMDBX_API int mdbx_cursor_count (const MDBX_cursor *cursor, size_t *pcount)
 Return count of duplicates for current key.
 
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 points to the end of data.
 
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_on_first_dup (const MDBX_cursor *cursor)
 Определяет стоит ли курсор на первом или единственном мульти-значении соответствующем ключу.
 
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_on_last_dup (const MDBX_cursor *cursor)
 Определяет стоит ли курсор на последнем или единственном мульти-значении соответствующем ключу.
 
LIBMDBX_API int mdbx_estimate_distance (const MDBX_cursor *first, const MDBX_cursor *last, ptrdiff_t *distance_items)
 Estimates the distance between cursors as a number of elements.
 
LIBMDBX_API int mdbx_estimate_move (const MDBX_cursor *cursor, MDBX_val *key, MDBX_val *data, MDBX_cursor_op move_op, ptrdiff_t *distance_items)
 Estimates the move distance.
 
LIBMDBX_API int mdbx_estimate_range (const MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *begin_key, const MDBX_val *begin_data, const MDBX_val *end_key, const MDBX_val *end_data, ptrdiff_t *distance_items)
 Estimates the size of a range as a number of elements.
 
LIBMDBX_API int mdbx_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.
 
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_cmp (const MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *a, const MDBX_val *b)
 Compare two keys according to a particular table.
 
LIBMDBX_API MDBX_cmp_funcmdbx_get_keycmp (MDBX_db_flags_t flags)
 Returns default internal key's comparator for given table flags.
 
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 MDBX_cmp_funcmdbx_get_datacmp (MDBX_db_flags_t flags)
 Returns default internal data's comparator for given table flags.
 
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_reader_check (MDBX_env *env, int *dead)
 Check for stale entries in the reader lock table.
 
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_thread_register (const MDBX_env *env)
 Registers the current thread as a reader for the environment.
 
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_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 prevents the old data from being recycled.
 
LIBMDBX_API MDBX_hsr_funcmdbx_env_get_hsr (const MDBX_env *env)
 Gets current Handle-Slow-Readers callback used to resolve database full/overflow issue due to a reader(s) which prevents the old data from being recycled.
 
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_txn_unlock (MDBX_env *env)
 Releases write-transaction lock. Provided for custom and/or complex locking scenarios.
 
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_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_env_turn_for_recovery (MDBX_env *env, unsigned target_meta)
 Turn database to the specified meta-page.
 
LIBMDBX_API int mdbx_preopen_snapinfo (const char *pathname, MDBX_envinfo *info, size_t bytes)
 Получает базовую информацию о БД не открывая её.
 
LIBMDBX_API int mdbx_preopen_snapinfoW (const wchar_t *pathname, MDBX_envinfo *info, size_t bytes)
 Получает базовую информацию о БД не открывая её.
 
LIBMDBX_API int mdbx_env_chk (MDBX_env *env, const MDBX_chk_callbacks_t *cb, MDBX_chk_context_t *ctx, const MDBX_chk_flags_t flags, MDBX_chk_severity_t verbosity, unsigned timeout_seconds_16dot16)
 Проверяет целостность базы данных.
 
LIBMDBX_API int mdbx_env_chk_encount_problem (MDBX_chk_context_t *ctx)
 Вспомогательная функция для подсчета проблем детектируемых приложением, в том числе, поступающим к приложению через логирование.
 

Variables

LIBMDBX_VERINFO_API const struct MDBX_version_info mdbx_version
 libmdbx version information
 
LIBMDBX_VERINFO_API const struct MDBX_build_info mdbx_build
 libmdbx build information
 

Detailed Description

The libmdbx C API header file.

Macro Definition Documentation

◆ LIBMDBX_H

#define LIBMDBX_H

libmdbx (aka MDBX) is an extremely fast, compact, powerful, embeddable, transactional key-value store, with Apache 2.0 license. MDBX has a specific set of properties and capabilities, focused on creating unique lightweight solutions with extraordinary performance.

libmdbx is superior to LMDB in terms of features and reliability, not inferior in performance. In comparison to LMDB, libmdbx makes many things just work perfectly, not silently and catastrophically break down. libmdbx supports Linux, Windows, MacOS, OSX, iOS, Android, FreeBSD, DragonFly, Solaris, OpenSolaris, OpenIndiana, NetBSD, OpenBSD and other systems compliant with POSIX.1-2008.

Please visit https://libmdbx.dqdkfa.ru for more information, documentation, C++ API description and links to the origin git repo with the source code. Questions, feedback and suggestions are welcome to the Telegram' group https://t.me/libmdbx.

Donations are welcome to ETH 0xD104d8f8B2dC312aaD74899F83EBf3EEBDC1EA3A. Всё будет хорошо!

Note
The origin has been migrated to GitFlic since on 2022-04-15 the Github administration, without any warning nor explanation, deleted libmdbx along with a lot of other projects, simultaneously blocking access for many developers. For the same reason Github is blacklisted forever.

LICENSE & COPYRIGHT

Note
Please refer to the COPYRIGHT file for explanations license change, credits and acknowledgments.
Author
Леонид Юрьев aka Leonid Yuriev leo@y.nosp@m.urie.nosp@m.v.ru
Date
2015-2024

◆ MDBX_CHK_GC

#define MDBX_CHK_GC   ((void *)((ptrdiff_t)-1))

Pseudo-name for GarbageCollectorDB.

◆ MDBX_CHK_MAIN

#define MDBX_CHK_MAIN   ((void *)((ptrdiff_t)0))

Pseudo-name for MainDB.

◆ MDBX_CHK_META

#define MDBX_CHK_META   ((void *)((ptrdiff_t)-2))

Pseudo-name for MetaPages.