Lindenii Project Forge
Login

hare-lmdb

Hare bindings for LMDB
Commit info
ID
a3e39637c1739064186810a8479e7947e5bb19d6
Author
Runxi Yu <me@runxiyu.org>
Author date
Thu, 13 Mar 2025 22:34:04 +0800
Committer
Runxi Yu <me@runxiyu.org>
Committer date
Thu, 13 Mar 2025 22:34:04 +0800
Actions
Documentation comments should be above definitions
export def CP_COMPACT = 0x01; // Compacting copy: Omit free space from copy, and renumber all pages sequentially.

// Compacting copy: Omit free space from copy, and renumber all pages sequentially.
export def CP_COMPACT = 0x01;
export def REVERSEKEY = 0x02; // use reverse string keys
export def DUPSORT = 0x04; // use sorted duplicates
export def INTEGERKEY = 0x08; // numeric keys in native byte order: either unsigned int or size_t. The keys must all be of the same size.
export def DUPFIXED = 0x10; // with [[DUPSORT]], sorted dup items have fixed size
export def INTEGERDUP = 0x20; // with [[DUPSORT]], dups are [[INTEGERKEY]]-style integers
export def REVERSEDUP = 0x40; // with [[DUPSORT]], use reverse string dups
export def CREATE = 0x40000; // create DB if not already existing
// use reverse string keys
export def REVERSEKEY = 0x02;
// use sorted duplicates
export def DUPSORT = 0x04;
// numeric keys in native byte order: either unsigned int or size_t. The keys must all be of the same size.
export def INTEGERKEY = 0x08;
// with [[DUPSORT]], sorted dup items have fixed size
export def DUPFIXED = 0x10;
// with [[DUPSORT]], dups are [[INTEGERKEY]]-style integers
export def INTEGERDUP = 0x20;
// with [[DUPSORT]], use reverse string dups
export def REVERSEDUP = 0x40;
// create DB if not already existing
export def CREATE = 0x40000;
export def FIXEDMAP = 0x01; // mmap at a fixed address (experimental)
export def NOSUBDIR = 0x4000; // no environment directory
export def NOSYNC = 0x10000; // don't fsync after commit
export def RDONLY = 0x20000; // read only
export def NOMETASYNC = 0x40000; // don't fsync metapage after commit
export def WRITEMAP = 0x80000; // use writable mmap
export def MAPASYNC = 0x100000; // use asynchronous msync when [[WRITEMAP]] is used
export def NOTLS = 0x200000; // tie reader locktable slots to [[txn]] objects instead of to threads
export def NOLOCK = 0x400000; // don't do any locking, caller must manage their own locks
export def NORDAHEAD = 0x800000; // don't do readahead (no effect on Windows)
export def NOMEMINIT = 0x1000000; // don't initialize malloc'd memory before writing to datafile
// mmap at a fixed address (experimental)
export def FIXEDMAP = 0x01;
// no environment directory
export def NOSUBDIR = 0x4000;
// don't fsync after commit
export def NOSYNC = 0x10000;
// read only
export def RDONLY = 0x20000;
// don't fsync metapage after commit
export def NOMETASYNC = 0x40000;
// use writable mmap
export def WRITEMAP = 0x80000;
// use asynchronous msync when [[WRITEMAP]] is used
export def MAPASYNC = 0x100000;
// tie reader locktable slots to [[txn]] objects instead of to threads
export def NOTLS = 0x200000;
// don't do any locking, caller must manage their own locks
export def NOLOCK = 0x400000;
// don't do readahead (no effect on Windows)
export def NORDAHEAD = 0x800000;
// don't initialize malloc'd memory before writing to datafile
export def NOMEMINIT = 0x1000000;
export def NOOVERWRITE = 0x10; // For put: Don't write if the key already exists.
export def NODUPDATA = 0x20; // Only for [[DUPSORT]]: For put: don't write if the key and data pair already exist. For mdb_cursor_del: remove all duplicate data items.
export def CURRENT = 0x40; // For mdb_cursor_put: overwrite the current key/data pair
export def RESERVE = 0x10000; // For put: Just reserve space for data, don't copy it. Return a pointer to the reserved space.
export def APPEND = 0x20000; // Data is being appended, don't split full pages.
export def APPENDDUP = 0x40000; // Duplicate data is being appended, don't split full pages.
export def MULTIPLE = 0x80000; // Store multiple data items in one call. Only for [[DUPFIXED]].
// For put: Don't write if the key already exists.
export def NOOVERWRITE = 0x10;
// Only for [[DUPSORT]]: For put: don't write if the key and data pair already exist. For mdb_cursor_del: remove all duplicate data items.
export def NODUPDATA = 0x20;
// For mdb_cursor_put: overwrite the current key/data pair
export def CURRENT = 0x40;
// For put: Just reserve space for data, don't copy it. Return a pointer to the reserved space.
export def RESERVE = 0x10000;
// Data is being appended, don't split full pages.
export def APPEND = 0x20000;
// Duplicate data is being appended, don't split full pages.
export def APPENDDUP = 0x40000;
// Store multiple data items in one call. Only for [[DUPFIXED]].
export def MULTIPLE = 0x80000;
// BerkeleyDB uses -30800 to -30999, we'll go under them

