summaryrefslogtreecommitdiff
path: root/libs/libmdbx/src/mdbx.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/libmdbx/src/mdbx.h')
-rw-r--r--libs/libmdbx/src/mdbx.h57
1 files changed, 47 insertions, 10 deletions
diff --git a/libs/libmdbx/src/mdbx.h b/libs/libmdbx/src/mdbx.h
index 8f3b1575dc..67b725139a 100644
--- a/libs/libmdbx/src/mdbx.h
+++ b/libs/libmdbx/src/mdbx.h
@@ -117,7 +117,11 @@ typedef DWORD mdbx_tid_t;
typedef int mdbx_filehandle_t;
typedef pid_t mdbx_pid_t;
typedef pthread_t mdbx_tid_t;
+#ifdef ENODATA
#define MDBX_ENODATA ENODATA
+#else
+#define MDBX_ENODATA -1
+#endif
#define MDBX_EINVAL EINVAL
#define MDBX_EACCESS EACCES
#define MDBX_ENOMEM ENOMEM
@@ -149,8 +153,8 @@ typedef pthread_t mdbx_tid_t;
#else
#define __dll_export
#endif
-#elif defined(__GNUC__) || __has_attribute(visibility)
-#define __dll_export __attribute__((visibility("default")))
+#elif defined(__GNUC__) || __has_attribute(__visibility__)
+#define __dll_export __attribute__((__visibility__("default")))
#else
#define __dll_export
#endif
@@ -736,6 +740,8 @@ LIBMDBX_API int mdbx_env_copy2fd(MDBX_env *env, mdbx_filehandle_t fd,
* [out] stat The address of an MDBX_stat structure where the statistics
* will be copied */
LIBMDBX_API int mdbx_env_stat(MDBX_env *env, MDBX_stat *stat, size_t bytes);
+LIBMDBX_API int mdbx_env_stat2(const MDBX_env *env, const MDBX_txn *txn,
+ MDBX_stat *stat, size_t bytes);
/* Return information about the MDBX environment.
*
@@ -743,6 +749,8 @@ LIBMDBX_API int mdbx_env_stat(MDBX_env *env, MDBX_stat *stat, size_t bytes);
* [out] stat The address of an MDBX_envinfo structure
* where the information will be copied */
LIBMDBX_API int mdbx_env_info(MDBX_env *env, MDBX_envinfo *info, size_t bytes);
+LIBMDBX_API int mdbx_env_info2(const MDBX_env *env, const MDBX_txn *txn,
+ MDBX_envinfo *info, size_t bytes);
/* Flush the data buffers to disk.
*
@@ -1578,14 +1586,15 @@ LIBMDBX_API char *mdbx_dkey(const MDBX_val *key, char *const buf,
LIBMDBX_API int mdbx_env_close_ex(MDBX_env *env, int dont_sync);
-/* Set threshold to force flush the data buffers to disk,
+/* Sets threshold to force flush the data buffers to disk,
* even of MDBX_NOSYNC, MDBX_NOMETASYNC and MDBX_MAPASYNC flags
- * in the environment.
+ * in the environment. The value affects all processes which operates with given
+ * DB until the last process close DB or a new value will be settled.
*
* Data is always written to disk when mdbx_txn_commit() is called,
* but the operating system may keep it buffered. MDBX always flushes
* the OS buffers upon commit as well, unless the environment was
- * opened with MDBX_NOSYNC or in part MDBX_NOMETASYNC.
+ * opened with MDBX_NOSYNC, MDBX_MAPASYNC or in part MDBX_NOMETASYNC.
*
* The default is 0, than mean no any threshold checked, and no additional
* flush will be made.
@@ -1597,6 +1606,32 @@ LIBMDBX_API int mdbx_env_close_ex(MDBX_env *env, int dont_sync);
* Returns A non-zero error value on failure and 0 on success. */
LIBMDBX_API int mdbx_env_set_syncbytes(MDBX_env *env, size_t bytes);
+/* Sets relative period since the last unsteay commit to force flush the data
+ * buffers to disk, even of MDBX_NOSYNC, MDBX_NOMETASYNC and MDBX_MAPASYNC flags
+ * in the environment. The value affects all processes which operates with given
+ * DB until the last process close DB or a new value will be settled.
+ *
+ * Data is always written to disk when mdbx_txn_commit() is called,
+ * but the operating system may keep it buffered. MDBX always flushes
+ * the OS buffers upon commit as well, unless the environment was
+ * opened with MDBX_NOSYNC, MDBX_MAPASYNC or in part MDBX_NOMETASYNC.
+ *
+ * Settled period don't checked asynchronously, but only inside the functions.
+ * mdbx_txn_commit() and mdbx_env_sync(). Therefore, in cases where transactions
+ * are committed infrequently and/or irregularly, polling by mdbx_env_sync() may
+ * be a reasonable solution to timeout enforcement.
+ *
+ * The default is 0, than mean no any timeout checked, and no additional
+ * flush will be made.
+ *
+ * [in] env An environment handle returned by mdbx_env_create()
+ * [in] seconds_16dot16 The period in 1/65536 of second when a synchronous
+ * flush would be made since the last unsteay commit.
+ *
+ * Returns A non-zero error value on failure and 0 on success. */
+LIBMDBX_API int mdbx_env_set_syncperiod(MDBX_env *env,
+ unsigned seconds_16dot16);
+
/* Returns a lag of the reading for the given transaction.
*
* Returns an information for estimate how much given read-only
@@ -1654,6 +1689,7 @@ LIBMDBX_API MDBX_oom_func *mdbx_env_get_oomfunc(MDBX_env *env);
#define MDBX_DBG_AUDIT 16
#define MDBX_DBG_JITTER 32
#define MDBX_DBG_DUMP 64
+#define MDBX_DBG_LEGACY_MULTIOPEN 128
typedef void MDBX_debug_func(int type, const char *function, int line,
const char *msg, va_list args);
@@ -1675,11 +1711,12 @@ typedef enum {
#define MDBX_PGWALK_GC ((const char *)((ptrdiff_t)-1))
#define MDBX_PGWALK_META ((const char *)((ptrdiff_t)-2))
-typedef int MDBX_pgvisitor_func(uint64_t pgno, unsigned number, void *ctx,
- int deep, const char *dbi, size_t page_size,
- MDBX_page_type_t type, size_t nentries,
- size_t payload_bytes, size_t header_bytes,
- size_t unused_bytes);
+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 size_t nentries, const size_t payload_bytes,
+ const size_t header_bytes, const size_t unused_bytes);
LIBMDBX_API int mdbx_env_pgwalk(MDBX_txn *txn, MDBX_pgvisitor_func *visitor,
void *ctx);