Crate lmdb [−] [src]
Idiomatic and safe APIs for interacting with the Symas Lightning Memory-Mapped Database (LMDB).
Structs
Database |
A handle to an individual database in an environment. |
DatabaseFlags |
Database Options |
Environment |
An LMDB environment. |
EnvironmentBuilder |
Options for opening or creating an environment. |
EnvironmentFlags |
Environment Options |
InactiveTransaction |
An inactive read-only transaction. |
Iter | |
IterDup | |
RoCursor |
A read-only cursor for navigating the items within a database. |
RoTransaction |
An LMDB read-only transaction. |
RwCursor |
A read-only cursor for navigating items within a database. |
RwTransaction |
An LMDB read-write transaction. |
WriteFlags |
Write Options |
Enums
Error |
Constants
APPEND |
Append the given item to the end of the database. No key comparisons are performed. This option allows fast bulk loading when keys are already known to be in the correct order. Loading unsorted keys with this flag will cause data corruption. |
APPEND_DUP |
Same as |
CURRENT |
For |
DUP_FIXED |
This flag may only be used in combination with |
DUP_SORT |
Duplicate keys may be used in the database. (Or, from another perspective, keys may have multiple data items, stored in sorted order.) By default keys must be unique and may have only a single data item. |
FIXED_MAP |
Use a fixed address for the mmap region. This flag must be specified when creating the environment, and is stored persistently in the environment. If successful, the memory map will always reside at the same virtual address and pointers used to reference data items in the database will be constant across multiple invocations. This option may not always work, depending on how the operating system has allocated memory to shared libraries and other uses. The feature is highly experimental. |
INTEGER_DUP |
This option specifies that duplicate data items are also integers, and should be sorted as such. |
INTEGER_KEY |
Keys are binary integers in native byte order. Setting this option requires all keys to be the same size, typically 32 or 64 bits. |
MAP_ASYNC |
When using |
NO_DUP_DATA |
Insert the new item only if it does not already appear in the database.
This flag may only be specified if the database was opened with |
NO_LOCK |
Do not do any locking. If concurrent access is anticipated, the caller must manage all concurrency themself. For proper operation the caller must enforce single-writer semantics, and must ensure that no readers are using old transactions while a writer is active. The simplest approach is to use an exclusive lock so that no readers may be active at all when a writer begins. |
NO_MEM_INIT |
Do not initialize malloc'd memory before writing to unused spaces in the data file.
By default, memory for pages written to the data file is obtained using malloc.
While these pages may be reused in subsequent transactions, freshly malloc'd pages
will be initialized to zeroes before use. This avoids persisting leftover data from
other code (that used the heap and subsequently freed the memory) into the data
file. Note that many other system libraries may allocate and free memory from the
heap for arbitrary uses. E.g., stdio may use the heap for file I/O buffers. This
initialization step has a modest performance cost so some applications may want to
disable it using this flag. This option can be a problem for applications which
handle sensitive data like passwords, and it makes memory checkers like Valgrind
noisy. This flag is not needed with |
NO_META_SYNC |
Flush system buffers to disk only once per transaction, omit the metadata flush.
Defer that until the system flushes files to disk, or next non- |
NO_OVERWRITE |
Insert the new item only if the key does not already appear in the database.
The function will return |
NO_READAHEAD |
Turn off readahead. Most operating systems perform readahead on read requests by default. This option turns it off if the OS supports it. Turning it off may help random read performance when the DB is larger than RAM and system RAM is full. The option is not implemented on Windows. |
NO_SUB_DIR |
By default, LMDB creates its environment in a directory whose pathname is given in
|
NO_SYNC |
Don't flush system buffers to disk when committing a transaction. This optimization
means a system crash can corrupt the database or lose the last transactions if
buffers are not yet flushed to disk. The risk is governed by how often the system
flushes dirty buffers to disk and how often |
NO_TLS |
Don't use thread-local storage. Tie reader locktable slots to transaction objects
instead of to threads. I.e. |
READ_ONLY |
Open the environment in read-only mode. No write operations will be allowed. When opening an environment, LMDB will still modify the lock file - except on read-only filesystems, where LMDB does not use locks. |
REVERSE_DUP |
This option specifies that duplicate data items should be compared as strings in reverse order. |
REVERSE_KEY |
Keys are strings to be compared in reverse order, from the end of the strings to the beginning. By default, Keys are treated as strings and compared from beginning to end. |
WRITE_MAP |
Use a writeable memory map unless |
Traits
Cursor |
An LMDB cursor. |
Transaction |
An LMDB transaction. |
Type Definitions
Result |