# Full changelog of `mmtkvdb` * 2023-03-20: Version 0.16.0 * Documented that `Storable::cmp_bytes_unchecked` of the unsafe `Storable` trait must never unwind (as this might leave the LMDB environment in an invalid state) * Removed `ToOwned` bound from `Storable` trait because it was not needed * Methods `nosync`, `mapasync`, and `nordahead` as well as corresponding getter methods have been added to `EnvBuilder` to allow better configuration of the environment * Minor performance improvements * Avoid unnecessary upgrading of a `Weak` by storing a unique identifier of the environment in each `DbBackend` * Replaced mutex `CursorBackend::closed` with an `AtomicBool` using `Relaxed` loads and stores to increase performance (`free`/`malloc` performs the necessary synchronization) * Minor documentation improvements * Code cleanup in benchmark and changed some benchmark settings * 2023-03-17: Version 0.15.0 * Several deprecated items have been removed: * `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` * Improved documentation in regard to use of `unsafe` * 2023-03-16: Version 0.14.1 * Critical bug fixes: * Opening the same database twice (in the same process) might have caused UB. This has been fixed. * LMDB databases might have been closed twice if an error occurred during opening, which might have caused UB in that case. This has been fixed. * Method `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. * A memory leak in `EnvRw::drop_db` has been fixed and code has been cleaned up and properly documented to avoid this in the future. * Write transactions which created a cursor but never wrote any data might have resulted in `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. * All LMDB databases get closed explicitly now before the LMDB environment is closed. * Missing implementations for `Send` and `Sync` have been added for `EnvRo`, `EnvRw`, `Db`, and `Cursor`. * Deprecations: * A warning has been added to the documentation, stating that `EnvRw::drop_db` will require `&mut self` in future. * Methods for opening several databases at once (with the same types) have been deprecated. The methods opening a single database should be used instead. * Improved "Safety" sections in public API documentation * Code cleanup in regard to safety: * Use `unsafe_op_in_unsafe_fn` lint and added corresponding `unsafe` blocks * Added `SAFETY` comments in `src/lib.rs` * Correctly marked some private functions as `unsafe` and documented their use properly * 2023-03-10: Version 0.14.0 * `TxnRo` is now `!Sync` (but still `Send`); users are expected to use a mutex where synchronization is required * Deprecated `Txn::cursor_search_key_get_key` * Improved documentation regarding return values of cursor methods * Added benchmarks * 2023-03-07: Version 0.13.0 * Added various cursor methods to `Txn` trait, which allow moving cursors without retrieving data * Removed deprecated implementation of `Storable` for `()` (use `NoKey` and/or `NoValue` instead of `()`) * 2023-03-06: Version 0.12.1 * Removed dependencies on unstable Rust features * Introduced `NoKey` and `NoValue` unit structs to replace `()` as type for databases which have no key or no value, respectively (this deprecates the implementation of `Storable` for `()`) * Added method which deletes all entries in database * New method `TxnRw::on_commit` allows registering a closure that will be executed on `Txn::commit` before the transaction is actually committed * 2023-02-13: Version 0.12.0 * The `Env` trait supports reference-to-reference conversion to `EnvRo`, either through `AsRef`, which is a supertrait of `Env` now, or using the new `Env::as_env_ro` method. * 2023-02-12: Version 0.11.0 * Implement `Env` trait only for `EnvRo` and `EnvRw`, and no longer for every `T: AsRef` * 2023-02-11: Version 0.10.0 * Methods of `EnvRo` have been moved to a new trait `Env`, which is implemented for both `EnvRo` and `EnvRw`. * `EnvRw` no longer implements `Deref` (but still implements `AsRef`). * For convenience, a module `traits` has been added, which re-exports the `Env`, `EnvRef`, and `Txn` traits in unnameable form, such that by importing `traits::*` all trait methods will be in scope. * `EnvRef` is implemented for `&T` where `T: Env`. * 2023-02-09: Version 0.9.4 * Implement `AsRef` for `EnvRo` and `EnvRw` * 2023-02-07: Version 0.9.3 * Implement `Storable` trait for byte arrays (`[u8; N]`) * 2023-02-06: Version 0.9.2 * Implement `Storable` trait for the unit type `()` * 2023-01-11: Version 0.9.1 * Added `EnvRef` trait which provides an abstraction over `&EnvRo` and `&mut EnvRw` * 2023-01-10: Version 0.9.0 * Renamed `DbOptions` to `DbBuilder` * Provide type alias `DbSpec` for `DbBuilder`s which have a name (or the unnamed database) set * Use `bindgen` version 0.63 for building * 2022-08-27: Version 0.8.2 * Removed wrong (unnecessary) bound `T: Storable` in implementation of `BorrowStorable for Vec` (only `[T]` needs to be `Storable`) * Re-export `storable::BorrowStorable` in crate-level module (resulting in all items of module `storable` being available at crate-level) * Directly use question mark operator in all examples * Minor code style change (use `io::Result<_>` instead of `Result<_, io::Error>`) * 2022-07-22: Version 0.8.1 * Fix warning by removing `#![feature(core_ffi_c)]`, which is now stable * Removed unnecessary `Sized` supertrait of `Storable` * Some code cleanup (simplified bounds on GATs in `Storable` tuples) * 2022-07-12: Version 0.8.0 * Trait `Ord` is no longer required for `Storable` types. * Use `deref_owned` version 0.10.1 * Improved documentation * Bugfixes * The constant `Storable::TRIVIAL_CMP` was set to true for signed byte slices, which led to wrong comparisons of keys or duplicate values. * The macro `impl_ord_for_storable` was broken. The macro is no longer needed and has been removed, thus the bug does not exist anymore. * Changed re-exports * A new module `cow` has been added, which re-exports items from crate `deref_owned`. * All relevant items are now re-exported by the crate-level module as well. * Code cleanup * Internal macros in `storable` module have been cleaned up. * Cleaner implementation for `BorrowStorable` which allowed removing the private `IsType` trait and the public `StorableWithOwned` trait. * Consistent use of `GenericCow` where applicable * Added more tests * 2022-07-02: Version 0.7.0 * Use `deref_owned` version 0.8.0 * 2022-07-01: Version 0.6.0 * Use `deref_owned` version 0.7.0 (this changes bounds on `Storable::AlignedRef`) * 2022-07-01: Version 0.5.0 * Use `deref_owned` version 0.6.1 * `deref_owned::GenericCow` and `deref_owned::Owned` are no longer re-exported * 2022-06-30: Version 0.4.1 * Use `deref_owned` version 0.4.0 * 2022-06-29: Version 0.4.0 * Use crate [`deref_owned`](https://crates.io/crates/deref_owned) instead of own module `owning_pointer` * Use `deref_owned::Owned` instead of `owning_pointer::Owned` * Use `deref_owned::IntoOwned` instead of `owning_pointer::PointerIntoOwned` * Use `Vec` instead of `owning_pointer::OwnedPointer>` (as `deref_owned::IntoOwned` is implemented for `Vec`) * Re-export `deref_owned::{Owned, IntoOwned}` in module `storable` * Re-export `deref_owned::IntoOwned` in crate-level module * Provide macro `impl_ord_for_storable`, which allows automatic implementation of `PartialEq`, `Eq`, `PartialOrd`, and `Ord` for types which implement `Storable` * Set `Storable::TRIVIAL_CMP` to true in more cases to improve performance and make default implementation of `Storable::cmp_bytes_unchecked` do a trivial comparison if constant is true * Better documentation/explanation of GAT `storable::Storable::AlignedRef` * 2022-06-20: Version 0.3.1 * Accept `StorableRef` instead of references to `Storable` in more places * Allow passing `StorableRef` instead of reference to `Storable` as key to method `Txn::get_owned` (which was already allowed for `Txn::get`) * More generic implementation of `StorableRef` for tuples (e.g. `(&i32, &String)` in addition to `(&i32, &str)`), which enhances usability in some cases * 2022-05-26: Version 0.3.0 * Storing owned types differently * Removed implementation of `Storable` for certain smart pointers such as `Vec` 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`, 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` for `EnvRw`). * 2022-05-08: Version 0.1.0 * Removed `'static` bound from `Storable` trait * Improved documentation regarding required `unsafe` use of this library * 2022-05-05: Version 0.0.7 * Fixed method `cursor_set_key_search_value_get_value`, which was wrongly defined and documented * Added test function with various tests for cursors * 2022-05-01: Version 0.0.6 * Fixed build error on nightly Rust by importing `core::ffi::{c_size_t, c_int, c_uint}` for now instead of using `std::ffi` (see [commit `07ea143f96` in Rust](https://github.com/rust-lang/rust/commit/07ea143f96929ac7f0b7af0f025be48a472273e5) for explanation) * 2022-04-30: Version 0.0.5 * Method `EnvRo::txn` moved to `Env` trait and renamed to `Env::txn_ro`. * Method `EnvRw::txn` renamed to `EnvRw::txn_rw`. * Improved documentation of `EnvRo` and `EnvRw` (doc comment explains how to create them now, i.e. how to start a transaction) * 2022-04-22: Version 0.0.4 * No longer use `PhantomData` to store unit-like structs which indicate constraints on key uniqueness in `DbOptions` and `Db` (`KeysUnique` and `KeysDuplicate` are `Copy` now and contained directly) * Minor fixes in documentation * Changed argument name for passing `DbOptions` to `Env::open_dbs` * Added link to `Sized` in doc comment on private trait `IsType` * 2022-04-16: Version 0.0.3 * Avoid transmute on references: To avoid issues with (possible) future changes in Rust, the `storable` module doesn't use `transmute` on references anymore. Instead, `std::slice::from_raw_parts`, `std::str::from_utf8_unchecked`, and `str::as_bytes()` are used. * 2022-04-11: Version 0.0.2 * Moved `Storable`, `StorableConstBytesLen`, and `StorableWithOwned` traits to new (public) `storable` module (but `Storable` gets re-exported by crate-level module) * Added method to clear stale readers * Improved documentation on (un)safety * Avoid unnecessary re-alignment in some cases of `u8` and `i8` * Make type `bool` storable (i.e. implement `Storable` for `bool`) * Added documentation comments for private items * Code cleanup (moved private `IsType` trait to `helpers` module) * 2022-04-10: Version 0.0.1 * First release