Crates.io | mmtkvdb |
lib.rs | mmtkvdb |
version | 0.16.0 |
source | src |
created_at | 2022-04-10 20:43:30.269505 |
updated_at | 2023-03-20 09:53:24.072277 |
description | Memory-mapped key-value database using LMDB |
homepage | https://www.public-software-group.org/mmtkvdb |
repository | https://www.public-software-group.org/git/mmtkvdb.git |
max_upload_size | |
id | 565225 |
size | 225,535 |
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.
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.
For documentation on how to use this crate, refer to the example in
src/lib.rs
.
See contained LICENSE
file (MIT License).
Storable::cmp_bytes_unchecked
of the unsafe Storable
trait must never unwind (as this might leave the LMDB environment in an
invalid state)ToOwned
bound from Storable
trait because it was not needednosync
, mapasync
, and nordahead
as well as corresponding
getter methods have been added to EnvBuilder
to allow better
configuration of the environmentWeak
by storing a unique
identifier of the environment in each DbBackend
CursorBackend::closed
with an AtomicBool
using
Relaxed
loads and stores to increase performance (free
/malloc
performs the necessary synchronization)DbOptions
Env::open_dbs
EnvRw::create_dbs
EnvRef::open_or_create_dbs
Txn::cursor_search_key_get_key
EnvRw::drop_db
requires &mut self
Env::clear_stale_readers
returns std::io::Result<usize>
unsafe
Txn::cursor_get_current_value_count
must only be called for
databases with KeysDuplicate
. This is enforced by the methods
signature now and could have been resulting in UB previously.EnvRw::drop_db
has been fixed and code has been
cleaned up and properly documented to avoid this in the future.mdb_cursor_close
being called after
mdb_dbi_close
, which is not allowed for write transaction by LMDB's
API specification. This has been fixed.Send
and Sync
have been added for
EnvRo
, EnvRw
, Db
, and Cursor
.EnvRw::drop_db
will require &mut self
in future.unsafe_op_in_unsafe_fn
lint and added corresponding unsafe
blocksSAFETY
comments in src/lib.rs
unsafe
and documented
their use properlyTxnRo
is now !Sync
(but still Send
); users are expected to use a
mutex where synchronization is requiredTxn::cursor_search_key_get_key
For older changes, refer to the CHANGELOG.md
file.