# 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
as `Vec<u8>` and `String`
* New traits `BorrowStorable` and `StorableRef` which handle storing
tuples in a more efficient way (without unnecessary cloning/copying)
* Improved documentation in module `storable`
* Minor style change: Renamed type arg from `X` to `T` for generic structs
in `owning_pointer`
* 2022-05-15: Version 0.2.0
* Trait `Env` was removed. Instead, `EnvRw` implements
`Deref<Target=EnvRo>`, which makes all methods of `EnvRo` available on
`EnvRw` as well. Converting an `EnvRw` into `EnvRo` is now simply done by
cloning.
* Methods `TxnRw::cursor_delete_current` and
`TxnRw::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 of `TxnRw::used_dbs`, which defers closing of
databases.
* Internal changes:
* Method `TxnBackend::close_cursors` will finish closing the cursor
before releasing the lock on the `CursorBackend::closed` flag (this
should not affect runtime behavior).
* `EnvRo` is now used in some places where `EnvBackend` has been used
internally (this allows implementing `Deref<Target=EnvRo>` for
`EnvRw`).
* 2022-05-08: Version 0.1.0
* Removed `'static` bound from `Storable` trait
* Improved documentation regarding required `unsafe` use of this library
For older changes, refer to the `CHANGELOG.md` file.