export def SUCCESS = 0; // Successful result
export def KEYEXIST = (-30799); // key/data pair already exists
export def NOTFOUND = (-30798); // key/data pair not found (EOF)
export def PAGE_NOTFOUND = (-30797); // Requested page not found - this usually indicates corruption
export def CORRUPTED = (-30796); // Located page was wrong type
export def PANIC = (-30795); // Update of meta page failed or environment had fatal error
export def VERSION_MISMATCH = (-30794); // Environment version mismatch
export def INVALID = (-30793); // File is not a valid LMDB file
export def MAP_FULL = (-30792); // Environment mapsize reached
export def DBS_FULL = (-30791); // Environment maxdbs reached
export def READERS_FULL = (-30790); // Environment maxreaders reached
export def TLS_FULL = (-30789); // Too many TLS keys in use - Windows only
export def TXN_FULL = (-30788); // Txn has too many dirty pages
export def CURSOR_FULL = (-30787); // Cursor stack too deep - internal error
export def PAGE_FULL = (-30786); // Page has not enough space - internal error
export def MAP_RESIZED = (-30785); // Database contents grew beyond environment mapsize
export def INCOMPATIBLE = (-30784); // Operation and DB incompatible, or DB type changed. This can mean: (1) The operation expects an [[DUPSORT]] / [[DUPFIXED]] database. (2) Opening a named DB when the unnamed DB has [[DUPSORT]] / [[INTEGERKEY]]. (3) Accessing a data record as a database, or vice versa. (4) The database was dropped and recreated with different flags.
export def BAD_RSLOT = (-30783); // Invalid reuse of reader locktable slot
export def BAD_TXN = (-30782); // Transaction must abort, has a child, or is invalid
export def BAD_VALSIZE = (-30781); // Unsupported size of key/DB name/data, or wrong DUPFIXED size
export def BAD_DBI = (-30780); // The specified DBI was changed unexpectedly
export def LAST_ERRCODE = BAD_DBI; // The last defined error code
// Successful result
export def SUCCESS = 0;
// key/data pair already exists
export def KEYEXIST = (-30799);
// key/data pair not found (EOF)
export def NOTFOUND = (-30798);
// Requested page not found - this usually indicates corruption
export def PAGE_NOTFOUND = (-30797);
// Located page was wrong type
export def CORRUPTED = (-30796);
// Update of meta page failed or environment had fatal error
export def PANIC = (-30795);
// Environment version mismatch
export def VERSION_MISMATCH = (-30794);
// File is not a valid LMDB file
export def INVALID = (-30793);
// Environment mapsize reached
export def MAP_FULL = (-30792);
// Environment maxdbs reached
export def DBS_FULL = (-30791);
// Environment maxreaders reached
export def READERS_FULL = (-30790);
// Too many TLS keys in use - Windows only
export def TLS_FULL = (-30789);
// Txn has too many dirty pages
export def TXN_FULL = (-30788);
// Cursor stack too deep - internal error
export def CURSOR_FULL = (-30787);
// Page has not enough space - internal error
export def PAGE_FULL = (-30786);
// Database contents grew beyond environment mapsize
export def MAP_RESIZED = (-30785);
// Operation and DB incompatible, or DB type changed. This can mean:
// (1) The operation expects an [[DUPSORT]] / [[DUPFIXED]] database.
// (2) Opening a named DB when the unnamed DB has [[DUPSORT]] / [[INTEGERKEY]].
// (3) Accessing a data record as a database, or vice versa.
// (4) The database was dropped and recreated with different flags.
export def INCOMPATIBLE = (-30784);
// Invalid reuse of reader locktable slot
export def BAD_RSLOT = (-30783);
// Transaction must abort, has a child, or is invalid
export def BAD_TXN = (-30782);
// Unsupported size of key/DB name/data, or wrong DUPFIXED size
export def BAD_VALSIZE = (-30781);
// The specified DBI was changed unexpectedly
export def BAD_DBI = (-30780);
// The last defined error code
export def LAST_ERRCODE = BAD_DBI;