LMDB
lmdb.h
1 
166 #ifndef _LMDB_H_
167 #define _LMDB_H_
168 
169 #include <sys/types.h>
170 #include <inttypes.h>
171 #include <limits.h>
172 
173 #ifdef __cplusplus
174 extern "C" {
175 #endif
176 
178 #ifdef _MSC_VER
179 typedef int mdb_mode_t;
180 #else
181 typedef mode_t mdb_mode_t;
182 #endif
183 
184 #ifdef _WIN32
185 # define MDB_FMT_Z "I"
186 #else
187 # define MDB_FMT_Z "z"
188 #endif
189 
190 #ifndef MDB_VL32
191 
196 typedef size_t mdb_size_t;
197 # define MDB_SIZE_MAX SIZE_MAX
199 # define MDB_PRIy(t) MDB_FMT_Z #t
200 
201 # define MDB_SCNy(t) MDB_FMT_Z #t
202 #else
203 typedef uint64_t mdb_size_t;
204 # define MDB_SIZE_MAX UINT64_MAX
205 # define MDB_PRIy(t) PRI##t##64
206 # define MDB_SCNy(t) SCN##t##64
207 # define mdb_env_create mdb_env_create_vl32
208 #endif
209 
214 #ifdef _WIN32
215 typedef void *mdb_filehandle_t;
216 #else
217 typedef int mdb_filehandle_t;
218 #endif
219 
228 #define MDB_VERSION_MAJOR 0
229 
230 #define MDB_VERSION_MINOR 9
231 
232 #define MDB_VERSION_PATCH 70
233 
235 #define MDB_VERINT(a,b,c) (((a) << 24) | ((b) << 16) | (c))
236 
238 #define MDB_VERSION_FULL \
239  MDB_VERINT(MDB_VERSION_MAJOR,MDB_VERSION_MINOR,MDB_VERSION_PATCH)
240 
242 #define MDB_VERSION_DATE "December 19, 2015"
243 
245 #define MDB_VERSTR(a,b,c,d) "LMDB " #a "." #b "." #c ": (" d ")"
246 
248 #define MDB_VERFOO(a,b,c,d) MDB_VERSTR(a,b,c,d)
249 
251 #define MDB_VERSION_STRING \
252  MDB_VERFOO(MDB_VERSION_MAJOR,MDB_VERSION_MINOR,MDB_VERSION_PATCH,MDB_VERSION_DATE)
253 
260 typedef struct MDB_env MDB_env;
261 
267 typedef struct MDB_txn MDB_txn;
268 
270 typedef unsigned int MDB_dbi;
271 
273 typedef struct MDB_cursor MDB_cursor;
274 
286 typedef struct MDB_val {
287  size_t mv_size;
288  void *mv_data;
289 } MDB_val;
290 
292 typedef int (MDB_cmp_func)(const MDB_val *a, const MDB_val *b);
293 
308 typedef void (MDB_rel_func)(MDB_val *item, void *oldptr, void *newptr, void *relctx);
309 
314 #define MDB_FIXEDMAP 0x01
315 
316 #define MDB_NOSUBDIR 0x4000
317 
318 #define MDB_NOSYNC 0x10000
319 
320 #define MDB_RDONLY 0x20000
321 
322 #define MDB_NOMETASYNC 0x40000
323 
324 #define MDB_WRITEMAP 0x80000
325 
326 #define MDB_MAPASYNC 0x100000
327 
328 #define MDB_NOTLS 0x200000
329 
330 #define MDB_NOLOCK 0x400000
331 
332 #define MDB_NORDAHEAD 0x800000
333 
334 #define MDB_NOMEMINIT 0x1000000
335 
336 #define MDB_PREVSNAPSHOT 0x2000000
337 
343 #define MDB_REVERSEKEY 0x02
344 
345 #define MDB_DUPSORT 0x04
346 
349 #define MDB_INTEGERKEY 0x08
350 
351 #define MDB_DUPFIXED 0x10
352 
353 #define MDB_INTEGERDUP 0x20
354 
355 #define MDB_REVERSEDUP 0x40
356 
357 #define MDB_CREATE 0x40000
358 
364 #define MDB_NOOVERWRITE 0x10
365 
369 #define MDB_NODUPDATA 0x20
370 
371 #define MDB_CURRENT 0x40
372 
375 #define MDB_RESERVE 0x10000
376 
377 #define MDB_APPEND 0x20000
378 
379 #define MDB_APPENDDUP 0x40000
380 
381 #define MDB_MULTIPLE 0x80000
382 /* @} */
383 
390 #define MDB_CP_COMPACT 0x01
391 /* @} */
392 
398 typedef enum MDB_cursor_op {
427 } MDB_cursor_op;
428 
435 #define MDB_SUCCESS 0
436 
437 #define MDB_KEYEXIST (-30799)
438 
439 #define MDB_NOTFOUND (-30798)
440 
441 #define MDB_PAGE_NOTFOUND (-30797)
442 
443 #define MDB_CORRUPTED (-30796)
444 
445 #define MDB_PANIC (-30795)
446 
447 #define MDB_VERSION_MISMATCH (-30794)
448 
449 #define MDB_INVALID (-30793)
450 
451 #define MDB_MAP_FULL (-30792)
452 
453 #define MDB_DBS_FULL (-30791)
454 
455 #define MDB_READERS_FULL (-30790)
456 
457 #define MDB_TLS_FULL (-30789)
458 
459 #define MDB_TXN_FULL (-30788)
460 
461 #define MDB_CURSOR_FULL (-30787)
462 
463 #define MDB_PAGE_FULL (-30786)
464 
465 #define MDB_MAP_RESIZED (-30785)
466 
474 #define MDB_INCOMPATIBLE (-30784)
475 
476 #define MDB_BAD_RSLOT (-30783)
477 
478 #define MDB_BAD_TXN (-30782)
479 
480 #define MDB_BAD_VALSIZE (-30781)
481 
482 #define MDB_BAD_DBI (-30780)
483 
484 #define MDB_PROBLEM (-30779)
485 
486 #define MDB_LAST_ERRCODE MDB_PROBLEM
487 
490 typedef struct MDB_stat {
491  unsigned int ms_psize;
493  unsigned int ms_depth;
494  mdb_size_t ms_branch_pages;
495  mdb_size_t ms_leaf_pages;
496  mdb_size_t ms_overflow_pages;
497  mdb_size_t ms_entries;
498 } MDB_stat;
499 
501 typedef struct MDB_envinfo {
502  void *me_mapaddr;
503  mdb_size_t me_mapsize;
504  mdb_size_t me_last_pgno;
505  mdb_size_t me_last_txnid;
506  unsigned int me_maxreaders;
507  unsigned int me_numreaders;
508 } MDB_envinfo;
509 
517 char *mdb_version(int *major, int *minor, int *patch);
518 
529 char *mdb_strerror(int err);
530 
542 int mdb_env_create(MDB_env **env);
543 
671 int mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode);
672 
687 int mdb_env_copy(MDB_env *env, const char *path);
688 
702 int mdb_env_copyfd(MDB_env *env, mdb_filehandle_t fd);
703 
727 int mdb_env_copy2(MDB_env *env, const char *path, unsigned int flags);
728 
746 int mdb_env_copyfd2(MDB_env *env, mdb_filehandle_t fd, unsigned int flags);
747 
754 int mdb_env_stat(MDB_env *env, MDB_stat *stat);
755 
762 int mdb_env_info(MDB_env *env, MDB_envinfo *stat);
763 
783 int mdb_env_sync(MDB_env *env, int force);
784 
793 void mdb_env_close(MDB_env *env);
794 
809 int mdb_env_set_flags(MDB_env *env, unsigned int flags, int onoff);
810 
821 int mdb_env_get_flags(MDB_env *env, unsigned int *flags);
822 
835 int mdb_env_get_path(MDB_env *env, const char **path);
836 
851 int mdb_env_get_fd(MDB_env *env, mdb_filehandle_t *fd);
852 
885 int mdb_env_set_mapsize(MDB_env *env, mdb_size_t size);
886 
904 int mdb_env_set_maxreaders(MDB_env *env, unsigned int readers);
905 
916 int mdb_env_get_maxreaders(MDB_env *env, unsigned int *readers);
917 
936 int mdb_env_set_maxdbs(MDB_env *env, MDB_dbi dbs);
937 
946 
953 int mdb_env_set_userctx(MDB_env *env, void *ctx);
954 
960 void *mdb_env_get_userctx(MDB_env *env);
961 
968 typedef void MDB_assert_func(MDB_env *env, const char *msg);
969 
978 
1017 int mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **txn);
1018 
1023 MDB_env *mdb_txn_env(MDB_txn *txn);
1024 
1034 mdb_size_t mdb_txn_id(MDB_txn *txn);
1035 
1052 int mdb_txn_commit(MDB_txn *txn);
1053 
1062 void mdb_txn_abort(MDB_txn *txn);
1063 
1081 void mdb_txn_reset(MDB_txn *txn);
1082 
1097 int mdb_txn_renew(MDB_txn *txn);
1098 
1100 #define mdb_open(txn,name,flags,dbi) mdb_dbi_open(txn,name,flags,dbi)
1101 
1102 #define mdb_close(env,dbi) mdb_dbi_close(env,dbi)
1103 
1173 int mdb_dbi_open(MDB_txn *txn, const char *name, unsigned int flags, MDB_dbi *dbi);
1174 
1187 int mdb_stat(MDB_txn *txn, MDB_dbi dbi, MDB_stat *stat);
1188 
1196 int mdb_dbi_flags(MDB_txn *txn, MDB_dbi dbi, unsigned int *flags);
1197 
1214 void mdb_dbi_close(MDB_env *env, MDB_dbi dbi);
1215 
1225 int mdb_drop(MDB_txn *txn, MDB_dbi dbi, int del);
1226 
1246 int mdb_set_compare(MDB_txn *txn, MDB_dbi dbi, MDB_cmp_func *cmp);
1247 
1269 int mdb_set_dupsort(MDB_txn *txn, MDB_dbi dbi, MDB_cmp_func *cmp);
1270 
1289 int mdb_set_relfunc(MDB_txn *txn, MDB_dbi dbi, MDB_rel_func *rel);
1290 
1305 int mdb_set_relctx(MDB_txn *txn, MDB_dbi dbi, void *ctx);
1306 
1333 int mdb_get(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data);
1334 
1382 int mdb_put(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data,
1383  unsigned int flags);
1384 
1407 int mdb_del(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data);
1408 
1431 int mdb_cursor_open(MDB_txn *txn, MDB_dbi dbi, MDB_cursor **cursor);
1432 
1439 void mdb_cursor_close(MDB_cursor *cursor);
1440 
1457 int mdb_cursor_renew(MDB_txn *txn, MDB_cursor *cursor);
1458 
1464 
1470 
1490 int mdb_cursor_get(MDB_cursor *cursor, MDB_val *key, MDB_val *data,
1491  MDB_cursor_op op);
1492 
1552 int mdb_cursor_put(MDB_cursor *cursor, MDB_val *key, MDB_val *data,
1553  unsigned int flags);
1554 
1576 int mdb_cursor_del(MDB_cursor *cursor, unsigned int flags);
1577 
1590 int mdb_cursor_count(MDB_cursor *cursor, mdb_size_t *countp);
1591 
1602 int mdb_cmp(MDB_txn *txn, MDB_dbi dbi, const MDB_val *a, const MDB_val *b);
1603 
1614 int mdb_dcmp(MDB_txn *txn, MDB_dbi dbi, const MDB_val *a, const MDB_val *b);
1615 
1622 typedef int (MDB_msg_func)(const char *msg, void *ctx);
1623 
1631 int mdb_reader_list(MDB_env *env, MDB_msg_func *func, void *ctx);
1632 
1639 int mdb_reader_check(MDB_env *env, int *dead);
1642 #ifdef __cplusplus
1643 }
1644 #endif
1645 
1653 #endif /* _LMDB_H_ */
MDB_LAST
Definition: lmdb.h:408
mdb_env_stat
int mdb_env_stat(MDB_env *env, MDB_stat *stat)
Return statistics about the LMDB environment.
Definition: mdb.c:10694
mdb_txn_env
MDB_env * mdb_txn_env(MDB_txn *txn)
Returns the transaction's MDB_env.
Definition: mdb.c:3262
MDB_rel_func
void() MDB_rel_func(MDB_val *item, void *oldptr, void *newptr, void *relctx)
A callback function used to relocate a position-dependent data item in a fixed-address database.
Definition: lmdb.h:308
mdb_drop
int mdb_drop(MDB_txn *txn, MDB_dbi dbi, int del)
Empty or delete+close a database.
Definition: mdb.c:11016
mdb_env_close
void mdb_env_close(MDB_env *env)
Close the environment and release the memory map.
Definition: mdb.c:5824
mdb_cursor_dbi
MDB_dbi mdb_cursor_dbi(MDB_cursor *cursor)
Return the cursor's database handle.
Definition: mdb.c:8760
mdb_env_get_path
int mdb_env_get_path(MDB_env *env, const char **path)
Return the path that was used in mdb_env_open().
Definition: mdb.c:10655
mdb_env_get_maxkeysize
int mdb_env_get_maxkeysize(MDB_env *env)
Get the maximum size of keys and MDB_DUPSORT data we can write.
Definition: mdb.c:11104
MDB_stat::ms_branch_pages
mdb_size_t ms_branch_pages
Definition: lmdb.h:494
MDB_SET_RANGE
Definition: lmdb.h:424
MDB_PREV_NODUP
Definition: lmdb.h:421
MDB_stat::ms_overflow_pages
mdb_size_t ms_overflow_pages
Definition: lmdb.h:496
MDB_SET_KEY
Definition: lmdb.h:423
mdb_env_get_userctx
void * mdb_env_get_userctx(MDB_env *env)
Get the application information associated with the MDB_env.
Definition: mdb.c:10638
mdb_reader_list
int mdb_reader_list(MDB_env *env, MDB_msg_func *func, void *ctx)
Dump the entries in the reader lock table.
Definition: mdb.c:11110
MDB_cursor_op
MDB_cursor_op
Cursor Get operations.
Definition: lmdb.h:398
MDB_NEXT_NODUP
Definition: lmdb.h:417
mdb_dcmp
int mdb_dcmp(MDB_txn *txn, MDB_dbi dbi, const MDB_val *a, const MDB_val *b)
Compare two data items according to a particular database.
Definition: mdb.c:1987
MDB_GET_BOTH_RANGE
Definition: lmdb.h:403
mdb_cursor_open
int mdb_cursor_open(MDB_txn *txn, MDB_dbi dbi, MDB_cursor **cursor)
Create a cursor handle.
Definition: mdb.c:8643
mdb_dbi_open
int mdb_dbi_open(MDB_txn *txn, const char *name, unsigned int flags, MDB_dbi *dbi)
Open a database in the environment.
Definition: mdb.c:10748
mdb_dbi_close
void mdb_dbi_close(MDB_env *env, MDB_dbi dbi)
Close a database handle. Normally unnecessary. Use with care:
Definition: mdb.c:10885
mdb_txn_begin
int mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **txn)
Create a transaction for use with the environment.
Definition: mdb.c:3143
mdb_env_info
int mdb_env_info(MDB_env *env, MDB_envinfo *stat)
Return information about the LMDB environment.
Definition: mdb.c:10707
MDB_NEXT
Definition: lmdb.h:411
MDB_cmp_func
int() MDB_cmp_func(const MDB_val *a, const MDB_val *b)
A callback function used to compare two keys in a database.
Definition: lmdb.h:292
mdb_env_set_mapsize
int mdb_env_set_mapsize(MDB_env *env, mdb_size_t size)
Set the size of the memory map to use for this environment.
Definition: mdb.c:4559
mdb_env_open
int mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode)
Open an environment handle.
Definition: mdb.c:5528
MDB_GET_MULTIPLE
Definition: lmdb.h:405
mdb_set_relfunc
int mdb_set_relfunc(MDB_txn *txn, MDB_dbi dbi, MDB_rel_func *rel)
Set a relocation function for a MDB_FIXEDMAP database.
Definition: mdb.c:11085
MDB_env
Opaque structure for a database environment.
Definition: mdb.c:1463
MDB_val::mv_size
size_t mv_size
Definition: lmdb.h:287
mdb_stat
int mdb_stat(MDB_txn *txn, MDB_dbi dbi, MDB_stat *stat)
Retrieve statistics for a database.
Definition: mdb.c:10868
mdb_env_set_assert
int mdb_env_set_assert(MDB_env *env, MDB_assert_func *func)
Definition: mdb.c:10644
mdb_txn_abort
void mdb_txn_abort(MDB_txn *txn)
Abandon all the operations of the transaction instead of saving them.
Definition: mdb.c:3417
MDB_envinfo::me_numreaders
unsigned int me_numreaders
Definition: lmdb.h:507
MDB_NEXT_DUP
Definition: lmdb.h:412
mdb_cursor_del
int mdb_cursor_del(MDB_cursor *cursor, unsigned int flags)
Delete current key/data pair.
Definition: mdb.c:8078
mdb_env_create
int mdb_env_create(MDB_env **env)
Create an LMDB environment handle.
Definition: mdb.c:4407
mdb_cursor_renew
int mdb_cursor_renew(MDB_txn *txn, MDB_cursor *cursor)
Renew a cursor handle.
Definition: mdb.c:8677
mdb_cursor_close
void mdb_cursor_close(MDB_cursor *cursor)
Close a cursor handle.
Definition: mdb.c:8732
MDB_SET
Definition: lmdb.h:422
MDB_FIRST
Definition: lmdb.h:399
mdb_cursor_put
int mdb_cursor_put(MDB_cursor *cursor, MDB_val *key, MDB_val *data, unsigned int flags)
Store by cursor.
Definition: mdb.c:7551
mdb_set_dupsort
int mdb_set_dupsort(MDB_txn *txn, MDB_dbi dbi, MDB_cmp_func *cmp)
Set a custom data comparison function for a MDB_DUPSORT database.
Definition: mdb.c:11076
MDB_val::mv_data
void * mv_data
Definition: lmdb.h:288
mdb_env_get_fd
int mdb_env_get_fd(MDB_env *env, mdb_filehandle_t *fd)
Return the filedescriptor for the given environment.
Definition: mdb.c:10665
mdb_env_copy
int mdb_env_copy(MDB_env *env, const char *path)
Copy an LMDB environment to the specified path.
Definition: mdb.c:10601
mdb_txn_commit
int mdb_txn_commit(MDB_txn *txn)
Commit all the operations of a transaction into the database.
Definition: mdb.c:3891
MDB_PREV_DUP
Definition: lmdb.h:419
MDB_LAST_DUP
Definition: lmdb.h:409
mdb_env_get_maxreaders
int mdb_env_get_maxreaders(MDB_env *env, unsigned int *readers)
Get the maximum number of threads/reader slots for the environment.
Definition: mdb.c:4618
MDB_GET_CURRENT
Definition: lmdb.h:404
MDB_envinfo::me_last_pgno
mdb_size_t me_last_pgno
Definition: lmdb.h:504
MDB_assert_func
void MDB_assert_func(MDB_env *env, const char *msg)
A callback function for most LMDB assert() failures, called before printing the message and aborting.
Definition: lmdb.h:968
mdb_env_copyfd
int mdb_env_copyfd(MDB_env *env, mdb_filehandle_t fd)
Copy an LMDB environment to the specified file descriptor.
MDB_envinfo::me_mapaddr
void * me_mapaddr
Definition: lmdb.h:502
MDB_PREV_MULTIPLE
Definition: lmdb.h:425
mdb_env_get_flags
int mdb_env_get_flags(MDB_env *env, unsigned int *flags)
Get environment flags.
Definition: mdb.c:10619
MDB_envinfo
Information about the environment.
Definition: lmdb.h:501
MDB_NEXT_MULTIPLE
Definition: lmdb.h:414
mdb_env_set_maxdbs
int mdb_env_set_maxdbs(MDB_env *env, MDB_dbi dbs)
Set the maximum number of named databases for the environment.
Definition: mdb.c:4600
mdb_env_set_userctx
int mdb_env_set_userctx(MDB_env *env, void *ctx)
Set application information associated with the MDB_env.
Definition: mdb.c:10629
MDB_stat::ms_entries
mdb_size_t ms_entries
Definition: lmdb.h:497
mdb_strerror
char * mdb_strerror(int err)
Return a string describing a given error code.
Definition: mdb.c:1708
MDB_dbi
unsigned int MDB_dbi
A handle for an individual database in the DB environment.
Definition: lmdb.h:270
mdb_put
int mdb_put(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data, unsigned int flags)
Store items into a database.
Definition: mdb.c:10026
mdb_cursor_count
int mdb_cursor_count(MDB_cursor *cursor, mdb_size_t *countp)
Return count of duplicates for current key.
Definition: mdb.c:8694
mdb_dbi_flags
int mdb_dbi_flags(MDB_txn *txn, MDB_dbi dbi, unsigned int *flags)
Retrieve the DB flags for a database handle.
Definition: mdb.c:10901
MDB_msg_func
int() MDB_msg_func(const char *msg, void *ctx)
A callback function used to print a message from the library.
Definition: lmdb.h:1622
MDB_PREV
Definition: lmdb.h:418
MDB_GET_BOTH
Definition: lmdb.h:402
mdb_set_relctx
int mdb_set_relctx(MDB_txn *txn, MDB_dbi dbi, void *ctx)
Set a context pointer for a MDB_FIXEDMAP database's relocation function.
Definition: mdb.c:11094
MDB_envinfo::me_last_txnid
mdb_size_t me_last_txnid
Definition: lmdb.h:505
mdb_env_copyfd2
int mdb_env_copyfd2(MDB_env *env, mdb_filehandle_t fd, unsigned int flags)
Copy an LMDB environment to the specified file descriptor, with options.
mdb_cursor_get
int mdb_cursor_get(MDB_cursor *cursor, MDB_val *key, MDB_val *data, MDB_cursor_op op)
Retrieve by cursor.
Definition: mdb.c:7330
MDB_stat
Statistics for a database in the environment.
Definition: lmdb.h:490
MDB_cursor
Opaque structure for navigating through a database.
Definition: mdb.c:1374
mdb_del
int mdb_del(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data)
Delete items from a database.
Definition: mdb.c:9539
mdb_get
int mdb_get(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data)
Get items from a database.
Definition: mdb.c:6770
mdb_txn_id
mdb_size_t mdb_txn_id(MDB_txn *txn)
Return the transaction's ID.
Definition: mdb.c:3269
MDB_val
Generic structure used for passing keys and data in and out of the database.
Definition: lmdb.h:286
MDB_stat::ms_psize
unsigned int ms_psize
Definition: lmdb.h:491
MDB_FIRST_DUP
Definition: lmdb.h:400
mdb_txn_renew
int mdb_txn_renew(MDB_txn *txn)
Renew a read-only transaction.
Definition: mdb.c:3126
MDB_envinfo::me_mapsize
mdb_size_t me_mapsize
Definition: lmdb.h:503
MDB_txn
Opaque structure for a transaction handle.
Definition: mdb.c:1256
mdb_version
char * mdb_version(int *major, int *minor, int *patch)
Return the LMDB library version information.
Definition: mdb.c:1674
mdb_txn_reset
void mdb_txn_reset(MDB_txn *txn)
Reset a read-only transaction.
Definition: mdb.c:3404
MDB_envinfo::me_maxreaders
unsigned int me_maxreaders
Definition: lmdb.h:506
mdb_env_set_maxreaders
int mdb_env_set_maxreaders(MDB_env *env, unsigned int readers)
Set the maximum number of threads/reader slots for the environment.
Definition: mdb.c:4609
mdb_reader_check
int mdb_reader_check(MDB_env *env, int *dead)
Check for stale entries in the reader lock table.
Definition: mdb.c:11188
mdb_cursor_txn
MDB_txn * mdb_cursor_txn(MDB_cursor *cursor)
Return the cursor's transaction handle.
Definition: mdb.c:8753
MDB_stat::ms_depth
unsigned int ms_depth
Definition: lmdb.h:493
mdb_set_compare
int mdb_set_compare(MDB_txn *txn, MDB_dbi dbi, MDB_cmp_func *cmp)
Set a custom key comparison function for a database.
Definition: mdb.c:11067
mdb_env_copy2
int mdb_env_copy2(MDB_env *env, const char *path, unsigned int flags)
Copy an LMDB environment to the specified path, with options.
Definition: mdb.c:10581
mdb_cmp
int mdb_cmp(MDB_txn *txn, MDB_dbi dbi, const MDB_val *a, const MDB_val *b)
Compare two data items according to a particular database.
Definition: mdb.c:1981
MDB_stat::ms_leaf_pages
mdb_size_t ms_leaf_pages
Definition: lmdb.h:495
mdb_env_set_flags
int mdb_env_set_flags(MDB_env *env, unsigned int flags, int onoff)
Set environment flags.
Definition: mdb.c:10607
mdb_env_sync
int mdb_env_sync(MDB_env *env, int force)
Flush the data buffers to disk.
Definition: mdb.c:2847