mmtkvdb
mmtkvdb
is a crate for Rust which provides a memory-mapped key-value
database. It uses LMDB and links with an existing liblmdb
on the system.
Safety
Because of how memory-mapped I/O is being used and also because of certain
assumptions of the underlying LMDB API, opening environments and databases
requires unsafe
Rust (i.e. the programmer must ensure that certain
preconditions are met that cannot be enforced by the compiler to avoid
undefined behavior). If you aim to program in safe Rust only, this Rust
library is not suitable for you.
API Documentation
For documentation on how to use this crate, refer to the example in
src/lib.rs
.
License
See contained LICENSE
file (MIT License).
Changelog
- 2022-05-26: Version 0.3.0
- Storing owned types differently
- Removed implementation of
Storable
for certain smart pointers such asVec<u8>
andString
- New traits
BorrowStorable
andStorableRef
which handle storing tuples in a more efficient way (without unnecessary cloning/copying)
- Removed implementation of
- Improved documentation in module
storable
- Minor style change: Renamed type arg from
X
toT
for generic structs inowning_pointer
- Storing owned types differently
- 2022-05-15: Version 0.2.0
- Trait
Env
was removed. Instead,EnvRw
implementsDeref<Target=EnvRo>
, which makes all methods ofEnvRo
available onEnvRw
as well. Converting anEnvRw
intoEnvRo
is now simply done by cloning. - Methods
TxnRw::cursor_delete_current
andTxnRw::cursor_delete_current_key
did not properly defer closing the affected databases. This might have caused database corruption when the cursor and (all clones of) the database handle are dropped before the transaction commits or aborts. This has been fixed. - Added support for nested transactions.
- Suppress warnings regarding unused macro rules when using
rustc 1.62.0-nightly (77652b9ef 2022-05-06)
(the unused macro rules are kept for potential future use). - Improved documentation:
- The doc comment for
TxnRw
contained a misleading (partial) paragraph which was removed. - Improved doc comments regarding duplicate keys on methods
DbOptions::keys_unique
,DbOptions::keys_duplicate
,DbOptions::has_duplicate_keys
,TxnRw::put
,TxnRw::put_unless_key_exists
,TxnRw::put_unless_pair_exists
. - The private doc comment on
DbBackend
has been extended to explain the mechanism ofTxnRw::used_dbs
, which defers closing of databases.
- The doc comment for
- Internal changes:
- Method
TxnBackend::close_cursors
will finish closing the cursor before releasing the lock on theCursorBackend::closed
flag (this should not affect runtime behavior). EnvRo
is now used in some places whereEnvBackend
has been used internally (this allows implementingDeref<Target=EnvRo>
forEnvRw
).
- Method
- Trait
- 2022-05-08: Version 0.1.0
- Removed
'static
bound fromStorable
trait - Improved documentation regarding required
unsafe
use of this library
- Removed
For older changes, refer to the CHANGELOG.md
file.