From a6bc027be6548bd4880a82e0842220f5ea53f1b1 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Thu, 13 Mar 2025 22:00:57 +0800 Subject: [PATCH] Remove MDB_/mdb_ prefix --- cursor_get_operations.ha | 40 ++++++++++++++++++++-------------------- flags_copy.ha | 2 +- flags_db.ha | 14 +++++++------- flags_env.ha | 22 +++++++++++----------- flags_write.ha | 14 +++++++------- return_codes.ha | 44 ++++++++++++++++++++++---------------------- diff --git a/cursor_get_operations.ha b/cursor_get_operations.ha index ad454c972c53822b16b083a59f922d2083619922..7b6396a08f79df99d725d9a2091b8ac29e69c167 100644 --- a/cursor_get_operations.ha +++ b/cursor_get_operations.ha @@ -1,23 +1,23 @@ // This is the set of all operations for retrieving data // using a cursor. -export type MDB_cursor_op = enum { - MDB_FIRST, // Position at first key/data item - MDB_FIRST_DUP, // Position at first data item of current key. Only for #MDB_DUPSORT - MDB_GET_BOTH, // Position at key/data pair. Only for #MDB_DUPSORT - MDB_GET_BOTH_RANGE, // position at key, nearest data. Only for #MDB_DUPSORT - MDB_GET_CURRENT, // Return key/data at current cursor position - MDB_GET_MULTIPLE, // Return up to a page of duplicate data items from current cursor position. Move cursor to prepare for #MDB_NEXT_MULTIPLE. Only for #MDB_DUPFIXED - MDB_LAST, // Position at last key/data item - MDB_LAST_DUP, // Position at last data item of current key. Only for #MDB_DUPSORT - MDB_NEXT, // Position at next data item - MDB_NEXT_DUP, // Position at next data item of current key. Only for #MDB_DUPSORT - MDB_NEXT_MULTIPLE, // Return up to a page of duplicate data items from next cursor position. Move cursor to prepare for #MDB_NEXT_MULTIPLE. Only for #MDB_DUPFIXED - MDB_NEXT_NODUP, // Position at first data item of next key - MDB_PREV, // Position at previous data item - MDB_PREV_DUP, // Position at previous data item of current key. Only for #MDB_DUPSORT - MDB_PREV_NODUP, // Position at last data item of previous key - MDB_SET, // Position at specified key - MDB_SET_KEY, // Position at specified key, return key + data - MDB_SET_RANGE, // Position at first key greater than or equal to specified key. - MDB_PREV_MULTIPLE, // Position at previous page and return up to a page of duplicate data items. Only for #MDB_DUPFIXED +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]] }; diff --git a/flags_copy.ha b/flags_copy.ha index e0cab2cabe954046d1aad9f6dc9f55a65eb1c1a5..975dd713ea25b28764db54c9975e6535668f7fcb 100644 --- a/flags_copy.ha +++ b/flags_copy.ha @@ -1,2 +1,2 @@ -export def MDB_CP_COMPACT = 0x01; // Compacting copy: Omit free space from copy, and renumber all pages sequentially. +export def CP_COMPACT = 0x01; // Compacting copy: Omit free space from copy, and renumber all pages sequentially. diff --git a/flags_db.ha b/flags_db.ha index d195ca3935e1bdb98f0cfcc29dc3385f869b2245..341af08079873a61538380a68b3cea8250b1201a 100644 --- a/flags_db.ha +++ b/flags_db.ha @@ -1,7 +1,7 @@ -export def MDB_REVERSEKEY = 0x02; // use reverse string keys -export def MDB_DUPSORT = 0x04; // use sorted duplicates -export def MDB_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 MDB_DUPFIXED = 0x10; // with #MDB_DUPSORT, sorted dup items have fixed size -export def MDB_INTEGERDUP = 0x20; // with #MDB_DUPSORT, dups are #MDB_INTEGERKEY-style integers -export def MDB_REVERSEDUP = 0x40; // with #MDB_DUPSORT, use reverse string dups -export def MDB_CREATE = 0x40000; // create DB if not already existing +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 diff --git a/flags_env.ha b/flags_env.ha index 183ec2f097e80d7fc423a7e593c53ba16caf2e22..37d9f5c5dedf77cbb4d6df515a304c559019e96f 100644 --- a/flags_env.ha +++ b/flags_env.ha @@ -1,11 +1,11 @@ -export def MDB_FIXEDMAP = 0x01; // mmap at a fixed address (experimental) -export def MDB_NOSUBDIR = 0x4000; // no environment directory -export def MDB_NOSYNC = 0x10000; // don't fsync after commit -export def MDB_RDONLY = 0x20000; // read only -export def MDB_NOMETASYNC = 0x40000; // don't fsync metapage after commit -export def MDB_WRITEMAP = 0x80000; // use writable mmap -export def MDB_MAPASYNC = 0x100000; // use asynchronous msync when #MDB_WRITEMAP is used -export def MDB_NOTLS = 0x200000; // tie reader locktable slots to #MDB_txn objects instead of to threads -export def MDB_NOLOCK = 0x400000; // don't do any locking, caller must manage their own locks -export def MDB_NORDAHEAD = 0x800000; // don't do readahead (no effect on Windows) -export def MDB_NOMEMINIT = 0x1000000; // don't initialize malloc'd memory before writing to datafile +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 diff --git a/flags_write.ha b/flags_write.ha index b77a0719aca30574d5972100538d63f24aaa322b..7bd290cc5c8bf152d2f78ac5897a1ea14124d2b8 100644 --- a/flags_write.ha +++ b/flags_write.ha @@ -1,7 +1,7 @@ -export def MDB_NOOVERWRITE = 0x10; // For put: Don't write if the key already exists. -export def MDB_NODUPDATA = 0x20; // Only for #MDB_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 MDB_CURRENT = 0x40; // For mdb_cursor_put: overwrite the current key/data pair -export def MDB_RESERVE = 0x10000; // For put: Just reserve space for data, don't copy it. Return a pointer to the reserved space. -export def MDB_APPEND = 0x20000; // Data is being appended, don't split full pages. -export def MDB_APPENDDUP = 0x40000; // Duplicate data is being appended, don't split full pages. -export def MDB_MULTIPLE = 0x80000; // Store multiple data items in one call. Only for #MDB_DUPFIXED. +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]]. diff --git a/return_codes.ha b/return_codes.ha index c30ca4e639811fa55170c49e73b401b2bb780538..65ab4f1b47589d0b8e294f49a56cbd0e98ae8fd3 100644 --- a/return_codes.ha +++ b/return_codes.ha @@ -1,24 +1,24 @@ // BerkeleyDB uses -30800 to -30999, we'll go under them -export def MDB_SUCCESS = 0; // Successful result -export def MDB_KEYEXIST = (-30799); // key/data pair already exists -export def MDB_NOTFOUND = (-30798); // key/data pair not found (EOF) -export def MDB_PAGE_NOTFOUND = (-30797); // Requested page not found - this usually indicates corruption -export def MDB_CORRUPTED = (-30796); // Located page was wrong type -export def MDB_PANIC = (-30795); // Update of meta page failed or environment had fatal error -export def MDB_VERSION_MISMATCH = (-30794); // Environment version mismatch -export def MDB_INVALID = (-30793); // File is not a valid LMDB file -export def MDB_MAP_FULL = (-30792); // Environment mapsize reached -export def MDB_DBS_FULL = (-30791); // Environment maxdbs reached -export def MDB_READERS_FULL = (-30790); // Environment maxreaders reached -export def MDB_TLS_FULL = (-30789); // Too many TLS keys in use - Windows only -export def MDB_TXN_FULL = (-30788); // Txn has too many dirty pages -export def MDB_CURSOR_FULL = (-30787); // Cursor stack too deep - internal error -export def MDB_PAGE_FULL = (-30786); // Page has not enough space - internal error -export def MDB_MAP_RESIZED = (-30785); // Database contents grew beyond environment mapsize -export def MDB_INCOMPATIBLE = (-30784); // Operation and DB incompatible, or DB type changed. This can mean: (1) The operation expects an #MDB_DUPSORT / #MDB_DUPFIXED database. (2) Opening a named DB when the unnamed DB has #MDB_DUPSORT / #MDB_INTEGERKEY. (3) Accessing a data record as a database, or vice versa. (4) The database was dropped and recreated with different flags. -export def MDB_BAD_RSLOT = (-30783); // Invalid reuse of reader locktable slot -export def MDB_BAD_TXN = (-30782); // Transaction must abort, has a child, or is invalid -export def MDB_BAD_VALSIZE = (-30781); // Unsupported size of key/DB name/data, or wrong DUPFIXED size -export def MDB_BAD_DBI = (-30780); // The specified DBI was changed unexpectedly -export def MDB_LAST_ERRCODE = MDB_BAD_DBI; // The last defined error code +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 -- 2.48.1