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 database 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... | |
Macros | |
#define | LIBMDBX_H |
#define | HAVE_STRUCT_IOVEC 1 |
#define | __has_attribute(x) (0) |
#define | __has_cpp_attribute(x) 0 |
#define | __has_feature(x) (0) |
#define | __has_extension(x) (0) |
#define | __has_builtin(x) (0) |
#define | MDBX_PURE_FUNCTION |
#define | MDBX_NOTHROW_PURE_FUNCTION |
#define | MDBX_CONST_FUNCTION MDBX_PURE_FUNCTION |
#define | MDBX_NOTHROW_CONST_FUNCTION MDBX_NOTHROW_PURE_FUNCTION |
#define | MDBX_DEPRECATED |
#define | __dll_export |
#define | __dll_import |
#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. More... | |
#define | MDBX_STRINGIFY_HELPER(x) #x |
Converts a macro argument into a string constant. More... | |
#define | MDBX_STRINGIFY(x) MDBX_STRINGIFY_HELPER(x) |
#define | bool _Bool |
#define | true (1) |
#define | false (0) |
#define | MDBX_CXX17_NOEXCEPT noexcept |
#define | MDBX_CXX01_CONSTEXPR __inline |
#define | MDBX_CXX01_CONSTEXPR_VAR const |
#define | MDBX_CXX11_CONSTEXPR __inline |
#define | MDBX_CXX11_CONSTEXPR_VAR const |
#define | MDBX_CXX14_CONSTEXPR __inline |
#define | MDBX_CXX14_CONSTEXPR_VAR const |
#define | MDBX_NORETURN |
#define | MDBX_PRINTF_ARGS(format_index, first_arg) |
#define | MDBX_MAYBE_UNUSED [[maybe_unused]] |
#define | MDBX_NOSANITIZE_ENUM |
#define | DEFINE_ENUM_FLAG_OPERATORS(ENUM) |
#define | CONSTEXPR_ENUM_FLAGS_OPERATIONS 1 |
#define | MDBX_VERSION_MAJOR 0 |
#define | MDBX_VERSION_MINOR 11 |
#define | LIBMDBX_API |
#define | LIBMDBX_API_TYPE |
#define | LIBMDBX_VERINFO_API __dll_export |
#define | MDBX_LOCKNAME "/mdbx.lck" |
The name of the lock file in the environment. More... | |
#define | MDBX_DATANAME "/mdbx.dat" |
The name of the data file in the environment. More... | |
#define | MDBX_LOCK_SUFFIX "-lck" |
The suffix of the lock file when MDBX_NOSUBDIR is used. More... | |
#define | MDBX_LOGGER_DONTCHANGE ((MDBX_debug_func *)(intptr_t)-1) |
The "don't change `logger`" value for mdbx_setup_debug() More... | |
#define | MDBX_MAP_RESIZED MDBX_MAP_RESIZED_is_deprecated() |
#define | MDBX_EPSILON ((MDBX_val *)((ptrdiff_t)-1)) |
The EPSILON value for mdbx_estimate_range() More... | |
#define | MDBX_PGWALK_MAIN ((const char *)((ptrdiff_t)0)) |
Pseudo-name for MainDB. More... | |
#define | MDBX_PGWALK_GC ((const char *)((ptrdiff_t)-1)) |
Pseudo-name for GarbageCollectorDB. More... | |
#define | MDBX_PGWALK_META ((const char *)((ptrdiff_t)-2)) |
Pseudo-name for MetaPages. More... | |
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. More... | |
typedef struct MDBX_txn | MDBX_txn |
Opaque structure for a transaction handle. More... | |
typedef uint32_t | MDBX_dbi |
A handle for an individual database (key-value spaces) in the environment. More... | |
typedef struct MDBX_cursor | MDBX_cursor |
Opaque structure for navigating through a database. More... | |
typedef struct iovec | MDBX_val |
Generic structure used for passing keys and data in and out of the database. More... | |
typedef enum MDBX_log_level_t | MDBX_log_level_t |
typedef enum MDBX_debug_flags_t | MDBX_debug_flags_t |
typedef 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. More... | |
typedef 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. More... | |
typedef enum MDBX_env_flags_t | MDBX_env_flags_t |
typedef enum MDBX_txn_flags_t | MDBX_txn_flags_t |
typedef enum MDBX_db_flags_t | MDBX_db_flags_t |
typedef enum MDBX_put_flags_t | MDBX_put_flags_t |
typedef enum MDBX_copy_flags_t | MDBX_copy_flags_t |
typedef enum MDBX_cursor_op | MDBX_cursor_op |
typedef enum MDBX_error_t | MDBX_error_t |
typedef enum MDBX_option_t | MDBX_option_t |
typedef enum MDBX_env_delete_mode_t | MDBX_env_delete_mode_t |
typedef 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. More... | |
typedef enum MDBX_dbi_state_t | MDBX_dbi_state_t |
typedef int(* | MDBX_preserve_func) (void *context, MDBX_val *target, const void *src, size_t bytes) |
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) MDBX_CXX17_NOEXCEPT |
A callback function used to enumerate the reader lock table. More... | |
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) MDBX_CXX17_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. More... | |
typedef enum MDBX_page_type_t | MDBX_page_type_t |
typedef 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. More... | |
typedef uint_fast64_t | mdbx_attr_t |
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. More... | |
LIBMDBX_API int | mdbx_env_set_assert (MDBX_env *env, MDBX_assert_func *func) |
Set or reset the assert() callback of the environment. More... | |
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. More... | |
LIBMDBX_API void | mdbx_panic (const char *fmt,...) MDBX_PRINTF_ARGS(1 |
Panics with message and causes abnormal process termination. More... | |
const LIBMDBX_API char * | mdbx_strerror (int errnum) |
Return a string describing a given error code. More... | |
const LIBMDBX_API char * | mdbx_strerror_r (int errnum, char *buf, size_t buflen) |
Return a string describing a given error code. More... | |
MDBX_NOTHROW_PURE_FUNCTION const LIBMDBX_API char * | mdbx_liberr2str (int errnum) |
const LIBMDBX_API char * | mdbx_strerror_ANSI2OEM (int errnum) |
const LIBMDBX_API 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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
MDBX_DEPRECATED int | mdbx_env_stat (const MDBX_env *env, MDBX_stat *stat, size_t bytes) |
Return statistics about the MDBX environment. More... | |
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. More... | |
MDBX_DEPRECATED int | mdbx_env_info (const MDBX_env *env, MDBX_envinfo *info, size_t bytes) |
Return information about the MDBX environment. More... | |
LIBMDBX_API int | mdbx_env_sync_ex (MDBX_env *env, bool force, bool nonblock) |
Flush the environment data buffers to disk. More... | |
int | mdbx_env_sync (MDBX_env *env) |
The shortcut to calling mdbx_env_sync_ex() with the force=true and nonblock=false arguments. More... | |
int | mdbx_env_sync_poll (MDBX_env *env) |
The shortcut to calling mdbx_env_sync_ex() with the force=false and nonblock=true arguments. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
LIBMDBX_API int | mdbx_env_close_ex (MDBX_env *env, bool dont_sync) |
Close the environment and release the memory map. More... | |
int | mdbx_env_close (MDBX_env *env) |
The shortcut to calling mdbx_env_close_ex() with the dont_sync=false argument. More... | |
LIBMDBX_API int | mdbx_env_set_flags (MDBX_env *env, MDBX_env_flags_t flags, bool onoff) |
Set environment flags. More... | |
LIBMDBX_API int | mdbx_env_get_flags (const MDBX_env *env, unsigned *flags) |
Get environment flags. More... | |
LIBMDBX_API int | mdbx_env_get_path (const MDBX_env *env, const char **dest) |
Return the path that was used in mdbx_env_open(). More... | |
LIBMDBX_API int | mdbx_env_get_fd (const MDBX_env *env, mdbx_filehandle_t *fd) |
Return the file descriptor for the given environment. More... | |
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. More... | |
MDBX_DEPRECATED 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. More... | |
MDBX_NOTHROW_CONST_FUNCTION intptr_t | mdbx_limits_pgsize_min (void) |
Returns the minimal database page size in bytes. More... | |
MDBX_NOTHROW_CONST_FUNCTION intptr_t | mdbx_limits_pgsize_max (void) |
Returns the maximal database page size in bytes. More... | |
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. More... | |
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. More... | |
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 invalid. More... | |
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 invalid. More... | |
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 given page size, or -1 if pagesize is invalid. More... | |
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. More... | |
int | mdbx_env_get_maxreaders (const MDBX_env *env, unsigned *readers) |
Get the maximum number of threads/reader slots for the environment. More... | |
int | mdbx_env_set_maxdbs (MDBX_env *env, MDBX_dbi dbs) |
Set the maximum number of named databases for the environment. More... | |
int | mdbx_env_get_maxdbs (const MDBX_env *env, MDBX_dbi *dbs) |
Get the maximum number of named databases for the environment. More... | |
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API size_t | mdbx_default_pagesize (void) |
Returns the default size of database page for the current system. More... | |
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. More... | |
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. More... | |
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. More... | |
MDBX_NOTHROW_PURE_FUNCTION MDBX_DEPRECATED LIBMDBX_API int | mdbx_env_get_maxkeysize (const MDBX_env *env) |
LIBMDBX_API int | mdbx_env_set_userctx (MDBX_env *env, void *ctx) |
Sets application information (a context pointer) associated with the environment. More... | |
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. More... | |
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. More... | |
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. More... | |
LIBMDBX_API int | mdbx_txn_set_userctx (MDBX_txn *txn, void *ctx) |
Sets application information associated (a context pointer) with the transaction. More... | |
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. More... | |
LIBMDBX_API int | mdbx_txn_info (const MDBX_txn *txn, MDBX_txn_info *info, bool scan_rlt) |
Return information about the MDBX transaction. More... | |
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API MDBX_env * | mdbx_txn_env (const MDBX_txn *txn) |
Returns the transaction's MDBX_env. More... | |
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API int | mdbx_txn_flags (const MDBX_txn *txn) |
Return the transaction's flags. More... | |
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API uint64_t | mdbx_txn_id (const MDBX_txn *txn) |
Return the transaction's ID. More... | |
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. More... | |
int | mdbx_txn_commit (MDBX_txn *txn) |
Commit all the operations of a transaction into the database. More... | |
LIBMDBX_API int | mdbx_txn_abort (MDBX_txn *txn) |
Abandon all the operations of the transaction instead of saving them. More... | |
LIBMDBX_API int | mdbx_txn_break (MDBX_txn *txn) |
Marks transaction as broken. More... | |
LIBMDBX_API int | mdbx_txn_reset (MDBX_txn *txn) |
Reset a read-only transaction. More... | |
LIBMDBX_API int | mdbx_txn_renew (MDBX_txn *txn) |
Renew a read-only transaction. More... | |
LIBMDBX_API int | mdbx_canary_put (MDBX_txn *txn, const MDBX_canary *canary) |
Set integers markers (aka "canary") associated with the environment. More... | |
LIBMDBX_API int | mdbx_canary_get (const MDBX_txn *txn, MDBX_canary *canary) |
Returns fours integers markers (aka "canary") associated with the environment. More... | |
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. More... | |
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) |
MDBX_NOTHROW_CONST_FUNCTION LIBMDBX_API uint64_t | mdbx_key_from_jsonInteger (const int64_t json_integer) |
MDBX_NOTHROW_CONST_FUNCTION LIBMDBX_API uint64_t | mdbx_key_from_double (const double ieee754_64bit) |
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API uint64_t | mdbx_key_from_ptrdouble (const double *const ieee754_64bit) |
MDBX_NOTHROW_CONST_FUNCTION LIBMDBX_API uint32_t | mdbx_key_from_float (const float ieee754_32bit) |
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API uint32_t | mdbx_key_from_ptrfloat (const float *const ieee754_32bit) |
MDBX_NOTHROW_CONST_FUNCTION uint64_t | mdbx_key_from_int64 (const int64_t i64) |
MDBX_NOTHROW_CONST_FUNCTION uint32_t | mdbx_key_from_int32 (const int32_t i32) |
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API int64_t | mdbx_jsonInteger_from_key (const MDBX_val) |
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API double | mdbx_double_from_key (const MDBX_val) |
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API float | mdbx_float_from_key (const MDBX_val) |
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API int32_t | mdbx_int32_from_key (const MDBX_val) |
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API int64_t | mdbx_int64_from_key (const MDBX_val) |
LIBMDBX_API int | mdbx_dbi_stat (MDBX_txn *txn, MDBX_dbi dbi, MDBX_stat *stat, size_t bytes) |
Retrieve statistics for a database. More... | |
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. More... | |
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. More... | |
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. More... | |
LIBMDBX_API int | mdbx_dbi_close (MDBX_env *env, MDBX_dbi dbi) |
Close a database handle. Normally unnecessary. More... | |
LIBMDBX_API int | mdbx_drop (MDBX_txn *txn, MDBX_dbi dbi, bool del) |
Empty or delete and close a database. More... | |
LIBMDBX_API int | mdbx_get (MDBX_txn *txn, MDBX_dbi dbi, const MDBX_val *key, MDBX_val *data) |
Get items from a database. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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 database. More... | |
LIBMDBX_API MDBX_cursor * | mdbx_cursor_create (void *context) |
Create a cursor handle but not bind it to transaction nor DBI handle. More... | |
LIBMDBX_API int | mdbx_cursor_set_userctx (MDBX_cursor *cursor, void *ctx) |
Set application information associated with the MDBX_cursor. More... | |
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API void * | mdbx_cursor_get_userctx (const MDBX_cursor *cursor) |
Get the application information associated with the MDBX_cursor. More... | |
LIBMDBX_API int | mdbx_cursor_bind (MDBX_txn *txn, MDBX_cursor *cursor, MDBX_dbi dbi) |
Bind cursor to specified transaction and DBI handle. More... | |
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. More... | |
LIBMDBX_API void | mdbx_cursor_close (MDBX_cursor *cursor) |
Close a cursor handle. More... | |
LIBMDBX_API int | mdbx_cursor_renew (MDBX_txn *txn, MDBX_cursor *cursor) |
Renew a cursor handle. More... | |
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API MDBX_txn * | mdbx_cursor_txn (const MDBX_cursor *cursor) |
Return the cursor's transaction handle. More... | |
LIBMDBX_API MDBX_dbi | mdbx_cursor_dbi (const MDBX_cursor *cursor) |
Return the cursor's database handle. More... | |
LIBMDBX_API int | mdbx_cursor_copy (const MDBX_cursor *src, MDBX_cursor *dest) |
Copy cursor position and state. More... | |
LIBMDBX_API int | mdbx_cursor_get (MDBX_cursor *cursor, MDBX_val *key, MDBX_val *data, MDBX_cursor_op op) |
Retrieve by cursor. More... | |
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. More... | |
LIBMDBX_API int | mdbx_cursor_put (MDBX_cursor *cursor, const MDBX_val *key, MDBX_val *data, MDBX_put_flags_t flags) |
Store by cursor. More... | |
LIBMDBX_API int | mdbx_cursor_del (MDBX_cursor *cursor, MDBX_put_flags_t flags) |
Delete current key/data pair. More... | |
LIBMDBX_API int | mdbx_cursor_count (const MDBX_cursor *cursor, size_t *pcount) |
Return count of duplicates for current key. More... | |
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 points to the end of data. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
LIBMDBX_API int | mdbx_dbi_sequence (MDBX_txn *txn, MDBX_dbi dbi, uint64_t *result, uint64_t increment) |
Sequence generation for a database. More... | |
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. More... | |
MDBX_NOTHROW_CONST_FUNCTION LIBMDBX_API MDBX_cmp_func * | mdbx_get_keycmp (MDBX_db_flags_t flags) |
Returns default internal key's comparator for given database flags. More... | |
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. More... | |
MDBX_NOTHROW_CONST_FUNCTION LIBMDBX_API MDBX_cmp_func * | mdbx_get_datacmp (MDBX_db_flags_t flags) |
Returns default internal data's comparator for given database flags. More... | |
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. More... | |
LIBMDBX_API int | mdbx_reader_check (MDBX_env *env, int *dead) |
Check for stale entries in the reader lock table. More... | |
MDBX_DEPRECATED LIBMDBX_API int | mdbx_txn_straggler (const MDBX_txn *txn, int *percent) |
Returns a lag of the reading for the given transaction. More... | |
LIBMDBX_API int | mdbx_thread_register (const MDBX_env *env) |
Registers the current thread as a reader for the environment. More... | |
LIBMDBX_API int | mdbx_thread_unregister (const MDBX_env *env) |
Unregisters the current thread as a reader for the environment. More... | |
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. More... | |
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 reader(s) which prevents the old data from being recycled. More... | |
LIBMDBX_API int | mdbx_env_pgwalk (MDBX_txn *txn, MDBX_pgvisitor_func *visitor, void *ctx, bool dont_check_keys_ordering) |
B-tree traversal function. More... | |
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. More... | |
LIBMDBX_API int | mdbx_env_turn_for_recovery (MDBX_env *env, unsigned target_meta) |
Turn database to the specified meta-page. More... | |
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) |
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) |
LIBMDBX_API int | mdbx_set_attr (MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key, MDBX_val *data, mdbx_attr_t attr) |
LIBMDBX_API int | mdbx_cursor_get_attr (MDBX_cursor *cursor, MDBX_val *key, MDBX_val *data, mdbx_attr_t *pattr, MDBX_cursor_op op) |
LIBMDBX_API int | mdbx_get_attr (MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key, MDBX_val *data, mdbx_attr_t *pattr) |
Variables | |
LIBMDBX_VERINFO_API const struct MDBX_version_info | mdbx_version |
libmdbx version information More... | |
LIBMDBX_VERINFO_API const struct MDBX_build_info | mdbx_build |
libmdbx build information More... | |
The libmdbx C API header file.
#define LIBMDBX_H |
libmdbx is an extremely fast, compact, powerful, embedded, transactional key-value store database, with permissive 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.
The Future will (be) Positive. Всё будет хорошо.
A copy of this license is available in the file LICENSE in the top-level directory of the distribution or, alternatively, at http://www.OpenLDAP.org/license.html.
This code is derived from "LMDB engine" written by Howard Chu (Symas Corporation), which itself derived from btree.c written by Martin Hedenfalk.
Portions Copyright 2011-2015 Howard Chu, Symas Corp. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted only as authorized by the OpenLDAP Public License.
A copy of this license is available in the file LICENSE in the top-level directory of the distribution or, alternatively, at http://www.OpenLDAP.org/license.html.
Portions Copyright (c) 2009, 2010 Martin Hedenfalk marti n@bz ero.s e
Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.