From a3e39637c1739064186810a8479e7947e5bb19d6 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Thu, 13 Mar 2025 22:34:04 +0800 Subject: [PATCH] Documentation comments should be above definitions --- lmdb/flags_copy.ha | 4 ++-- lmdb/flags_db.ha | 21 ++++++++++++++------- lmdb/flags_env.ha | 33 ++++++++++++++++++++++----------- lmdb/flags_write.ha | 21 ++++++++++++++------- lmdb/return_codes.ha | 70 ++++++++++++++++++++++++++++++++++++----------------- diff --git a/lmdb/flags_copy.ha b/lmdb/flags_copy.ha index 975dd713ea25b28764db54c9975e6535668f7fcb..e7b124e53ac8337cb592aab247d270278b7c4091 100644 --- a/lmdb/flags_copy.ha +++ b/lmdb/flags_copy.ha @@ -1,2 +1,2 @@ -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; diff --git a/lmdb/flags_db.ha b/lmdb/flags_db.ha index 341af08079873a61538380a68b3cea8250b1201a..db7728339325b4adafee468c2d78c903202b6626 100644 --- a/lmdb/flags_db.ha +++ b/lmdb/flags_db.ha @@ -1,7 +1,14 @@ -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; diff --git a/lmdb/flags_env.ha b/lmdb/flags_env.ha index 37d9f5c5dedf77cbb4d6df515a304c559019e96f..d057f030fc5e5f70c89e0ddda1265ade9d36beba 100644 --- a/lmdb/flags_env.ha +++ b/lmdb/flags_env.ha @@ -1,11 +1,22 @@ -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; diff --git a/lmdb/flags_write.ha b/lmdb/flags_write.ha index 7bd290cc5c8bf152d2f78ac5897a1ea14124d2b8..c2b4e80447abc7d787cbdbea0dd8bbf996ca6d15 100644 --- a/lmdb/flags_write.ha +++ b/lmdb/flags_write.ha @@ -1,7 +1,14 @@ -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; diff --git a/lmdb/return_codes.ha b/lmdb/return_codes.ha index 65ab4f1b47589d0b8e294f49a56cbd0e98ae8fd3..6c7765bfbef5a0c56ad6030e0386d97531c658a9 100644 --- a/lmdb/return_codes.ha +++ b/lmdb/return_codes.ha @@ -1,24 +1,50 @@ // 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; -- 2.48.1