Skip to content

Commit

Permalink
remove-me: heed3 changes generated by the convert-to-heed3.sh script
Browse files Browse the repository at this point in the history
  • Loading branch information
gfidlab-ci-user authored and Kerollmops committed Dec 6, 2024
1 parent df6fe02 commit e30489a
Show file tree
Hide file tree
Showing 11 changed files with 378 additions and 397 deletions.
65 changes: 23 additions & 42 deletions heed/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
[package]
name = "heed"
name = "heed3"
version = "0.21.0"
authors = ["Kerollmops <[email protected]>"]
description = "A fully typed LMDB (mdb.master) wrapper with minimum overhead"
description = "A fully typed LMDB (mdb.master3) wrapper with minimum overhead with support for encryption"
license = "MIT"
repository = "https://github.com/Kerollmops/heed"
keywords = ["lmdb", "database", "storage", "typed"]
keywords = ["lmdb", "database", "storage", "typed", "encryption"]
categories = ["database", "data-structures"]
readme = "../README.md"
edition = "2021"

[dependencies]
# TODO update dependencies
aead = { version = "0.5.2", default-features = false }
bitflags = { version = "2.6.0", features = ["serde"] }
byteorder = { version = "1.5.0", default-features = false }
generic-array = { version = "0.14.7", features = ["serde"] }
heed-traits = { version = "0.20.0", path = "../heed-traits" }
heed-types = { version = "0.21.0", default-features = false, path = "../heed-types" }
libc = "0.2.167"
lmdb-master-sys = { version = "0.2.4", path = "../lmdb-master-sys" }
lmdb-master3-sys = { version = "0.2.4", path = "../lmdb-master3-sys" }
once_cell = "1.20.2"
page_size = "0.6.0"
serde = { version = "1.0.215", features = ["derive"], optional = true }
synchronoise = "1.0.1"

[dev-dependencies]
# TODO update dependencies
argon2 = { version = "0.5.3", features = ["std"] }
serde = { version = "1.0.215", features = ["derive"] }
chacha20poly1305 = "0.10.1"
tempfile = "3.14.0"

[target.'cfg(windows)'.dependencies]
Expand Down Expand Up @@ -68,7 +74,7 @@ unbounded_depth = ["heed-types/unbounded_depth"]
# There are tradeoffs for both POSIX and SysV semaphores; which you
# should look into before enabling this feature. Also, see here:
# <https://github.com/LMDB/lmdb/blob/3947014aed7ffe39a79991fa7fb5b234da47ad1a/libraries/liblmdb/lmdb.h#L46-L69>
posix-sem = ["lmdb-master-sys/posix-sem"]
posix-sem = ["lmdb-master3-sys/posix-sem"]

# These features configure the MDB_IDL_LOGN macro, which determines
# the size of the free and dirty page lists (and thus the amount of memory
Expand All @@ -80,15 +86,15 @@ posix-sem = ["lmdb-master-sys/posix-sem"]
#
# For more information on the motivation for these features (and their effect),
# see https://github.com/mozilla/lmdb/pull/2.
mdb_idl_logn_8 = ["lmdb-master-sys/mdb_idl_logn_8"]
mdb_idl_logn_9 = ["lmdb-master-sys/mdb_idl_logn_9"]
mdb_idl_logn_10 = ["lmdb-master-sys/mdb_idl_logn_10"]
mdb_idl_logn_11 = ["lmdb-master-sys/mdb_idl_logn_11"]
mdb_idl_logn_12 = ["lmdb-master-sys/mdb_idl_logn_12"]
mdb_idl_logn_13 = ["lmdb-master-sys/mdb_idl_logn_13"]
mdb_idl_logn_14 = ["lmdb-master-sys/mdb_idl_logn_14"]
mdb_idl_logn_15 = ["lmdb-master-sys/mdb_idl_logn_15"]
mdb_idl_logn_16 = ["lmdb-master-sys/mdb_idl_logn_16"]
mdb_idl_logn_8 = ["lmdb-master3-sys/mdb_idl_logn_8"]
mdb_idl_logn_9 = ["lmdb-master3-sys/mdb_idl_logn_9"]
mdb_idl_logn_10 = ["lmdb-master3-sys/mdb_idl_logn_10"]
mdb_idl_logn_11 = ["lmdb-master3-sys/mdb_idl_logn_11"]
mdb_idl_logn_12 = ["lmdb-master3-sys/mdb_idl_logn_12"]
mdb_idl_logn_13 = ["lmdb-master3-sys/mdb_idl_logn_13"]
mdb_idl_logn_14 = ["lmdb-master3-sys/mdb_idl_logn_14"]
mdb_idl_logn_15 = ["lmdb-master3-sys/mdb_idl_logn_15"]
mdb_idl_logn_16 = ["lmdb-master3-sys/mdb_idl_logn_16"]

# Setting this enables you to use keys longer than 511 bytes. The exact limit
# is computed by LMDB at compile time. You can find the exact value by calling
Expand All @@ -108,35 +114,10 @@ mdb_idl_logn_16 = ["lmdb-master-sys/mdb_idl_logn_16"]
# stored key must fit within the smallest limit of all architectures used. For
# example, if you are moving databases between Apple M1 and Apple Intel
# computers then you need to keep your keys within the smaller 1982 byte limit.
longer-keys = ["lmdb-master-sys/longer-keys"]
longer-keys = ["lmdb-master3-sys/longer-keys"]

