171 #include <sys/types.h>
172 #include <inttypes.h>
187 # define MDB_FMT_Z "I"
189 # define MDB_FMT_Z "z"
192 #if !defined(MDB_RPAGE_CACHE) || (defined(MDB_VL32) && !(MDB_RPAGE_CACHE))
194 #define MDB_RPAGE_CACHE 1
204 # define MDB_SIZE_MAX SIZE_MAX
206 # define MDB_PRIy(t) MDB_FMT_Z #t
208 # define MDB_SCNy(t) MDB_FMT_Z #t
211 # define MDB_SIZE_MAX UINT64_MAX
212 # define MDB_PRIy(t) PRI##t##64
213 # define MDB_SCNy(t) SCN##t##64
214 # define mdb_env_create mdb_env_create_vl32
235 #define MDB_VERSION_MAJOR 1
237 #define MDB_VERSION_MINOR 0
239 #define MDB_VERSION_PATCH 0
242 #define MDB_VERINT(a,b,c) (((a) << 24) | ((b) << 16) | (c))
245 #define MDB_VERSION_FULL \
246 MDB_VERINT(MDB_VERSION_MAJOR,MDB_VERSION_MINOR,MDB_VERSION_PATCH)
249 #define MDB_VERSION_DATE "April 28, 2026"
252 #define MDB_VERSTR(a,b,c,d) "LMDB " #a "." #b "." #c ": (" d ")"
255 #define MDB_VERFOO(a,b,c,d) MDB_VERSTR(a,b,c,d)
258 #define MDB_VERSION_STRING \
259 MDB_VERFOO(MDB_VERSION_MAJOR,MDB_VERSION_MINOR,MDB_VERSION_PATCH,MDB_VERSION_DATE)
348 #define MDB_FIXEDMAP 0x01
350 #define MDB_ENCRYPT 0x2000U
352 #define MDB_NOSUBDIR 0x4000
354 #define MDB_NOSYNC 0x10000
356 #define MDB_RDONLY 0x20000
358 #define MDB_NOMETASYNC 0x40000
360 #define MDB_WRITEMAP 0x80000
362 #define MDB_MAPASYNC 0x100000
364 #define MDB_NOTLS 0x200000
366 #define MDB_NOLOCK 0x400000
368 #define MDB_NORDAHEAD 0x800000
370 #define MDB_NOMEMINIT 0x1000000
372 #define MDB_PREVSNAPSHOT 0x2000000
374 #define MDB_REMAP_CHUNKS 0x4000000
381 #define MDB_REVERSEKEY 0x02
383 #define MDB_DUPSORT 0x04
387 #define MDB_INTEGERKEY 0x08
389 #define MDB_DUPFIXED 0x10
391 #define MDB_INTEGERDUP 0x20
393 #define MDB_REVERSEDUP 0x40
395 #define MDB_CREATE 0x40000
402 #define MDB_NOOVERWRITE 0x10
407 #define MDB_NODUPDATA 0x20
409 #define MDB_CURRENT 0x40
413 #define MDB_RESERVE 0x10000
415 #define MDB_APPEND 0x20000
417 #define MDB_APPENDDUP 0x40000
419 #define MDB_MULTIPLE 0x80000
428 #define MDB_CP_COMPACT 0x01
473 #define MDB_SUCCESS 0
475 #define MDB_KEYEXIST (-30799)
477 #define MDB_NOTFOUND (-30798)
479 #define MDB_PAGE_NOTFOUND (-30797)
481 #define MDB_CORRUPTED (-30796)
483 #define MDB_PANIC (-30795)
485 #define MDB_VERSION_MISMATCH (-30794)
487 #define MDB_INVALID (-30793)
489 #define MDB_MAP_FULL (-30792)
491 #define MDB_DBS_FULL (-30791)
493 #define MDB_READERS_FULL (-30790)
495 #define MDB_TLS_FULL (-30789)
497 #define MDB_TXN_FULL (-30788)
499 #define MDB_CURSOR_FULL (-30787)
501 #define MDB_PAGE_FULL (-30786)
503 #define MDB_MAP_RESIZED (-30785)
512 #define MDB_INCOMPATIBLE (-30784)
514 #define MDB_BAD_RSLOT (-30783)
516 #define MDB_BAD_TXN (-30782)
518 #define MDB_BAD_VALSIZE (-30781)
520 #define MDB_BAD_DBI (-30780)
522 #define MDB_PROBLEM (-30779)
524 #define MDB_BAD_CHECKSUM (-30778)
526 #define MDB_CRYPTO_FAIL (-30777)
528 #define MDB_ENV_ENCRYPTION (-30776)
530 #define MDB_TXN_PENDING (-30775)
532 #define MDB_CANT_ROLLBACK (-30774)
534 #define MDB_DBIS_BUSY (-30773)
536 #define MDB_SHORT_WRITE (-30772)
538 #define MDB_ENV_BUSY (-30771)
540 #define MDB_IS_READONLY (-30770)
542 #define MDB_ADDR_BUSY (-30769)
544 #define MDB_LAST_ERRCODE MDB_ADDR_BUSY
575 char *
mdb_version(
int *major,
int *minor,
int *patch);
1303 #define mdb_open(txn,name,flags,dbi) mdb_dbi_open(txn,name,flags,dbi)
1305 #define mdb_close(env,dbi) mdb_dbi_close(env,dbi)
1588 unsigned int flags);
1765 unsigned int flags);
1899 void *
mdb_modload(
const char *file,
const char *symname,