Classes | |
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_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... | |
Typedefs | |
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_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. | |
Enumerations | |
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... | |
Functions | |
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. | |
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_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_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. | |
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_get_maxreaders (const MDBX_env *env, unsigned *readers) |
Get the maximum number of threads/reader slots 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 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_info (const MDBX_txn *txn, MDBX_txn_info *info, bool scan_rlt) |
Return information about the MDBX transaction. | |
LIBMDBX_API uint64_t | mdbx_txn_id (const MDBX_txn *txn) |
Return the transaction's ID. | |
LIBMDBX_API int | mdbx_enumerate_tables (const MDBX_txn *txn, MDBX_table_enum_func *func, void *ctx) |
Перечисляет пользовательские именнованные таблицы. | |
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_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_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_txn_straggler (const MDBX_txn *txn, int *percent) |
Returns a lag of the reading for the given transaction. | |
struct MDBX_stat |
Statistics for a table 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 | 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_dxbid | mi_dxbid | |
struct MDBX_envinfo.mi_geo | 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_meta_sign[3] | |
uint64_t | mi_meta_txnid[3] | |
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 | 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_prof |
Информация для профилирования работы GC.
|
uint32_t | gc_wallclock | Duration of GC update by wall clock. |
uint32_t | preparation | Duration of preparation (commit child transactions, update table's 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_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 | ||
---|---|---|
struct MDBX_envinfo.mi_bootid.current | current | |
struct MDBX_envinfo.mi_bootid.meta | meta[3] |
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).
Class Members | ||
---|---|---|
uint64_t | clone |
Quantity of parent's dirty pages clones for nested transactions |
uint64_t | cow |
Quantity of pages copied for update |
uint64_t | fsync |
Number of explicit fsync-to-disk operations (not a pages) |
uint64_t | merge |
Page merges |
uint64_t | mincore |
Number of mincore() calls |
uint64_t | msync |
Number of explicit msync-to-disk operations (not a pages) |
uint64_t | newly |
Quantity of a new pages added |
uint64_t | prefault |
Number of prefault write operations (not a pages) |
uint64_t | spill |
Quantity of spilled dirty pages |
uint64_t | split |
Page splits |
uint64_t | unspill |
Quantity of unspilled/reloaded pages |
uint64_t | wops |
Number of explicit write operations (not a pages) to a disk |
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 для данных пользователя, включая подкачку с диска. |
|
noexcept |
A callback function used to enumerate the reader lock table.
[in] | ctx | An arbitrary context pointer for the callback. |
[in] | num | The serial number during enumeration, starting from 1. |
[in] | slot | The reader lock table slot number. |
[in] | txnid | The ID of the transaction being read, i.e. the MVCC-snapshot number. |
[in] | lag | The lag from a recent MVCC-snapshot, i.e. the number of committed write transactions since the current read transaction started. |
[in] | pid | The reader process ID. |
[in] | thread | The reader thread ID. |
[in] | bytes_used | The number of last used page in the MVCC-snapshot which being read, i.e. database file can't be shrunk beyond this. |
[in] | bytes_retained | 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. |
|
noexcept |
Функция обратного вызова для перечисления пользовательских именованных таблиц.
[in] | ctx | Указатель на контекст переданный аналогичным параметром в mdbx_enumerate_tables(). |
[in] | txn | Транзазакция. |
[in] | name | Имя таблицы. |
[in] | flags | Флаги MDBX_db_flags_t. |
[in] | stat | Базовая информация MDBX_stat о таблице. |
[in] | dbi | Отличное от 0 значение DBI-дескриптора, если таковой был открыт для этой таблицы. Либо 0 если такого открытого дескриптора нет. |
enum MDBX_dbi_state_t |
DBI state bits returted by mdbx_dbi_flags_ex()
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.
[in] | txn | A transaction handle returned by mdbx_txn_begin(). |
[in] | dbi | A table handle returned by mdbx_dbi_open(). |
[out] | mask | The address of an uint32_t value where the bitmask will be stored. |
MDBX_THREAD_MISMATCH | Given transaction is not owned by current thread. |
MDBX_EINVAL | An invalid parameter was specified. |
MDBX_RESULT_TRUE | The dbi isn't a dupsort (multi-value) table. |
The shortcut to calling mdbx_dbi_flags_ex() with state=NULL
for discarding it result.
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.
[in] | txn | A transaction handle returned by mdbx_txn_begin(). |
[in] | dbi | A table handle returned by mdbx_dbi_open(). |
[out] | flags | Address where the flags will be returned. |
[out] | state | Address where the state will be returned. |
LIBMDBX_API int mdbx_dbi_stat | ( | const MDBX_txn * | txn, |
MDBX_dbi | dbi, | ||
MDBX_stat * | stat, | ||
size_t | bytes | ||
) |
Retrieve statistics for a table.
[in] | txn | A transaction handle returned by mdbx_txn_begin(). |
[in] | dbi | A table handle returned by mdbx_dbi_open(). |
[out] | stat | The address of an MDBX_stat structure where the statistics will be copied. |
[in] | bytes | The size of MDBX_stat. |
MDBX_THREAD_MISMATCH | Given transaction is not owned by current thread. |
MDBX_EINVAL | An invalid parameter was specified. |
LIBMDBX_API size_t mdbx_default_pagesize | ( | void | ) |
Returns the default size of database page for the current system.
Default size of database page depends on the size of the system page and usually exactly match it.
LIBMDBX_API int mdbx_enumerate_tables | ( | const MDBX_txn * | txn, |
MDBX_table_enum_func * | func, | ||
void * | ctx | ||
) |
Перечисляет пользовательские именнованные таблицы.
Производит перечисление пользовательских именнованных таблиц, вызывая специфицируемую пользователем функцию-визитер для каждой именованной таблицы. Перечисление продолжается до исчерпания именованных таблиц, либо до возврата отличного от нуля результата из заданной пользователем функции, которое будет сразу возвращено в качестве результата.
[in] | txn | Транзакция запущенная посредством mdbx_txn_begin(). |
[in] | func | Указатель на пользовательскую функцию с сигнатурой MDBX_table_enum_func, которая будет вызвана для каждой таблицы. |
[in] | ctx | Указатель на некоторый контект, который будет передан в функцию func() как есть. |
LIBMDBX_API int mdbx_env_get_fd | ( | const MDBX_env * | env, |
mdbx_filehandle_t * | fd | ||
) |
Return the file descriptor for the given environment.
FD_CLOEXEC
and couldn't be used after exec() and or fork()
.[in] | env | An environment handle returned by mdbx_env_create(). |
[out] | fd | Address of a int to contain the descriptor. |
MDBX_EINVAL | An invalid parameter was specified. |
LIBMDBX_API int mdbx_env_get_flags | ( | const MDBX_env * | env, |
unsigned * | flags | ||
) |
Get environment flags.
[in] | env | An environment handle returned by mdbx_env_create(). |
[out] | flags | The address of an integer to store the flags. |
MDBX_EINVAL | An invalid parameter was specified. |
Get the maximum number of named tables for the environment.
[in] | env | An environment handle returned by mdbx_env_create(). |
[out] | dbs | Address to store the maximum number of tables. |
MDBX_EINVAL | An invalid parameter was specified. |
LIBMDBX_API int mdbx_env_get_maxkeysize | ( | const MDBX_env * | env | ) |
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.
[in] | env | An environment handle returned by mdbx_env_create(). |
[in] | flags | Table options (MDBX_DUPSORT, MDBX_INTEGERKEY and so on). |
|
inline |
Get the maximum number of threads/reader slots for the environment.
[in] | env | An environment handle returned by mdbx_env_create(). |
[out] | readers | Address of an integer to store the number of readers. |
MDBX_EINVAL | An invalid parameter was specified. |
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.
[in] | env | An environment handle returned by mdbx_env_create(). |
[in] | flags | Table options (MDBX_DUPSORT, MDBX_INTEGERKEY and so on). |
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.
[in] | env | An environment handle returned by mdbx_env_create(). |
[in] | flags | Table options (MDBX_DUPSORT, MDBX_INTEGERKEY and so on). |
LIBMDBX_API int mdbx_env_get_path | ( | const MDBX_env * | env, |
const char ** | 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_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. |
|
inline |
Get threshold to force flush the data buffers to disk, even any of MDBX_SAFE_NOSYNC flag in the environment.
[in] | env | An environment handle returned by mdbx_env_create(). |
[out] | threshold | Address of an size_t to store the number of bytes of summary changes when a synchronous flush would be made. |
MDBX_EINVAL | An invalid parameter was specified. |
|
inline |
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.
[in] | env | An environment handle returned by mdbx_env_create(). |
[out] | period_seconds_16dot16 | Address of an size_t to store the period in 1/65536 of second when a synchronous flush would be made since the last unsteady commit. |
MDBX_EINVAL | An invalid parameter was specified. |
LIBMDBX_API void * mdbx_env_get_userctx | ( | const MDBX_env * | env | ) |
Returns an application information (a context pointer) associated with the environment.
[in] | env | An environment handle returned by mdbx_env_create() |
NULL
if something wrong. 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.
[in] | env | An environment handle returned by mdbx_env_create(). |
[in] | flags | Table options (MDBX_DUPSORT, MDBX_INTEGERKEY and so on). |
|
inline |
Return information 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.
At least one of env
or txn
argument must be non-null. If txn is passed non-null then stat will be filled accordingly to the given transaction. Otherwise, if txn is null, then stat will be populated by a snapshot from the last committed write transaction, and at next time, other information can be returned.
Legacy mdbx_env_info() correspond to calling mdbx_env_info_ex() with the null txn
argument.
[in] | env | An environment handle returned by mdbx_env_create() |
[in] | txn | A transaction handle returned by mdbx_txn_begin() |
[out] | info | The address of an MDBX_envinfo structure where the information will be copied |
[in] | bytes | The actual size of MDBX_envinfo, this value is used to provide ABI compatibility. |
Return statistics about the MDBX environment.
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.
At least one of env
or txn
argument must be non-null. If txn is passed non-null then stat will be filled accordingly to the given transaction. Otherwise, if txn is null, then stat will be populated by a snapshot from the last committed write transaction, and at next time, other information can be returned.
Legacy mdbx_env_stat() correspond to calling mdbx_env_stat_ex() with the null txn
argument.
[in] | env | An environment handle returned by mdbx_env_create() |
[in] | txn | A transaction handle returned by mdbx_txn_begin() |
[out] | stat | The address of an MDBX_stat structure where the statistics will be copied |
[in] | bytes | The size of MDBX_stat. |
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.
[out] | page_size | Optional address where the system page size will be stored. |
[out] | total_pages | Optional address where the number of total RAM pages will be stored. |
[out] | avail_pages | Optional address where the number of available/free RAM pages will be stored. |
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.
Ultimately, this allows to avoid copy data from non-dirty pages.
"Dirty" pages are those that have already been changed during a write transaction. Accordingly, any further changes may result in such pages being overwritten. Therefore, all functions libmdbx performing changes inside the database as arguments should NOT get pointers to data in those pages. In turn, "not dirty" pages before modification will be copied.
In other words, data from dirty pages must either be copied before being passed as arguments for further processing or rejected at the argument validation stage. Thus, mdbx_is_dirty()
allows you to get rid of unnecessary copying, and perform a more complete check of the arguments.
[in] | txn | A transaction handle returned by mdbx_txn_begin(). |
[in] | ptr | The address of data to check. |
MDBX_RESULT_TRUE | Given address is on the dirty page. |
MDBX_RESULT_FALSE | Given address is NOT on the dirty page. |
Otherwise | the error code. |
LIBMDBX_API intptr_t mdbx_limits_dbsize_max | ( | intptr_t | pagesize | ) |
Returns maximal database size in bytes for given page size, or -1 if pagesize is invalid.
LIBMDBX_API intptr_t mdbx_limits_dbsize_min | ( | intptr_t | pagesize | ) |
Returns minimal database size in bytes for given page size, or -1 if pagesize is invalid.
LIBMDBX_API 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_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.
|
inline |
Returns the maximal database page size in bytes.
|
inline |
Returns the minimal database page size in bytes.
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.
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_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 int mdbx_reader_list | ( | const MDBX_env * | env, |
MDBX_reader_list_func * | func, | ||
void * | ctx | ||
) |
Enumerate the entries in the reader lock table.
[in] | env | An environment handle returned by mdbx_env_create(). |
[in] | func | A MDBX_reader_list_func function. |
[in] | ctx | An arbitrary context pointer for the enumeration function. |
LIBMDBX_API uint64_t mdbx_txn_id | ( | const MDBX_txn * | txn | ) |
Return the transaction's ID.
This returns the identifier associated with this transaction. For a read-only transaction, this corresponds to the snapshot being read; concurrent readers will frequently have the same transaction ID.
[in] | txn | A transaction handle returned by mdbx_txn_begin(). |
LIBMDBX_API int mdbx_txn_info | ( | const MDBX_txn * | txn, |
MDBX_txn_info * | info, | ||
bool | scan_rlt | ||
) |
Return information about the MDBX transaction.
[in] | txn | A transaction handle returned by mdbx_txn_begin() |
[out] | info | The address of an MDBX_txn_info structure where the information will be copied. |
[in] | scan_rlt | The boolean flag controls the scan of the read lock table to provide complete information. Such scan is relatively expensive and you can avoid it if corresponding fields are not needed. See description of MDBX_txn_info. |
LIBMDBX_API int mdbx_txn_straggler | ( | const MDBX_txn * | txn, |
int * | percent | ||
) |
Returns a lag of the reading for the given transaction.
Returns an information for estimate how much given read-only transaction is lagging relative the to actual head.
[in] | txn | A transaction handle returned by mdbx_txn_begin(). |
[out] | percent | Percentage of page allocation in the database. |