# Examples are located outside the standard heed/examples directory to prevent
# conflicts between heed3 and heed examples when working on both crates.
[[example]]
name = "all-types"
path = "../examples/all-types.rs"

[[example]]
name = "clear-database"
path = "../examples/clear-database.rs"

[[example]]
name = "cursor-append"
path = "../examples/cursor-append.rs"

[[example]]
name = "custom-comparator"
path = "../examples/custom-comparator.rs"

[[example]]
name = "multi-env"
path = "../examples/multi-env.rs"

[[example]]
name = "nested"
path = "../examples/nested.rs"

[[example]]
name = "rmp-serde"
path = "../examples/rmp-serde.rs"
required-features = ["serde-rmp"]
name = "heed3-encrypted"
path = "../examples/heed3-encrypted.rs"
32 changes: 16 additions & 16 deletions heed/src/cookbook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
//! use std::fs;
//! use std::path::Path;
//!
//! use heed::types::*;
//! use heed::{Database, EnvOpenOptions};
//! use heed3::types::*;
//! use heed3::{Database, EnvOpenOptions};
//!
//! pub type StringMap = HashMap<String, String>;
//!
Expand Down Expand Up @@ -55,9 +55,9 @@
//! }
//!
//! fn fill_with_data(
//! wtxn: &mut heed::RwTxn,
//! wtxn: &mut heed3::RwTxn,
//! db: Database<Str, SerdeJson<StringMap>>,
//! ) -> heed::Result<()> {
//! ) -> heed3::Result<()> {
//! // This represents a very big value that we only want to decode when necessary.
//! let mut big_string_map = HashMap::new();
//! big_string_map.insert("key1".into(), "I am a very long string".into());
Expand Down Expand Up @@ -86,8 +86,8 @@
//! use std::fs;
//! use std::path::Path;
//!
//! use heed::types::*;
//! use heed::{Database, EnvOpenOptions};
//! use heed3::types::*;
//! use heed3::{Database, EnvOpenOptions};
//!
//! fn main() -> Result<(), Box<dyn Error>> {
//! let env_path = tempfile::tempdir()?;
Expand Down Expand Up @@ -147,8 +147,8 @@
//! use std::fs;
//! use std::path::Path;
//!
//! use heed::types::*;
//! use heed::{BoxedError, BytesDecode, BytesEncode, Database, EnvOpenOptions};
//! use heed3::types::*;
//! use heed3::{BoxedError, BytesDecode, BytesEncode, Database, EnvOpenOptions};
//!
//! #[derive(Debug, PartialEq, Eq)]
//! pub enum Level {
Expand Down Expand Up @@ -288,8 +288,8 @@
//! use std::fs;
//! use std::path::Path;
//!
//! use heed::types::*;
//! use heed::{Database, EnvOpenOptions};
//! use heed3::types::*;
//! use heed3::{Database, EnvOpenOptions};
//!
//! fn main() -> Result<(), Box<dyn Error>> {
//! let path = tempfile::tempdir()?;
Expand All @@ -306,7 +306,7 @@
//! // Ho! Crap! We don't have enough space in this environment...
//! assert!(matches!(
//! fill_with_data(&mut wtxn, db),
//! Err(heed::Error::Mdb(heed::MdbError::MapFull))
//! Err(heed3::Error::Mdb(heed3::MdbError::MapFull))
//! ));
//!
//! drop(wtxn);
Expand All @@ -330,7 +330,7 @@
//! Ok(())
//! }
//!
//! fn fill_with_data(wtxn: &mut heed::RwTxn, db: Database<Str, Str>) -> heed::Result<()> {
//! fn fill_with_data(wtxn: &mut heed3::RwTxn, db: Database<Str, Str>) -> heed3::Result<()> {
//! for i in 0..1000 {
//! let key = i.to_string();
//! db.put(wtxn, &key, "I am a very long string")?;
Expand Down Expand Up @@ -370,8 +370,8 @@
//! use std::fs;
//! use std::path::Path;
//!
//! use heed::types::*;
//! use heed::{Database, EnvOpenOptions, RoTxn};
//! use heed3::types::*;
//! use heed3::{Database, EnvOpenOptions, RoTxn};
//!
//! fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
//! let path = tempfile::tempdir()?;
Expand Down Expand Up @@ -410,7 +410,7 @@
//! Ok(())
//! }
//!
//! fn fill_with_data(wtxn: &mut heed::RwTxn, db: Database<Str, Str>) -> heed::Result<()> {
//! fn fill_with_data(wtxn: &mut heed3::RwTxn, db: Database<Str, Str>) -> heed3::Result<()> {
//! for i in 0..100 {
//! let key = i.to_string();
//! db.put(wtxn, &key, "I am a very long string")?;
Expand All @@ -423,7 +423,7 @@
//! }
//!
//! impl<'t> ImmutableMap<'t> {
//! fn from_db(rtxn: &'t RoTxn, db: Database<Str, Str>) -> heed::Result<Self> {
//! fn from_db(rtxn: &'t RoTxn, db: Database<Str, Str>) -> heed3::Result<Self> {
//! let mut map = HashMap::new();
//! for result in db.iter(rtxn)? {
//! let (k, v) = result?;
Expand Down
Loading

0 comments on commit e30489a

Please sign in to comment.