lmdb_sys/
constants.rs

1use libc::{c_int, c_uint};
2
3////////////////////////////////////////////////////////////////////////////////////////////////////
4//// Environment Flags
5////////////////////////////////////////////////////////////////////////////////////////////////////
6
7/// mmap at a fixed address (experimental)
8pub const MDB_FIXEDMAP: c_uint = 0x01;
9/// no environment directory
10pub const MDB_NOSUBDIR: c_uint = 0x4000;
11/// don't fsync after commit
12pub const MDB_NOSYNC: c_uint = 0x10000;
13/// read only
14pub const MDB_RDONLY: c_uint = 0x20000;
15/// don't fsync metapage after commit
16pub const MDB_NOMETASYNC: c_uint = 0x40000;
17/// use writable mmap
18pub const MDB_WRITEMAP: c_uint = 0x80000;
19/// use asynchronous msync when #MDB_WRITEMAP is used
20pub const MDB_MAPASYNC: c_uint = 0x100000;
21/// tie reader locktable slots to #MDB_txn objects instead of to threads
22pub const MDB_NOTLS: c_uint = 0x200000;
23/// don't do any locking, caller must manage their own locks
24pub const MDB_NOLOCK: c_uint = 0x400000;
25/// don't do readahead (no effect on Windows)
26pub const MDB_NORDAHEAD: c_uint = 0x800000;
27/// don't initialize malloc'd memory before writing to datafile
28pub const MDB_NOMEMINIT: c_uint = 0x1000000;
29
30////////////////////////////////////////////////////////////////////////////////////////////////////
31//// Database Flags
32////////////////////////////////////////////////////////////////////////////////////////////////////
33
34/// use reverse string keys
35pub const MDB_REVERSEKEY: c_uint = 0x02;
36/// use sorted duplicates
37pub const MDB_DUPSORT: c_uint = 0x04;
38/// numeric keys in native byte order. The keys must all be of the same size.
39pub const MDB_INTEGERKEY: c_uint = 0x08;
40/// with `MDB_DUPSORT`, sorted dup items have fixed size.
41pub const MDB_DUPFIXED: c_uint = 0x10;
42/// with `MDB_DUPSORT`, dups are numeric in native byte order.
43pub const MDB_INTEGERDUP: c_uint = 0x20;
44/// with #MDB_DUPSORT, use reverse string dups.
45pub const MDB_REVERSEDUP: c_uint = 0x40;
46/// create DB if not already existing.
47pub const MDB_CREATE: c_uint = 0x40000;
48
49////////////////////////////////////////////////////////////////////////////////////////////////////
50//// Write Flags
51////////////////////////////////////////////////////////////////////////////////////////////////////
52
53/// For put: Don't write if the key already exists.
54pub const MDB_NOOVERWRITE: c_uint = 0x10;
55/// Only for `MDB_DUPSORT`.
56///
57/// For put: don't write if the key and data pair already exist.
58/// For `mdb_cursor_del`: remove all duplicate data items.
59pub const MDB_NODUPDATA: c_uint = 0x20;
60/// For `mdb_cursor_put`: overwrite the current key/data pair.
61pub const MDB_CURRENT: c_uint = 0x40;
62/// For put: Just reserve space for data, don't copy it. Return a pointer to the reserved space.
63pub const MDB_RESERVE: c_uint = 0x10000;
64/// Data is being appended, don't split full pages.
65pub const MDB_APPEND: c_uint = 0x20000;
66/// Duplicate data is being appended, don't split full pages.
67pub const MDB_APPENDDUP: c_uint = 0x40000;
68/// Store multiple data items in one call. Only for #MDB_DUPFIXED.
69pub const MDB_MULTIPLE: c_uint = 0x80000;
70
71////////////////////////////////////////////////////////////////////////////////////////////////////
72//// Copy Flags
73////////////////////////////////////////////////////////////////////////////////////////////////////
74
75/// Compacting copy: Omit free space from copy, and renumber all pages sequentially.
76pub const MDB_CP_COMPACT: c_uint = 0x01;
77
78////////////////////////////////////////////////////////////////////////////////////////////////////
79//// Return Codes
80////////////////////////////////////////////////////////////////////////////////////////////////////
81
82/// Successful result.
83pub const MDB_SUCCESS: c_int = 0;
84/// key/data pair already exists.
85pub const MDB_KEYEXIST: c_int = -30799;
86/// key/data pair not found (EOF).
87pub const MDB_NOTFOUND: c_int = -30798;
88/// Requested page not found - this usually indicates corruption.
89pub const MDB_PAGE_NOTFOUND: c_int = -30797;
90/// Located page was wrong type.
91pub const MDB_CORRUPTED: c_int = -30796;
92/// Update of meta page failed or environment had fatal error.
93pub const MDB_PANIC: c_int = -30795;
94/// Environment version mismatch.
95pub const MDB_VERSION_MISMATCH: c_int = -30794;
96/// File is not a valid LMDB file.
97pub const MDB_INVALID: c_int = -30793;
98/// Environment mapsize reached.
99pub const MDB_MAP_FULL: c_int = -30792;
100/// Environment maxdbs reached.
101pub const MDB_DBS_FULL: c_int = -30791;
102/// Environment maxreaders reached.
103pub const MDB_READERS_FULL: c_int = -30790;
104/// Too many TLS keys in use - Windows only.
105pub const MDB_TLS_FULL: c_int = -30789;
106/// Txn has too many dirty pages.
107pub const MDB_TXN_FULL: c_int = -30788;
108/// Cursor stack too deep - internal error.
109pub const MDB_CURSOR_FULL: c_int = -30787;
110/// Page has not enough space - internal error.
111pub const MDB_PAGE_FULL: c_int = -30786;
112/// Database contents grew beyond environment mapsize.
113pub const MDB_MAP_RESIZED: c_int = -30785;
114/// MDB_INCOMPATIBLE: Operation and DB incompatible, or DB flags changed.
115pub const MDB_INCOMPATIBLE: c_int = -30784;
116/// Invalid reuse of reader locktable slot.
117pub const MDB_BAD_RSLOT: c_int = -30783;
118/// Transaction cannot recover - it must be aborted.
119pub const MDB_BAD_TXN: c_int = -30782;
120/// Unsupported size of key/DB name/data, or wrong DUPFIXED size.
121pub const MDB_BAD_VALSIZE: c_int = -30781;
122/// The specified DBI was changed unexpectedly.
123pub const MDB_BAD_DBI: c_int = -30780;
124/// The last defined error code.
125pub const MDB_LAST_ERRCODE: c_int = MDB_BAD_DBI;