Lindenii Project Forge
Login

hare-lmdb

Hare bindings for LMDB
Commit info
ID
8f69c8de4b4fff0d6bc122b06c521e913f85c265
Author
Runxi Yu <me@runxiyu.org>
Author date
Thu, 13 Mar 2025 22:02:34 +0800
Committer
Runxi Yu <me@runxiyu.org>
Committer date
Thu, 13 Mar 2025 22:06:04 +0800
Actions
Move everything to am lmdb folder
// This is the set of all operations for retrieving data
// using a cursor.
export type cursor_op = enum {
	FIRST, // Position at first key/data item
	FIRST_DUP, // Position at first data item of current key. Only for [[DUPSORT]]
	GET_BOTH, // Position at key/data pair. Only for [[DUPSORT]]
	GET_BOTH_RANGE, // position at key, nearest data. Only for [[DUPSORT]]
	GET_CURRENT, // Return key/data at current cursor position
	GET_MULTIPLE, // Return up to a page of duplicate data items from current cursor position. Move cursor to prepare for [[NEXT_MULTIPLE]]. Only for [[DUPFIXED]]
	LAST, // Position at last key/data item
	LAST_DUP, // Position at last data item of current key. Only for [[DUPSORT]]
	NEXT, // Position at next data item
	NEXT_DUP, // Position at next data item of current key. Only for [[DUPSORT]]
	NEXT_MULTIPLE, // Return up to a page of duplicate data items from next cursor position. Move cursor to prepare for [[NEXT_MULTIPLE]]. Only for [[DUPFIXED]]
	NEXT_NODUP, // Position at first data item of next key
	PREV, // Position at previous data item
	PREV_DUP, // Position at previous data item of current key. Only for [[DUPSORT]]
	PREV_NODUP, // Position at last data item of previous key
	SET, // Position at specified key
	SET_KEY, // Position at specified key, return key + data
	SET_RANGE, // Position at first key greater than or equal to specified key.
	PREV_MULTIPLE, // Position at previous page and return up to a page of duplicate data items. Only for [[DUPFIXED]]
};
export def CP_COMPACT = 0x01; // Compacting copy: Omit free space from copy, and renumber all pages sequentially.

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
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
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]].
// 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