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... | |
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.meta0 |
struct | MDBX_envinfo.mi_bootid.meta1 |
struct | MDBX_envinfo.mi_bootid.meta2 |
struct | MDBX_envinfo.mi_pgop_stat |
struct | MDBX_commit_latency.gc_prof |
Информация для профилирования работы GC. More... | |
Macros | |
#define | MDBX_VERSION_MAJOR 0 |
#define | MDBX_VERSION_MINOR 12 |
#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 without using MDBX_NOSUBDIR. More... | |
#define | MDBX_DATANAME "/mdbx.dat" |
The name of the data file in the environment without using MDBX_NOSUBDIR. More... | |
#define | MDBX_LOCK_SUFFIX "-lck" |
The suffix of the lock file when MDBX_NOSUBDIR is used. More... | |
#define | MDBX_MAP_RESIZED MDBX_MAP_RESIZED_is_deprecated() |
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 iovec | MDBX_val |
Generic structure used for passing keys and data in and out of the database. . More... | |
typedef enum MDBX_txn_flags_t | MDBX_txn_flags_t |
typedef enum MDBX_warmup_flags_t | MDBX_warmup_flags_t |
typedef int(* | MDBX_preserve_func) (void *context, MDBX_val *target, const void *src, size_t bytes) |
Enumerations | |
enum | MDBX_constants { MDBX_MAX_DBI = UINT32_C(32765) , MDBX_MAXDATASIZE = UINT32_C(0x7fff0000) , MDBX_MIN_PAGESIZE = 256 , MDBX_MAX_PAGESIZE = 65536 } |
Functions | |
LIBMDBX_API const char * | mdbx_liberr2str (int errnum) |
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. More... | |
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. More... | |
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. More... | |
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(). More... | |
LIBMDBX_API int | mdbx_dbi_open2 (MDBX_txn *txn, const MDBX_val *name, MDBX_db_flags_t flags, MDBX_dbi *dbi) |
MDBX_DEPRECATED 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) |
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 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... | |
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... | |
struct MDBX_version_info |
libmdbx version information
Class Members | ||
---|---|---|
struct MDBX_version_info | git |
source information from git |
uint8_t | major |
Major version number |
uint8_t | minor |
Minor version number |
uint16_t | release |
Release number of Major.Minor |
uint32_t | revision |
Revision number of Release |
const char * | sourcery |
sourcery anchor for pinning |
struct MDBX_build_info |
libmdbx build information
struct MDBX_stat |
Statistics for a database in the environment.
struct MDBX_envinfo |
Information about the environment.
Class Members | ||
---|---|---|
uint32_t | mi_autosync_period_seconds16dot16 |
Current auto-sync period in 1/65536 of second, see mdbx_env_set_syncperiod(). |
uint64_t | mi_autosync_threshold |
Current auto-sync threshold, see mdbx_env_set_syncbytes(). |
struct MDBX_envinfo | mi_bootid |
A mostly unique ID that is regenerated on each boot. As such it can be used to identify the local machine's current boot. MDBX uses such when open the database to determine whether rollback required to the last steady sync point or not. I.e. if current bootid is differ from the value within a database then the system was rebooted and all changes since last steady sync must be reverted for data integrity. Zeros mean that no relevant information is available from the system. |
uint32_t | mi_dxb_pagesize |
Database pagesize |
struct MDBX_envinfo | mi_geo | |
uint64_t | mi_last_pgno |
Number of the last used page |
uint64_t | mi_latter_reader_txnid |
ID of the last reader transaction |
uint64_t | mi_mapsize |
Size of the data memory map |
uint32_t | mi_maxreaders |
Total reader slots in the environment |
uint64_t | mi_meta0_sign | |
uint64_t | mi_meta0_txnid | |
uint64_t | mi_meta1_sign | |
uint64_t | mi_meta1_txnid | |
uint64_t | mi_meta2_sign | |
uint64_t | mi_meta2_txnid | |
uint32_t | mi_mode |
Current environment mode. The same as mdbx_env_get_flags() returns. |
uint32_t | mi_numreaders |
Max reader slots used in the environment |
struct MDBX_envinfo | mi_pgop_stat |
Statistics of page operations. Overall statistics of page operations of all (running, completed and aborted) transactions in the current multi-process session (since the first process opened the database after everyone had previously closed it). |
uint64_t | mi_recent_txnid |
ID of the last committed transaction |
uint64_t | mi_self_latter_reader_txnid |
ID of the last reader transaction of caller process |
uint32_t | mi_since_reader_check_seconds16dot16 |
Time since the last readers check in 1/65536 of second, see mdbx_reader_check(). |
uint32_t | mi_since_sync_seconds16dot16 |
Time since entering to a "dirty" out-of-sync state in units of 1/65536 of second. In other words, this is the time since the last non-steady commit or zero if it was steady. |
uint32_t | mi_sys_pagesize |
System pagesize |
uint64_t | mi_unsync_volume |
Bytes not explicitly synchronized to disk |
struct MDBX_txn_info |
Information about the transaction.
Class Members | ||
---|---|---|
uint64_t | txn_id |
The ID of the transaction. For a READ-ONLY transaction, this corresponds to the snapshot being read. |
uint64_t | txn_reader_lag |
For READ-ONLY transaction: the lag from a recent MVCC-snapshot, i.e. the number of committed transaction since read transaction started. For WRITE transaction (provided if |
uint64_t | txn_space_dirty |
For READ-ONLY transaction (provided if |
uint64_t | txn_space_leftover |
For READ-ONLY transaction: the space available for writer(s) and that must be exhausted for reason to call the Handle-Slow-Readers callback for this read transaction. For WRITE transaction: the space inside transaction that left to |
uint64_t | txn_space_limit_hard |
Upper bound for size the database file, i.e. the value |
uint64_t | txn_space_limit_soft |
Current size of database file. |
uint64_t | txn_space_retired |
For READ-ONLY transaction: The total size of the database pages that were retired by committed write transactions after the reader's MVCC-snapshot, i.e. the space which would be freed after the Reader releases the MVCC-snapshot for reuse by completion read transaction. For WRITE transaction: The summarized size of the database pages that were retired for now due Copy-On-Write during this transaction. |
uint64_t | txn_space_used |
Used space by this transaction, i.e. corresponding to the last used database page. |
struct MDBX_commit_latency |
Latency of commit stages in 1/65536 of seconds units.
Class Members | ||
---|---|---|
uint32_t | audit | Duration of internal audit if enabled. |
uint32_t | ending | Duration of transaction ending (releasing resources). |
uint32_t | gc_cputime | User-mode CPU time spent on GC update. |
struct MDBX_commit_latency | gc_prof |
Информация для профилирования работы GC.
|
uint32_t | gc_wallclock | Duration of GC update by wall clock. |
uint32_t | preparation | Duration of preparation (commit child transactions, update sub-databases records and cursors destroying). |
uint32_t | sync |
Duration of syncing written data to the disk/storage, i.e. the duration of a fdatasync() or a msync() syscall during commit. |
uint32_t | whole | The total duration of a commit. |
uint32_t | write |
Duration of writing dirty/modified data pages to a filesystem, i.e. the summary duration of a write() syscalls during commit. |
struct MDBX_canary |
The fours integers markers (aka "canary") associated with the environment.
The x
, y
and z
values could be set by mdbx_canary_put(), while the 'v' will be always set to the transaction number. Updated values becomes visible outside the current transaction only after it was committed. Current values could be retrieved by mdbx_canary_get().
Class Members | ||
---|---|---|
uint64_t | v | |
uint64_t | x | |
uint64_t | y | |
uint64_t | z |
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.
As such it can be used to identify the local machine's current boot. MDBX uses such when open the database to determine whether rollback required to the last steady sync point or not. I.e. if current bootid is differ from the value within a database then the system was rebooted and all changes since last steady sync must be reverted for data integrity. Zeros mean that no relevant information is available from the system.
Class Members | ||
---|---|---|
mi_bootid | current | |
mi_bootid | meta0 | |
mi_bootid | meta1 | |
mi_bootid | meta2 |
struct MDBX_envinfo.mi_pgop_stat |
Statistics of page operations.
Overall statistics of page operations of all (running, completed and aborted) transactions in the current multi-process session (since the first process opened the database after everyone had previously closed it).
struct MDBX_commit_latency.gc_prof |
Информация для профилирования работы GC.
Class Members | ||
---|---|---|
uint32_t | coalescences | Количество итераций слияния записей GC. |
uint32_t | flushes | Количество принудительных фиксаций на диск во избежания приращения БД при работе вне режима MDBX_UTTERLY_NOSYNC. |
uint32_t | kicks |
Количество обращений к механизму Handle-Slow-Readers во избежания приращения БД.
|
uint32_t | self_counter | Счетчик выполнения по медленному пути (slow path execution count) GC для целей поддержки и обновления самой GC. |
uint32_t | self_majflt | Количество страничных промахов (page faults) внутри GC при выделении и подготовки страниц для самой GC. |
uint32_t | self_rsteps | Количество итераций поиска внутри GC при выделении страниц для целей поддержки и обновления самой GC. |
uint32_t | self_rtime_monotonic | Время "по настенным часам" затраченное на чтение и поиск внутри GC для целей поддержки и обновления самой GC. |
uint32_t | self_xpages | Количество запросов на выделение последовательностей страниц для самой GC. |
uint32_t | self_xtime_cpu | Время ЦПУ в режиме пользователе затраченное на подготовку страниц извлекаемых из GC для целей поддержки и обновления самой GC, включая подкачку с диска. |
uint32_t | wipes | Количество уничтожений предыдущих надежных/устойчивых точек фиксации при работе в режиме MDBX_UTTERLY_NOSYNC. |
uint32_t | wloops | Количество итераций обновления GC, больше 1 если были повторы/перезапуски. |
uint32_t | work_counter | Счетчик выполнения по медленному пути (slow path execution count) GC ради данных пользователя. |
uint32_t | work_majflt | Количество страничных промахов (page faults) внутри GC при выделении и подготовки страниц для данных пользователя. |
uint32_t | work_rsteps | Количество итераций поиска внутри GC при выделении страниц ради данных пользователя. |
uint32_t | work_rtime_monotonic | Время "по настенным часам" затраченное на чтение и поиск внутри GC ради данных пользователя. |
uint32_t | work_xpages | Количество запросов на выделение последовательностей страниц ради данных пользователя. |
uint32_t | work_xtime_cpu | Время ЦПУ в режиме пользователе затраченное на подготовку страниц извлекаемых из GC для данных пользователя, включая подкачку с диска. |
#define LIBMDBX_API |
#define LIBMDBX_API_TYPE |
#define LIBMDBX_VERINFO_API __dll_export |
#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_LOCKNAME "/mdbx.lck" |
The name of the lock file in the environment without using MDBX_NOSUBDIR.
#define MDBX_MAP_RESIZED MDBX_MAP_RESIZED_is_deprecated() |
#define MDBX_VERSION_MAJOR 0 |
#define MDBX_VERSION_MINOR 12 |
Opaque structure for a database environment.
An environment supports multiple key-value sub-databases (aka key-value spaces or tables), all residing in the same shared-memory map.
typedef int mdbx_filehandle_t |
typedef mode_t mdbx_mode_t |
typedef pid_t mdbx_pid_t |
typedef int(* MDBX_preserve_func) (void *context, MDBX_val *target, const void *src, size_t bytes) |
typedef pthread_t mdbx_tid_t |
typedef enum MDBX_txn_flags_t MDBX_txn_flags_t |
typedef struct iovec MDBX_val |
Generic structure used for passing keys and data in and out of the database. .
Values returned from the database are valid only until a subsequent update operation, or the end of the transaction. Do not modify or free them, they commonly point into the database itself.
Key sizes must be between 0 and mdbx_env_get_maxkeysize() inclusive. The same applies to data sizes in databases with the MDBX_DUPSORT flag. Other data items can in theory be from 0 to MDBX_MAXDATASIZE bytes long.
typedef enum MDBX_warmup_flags_t MDBX_warmup_flags_t |
enum MDBX_constants |
LIBMDBX_API int mdbx_dbi_open2 | ( | MDBX_txn * | txn, |
const MDBX_val * | name, | ||
MDBX_db_flags_t | flags, | ||
MDBX_dbi * | dbi | ||
) |
MDBX_DEPRECATED 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 | ||
) |
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.
This function may be used to make a backup of an existing environment. No lockfile is created, since it gets recreated at need.
[in] | env | An environment handle returned by mdbx_env_create(). It must have already been opened successfully. |
[in] | dest | The pathname of a file in which the copy will reside. This file must not be already exist, but parent directory must be writable. |
[in] | flags | Specifies options for this operation. This parameter must be bitwise OR'ing together any of the constants described here: |
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.
[in] | pathname | The pathname for the database or the directory in which the database files reside. |
[in] | mode | Specifies deletion mode for the environment. This parameter must be set to one of the constants described above in the MDBX_env_delete_mode_t section. |
MDBX_RESULT_TRUE | No corresponding files or directories were found, so no deletion was performed. |
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.
[in] | env | An environment handle returned by mdbx_env_create(). |
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().
[in] | env | An environment handle returned by mdbx_env_create() |
[out] | dest | Address of a string pointer to contain the path. This is the actual string in the environment, not a copy. It should not be altered in any way. |
MDBX_EINVAL | An invalid parameter was specified. |
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.
Indifferently this function will fails or not, the mdbx_env_close() must be called later to discard the MDBX_env handle and release associated resources.
[in] | env | An environment handle returned by mdbx_env_create() |
[in] | pathname | The pathname for the database or the directory in which the database files reside. In the case of directory it must already exist and be writable. |
[in] | flags | Specifies options for this environment. This parameter must be bitwise OR'ing together any constants described above in the env_flags and SYNC MODES sections. |
Flags set by mdbx_env_set_flags() are also used:
MDB_NOLOCK
flag don't supported by MDBX, try use MDBX_EXCLUSIVE as a replacement.If the database is already exist and parameters specified early by mdbx_env_set_geometry() are incompatible (i.e. for instance, different page size) then mdbx_env_open() will return MDBX_INCOMPATIBLE error.
[in] | mode | The UNIX permissions to set on created files. Zero value means to open existing, but do not create. |
MDBX_VERSION_MISMATCH | The version of the MDBX library doesn't match the version that created the database environment. |
MDBX_INVALID | The environment file headers are corrupted. |
MDBX_ENOENT | The directory specified by the path parameter doesn't exist. |
MDBX_EACCES | The user didn't have permission to access the environment files. |
MDBX_EAGAIN | The environment was locked by another process. |
MDBX_BUSY | The MDBX_EXCLUSIVE flag was specified and the environment is in use by another process, or the current process tries to open environment more than once. |
MDBX_INCOMPATIBLE | Environment is already opened by another process, but with different set of MDBX_SAFE_NOSYNC, MDBX_UTTERLY_NOSYNC flags. Or if the database is already exist and parameters specified early by mdbx_env_set_geometry() are incompatible (i.e. different pagesize, etc). |
MDBX_WANNA_RECOVERY | The MDBX_RDONLY flag was specified but read-write access is required to rollback inconsistent state after a system crash. |
MDBX_TOO_LARGE | Database is too large for this process, i.e. 32-bit process tries to open >4Gb database. |
LIBMDBX_API const char* mdbx_liberr2str | ( | int | errnum | ) |
LIBMDBX_API int mdbx_replace_ex | ( | MDBX_txn * | txn, |
MDBX_dbi | dbi, | ||
const MDBX_val * | key, | ||
MDBX_val * | new_data, | ||
MDBX_val * | old_data, | ||
MDBX_put_flags_t | flags, | ||
MDBX_preserve_func | preserver, | ||
void * | preserver_context | ||
) |
LIBMDBX_VERINFO_API const struct MDBX_build_info mdbx_build |
libmdbx build information
LIBMDBX_VERINFO_API const struct MDBX_version_info mdbx_version |
libmdbx version information