Skip to content

Commit

Permalink
Merge pull request #73 from meilisearch/update-heed
Browse files Browse the repository at this point in the history
Update heed
  • Loading branch information
Kerollmops authored May 16, 2024
2 parents 19e0a07 + ef2290b commit 7d65b82
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 19 deletions.
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "arroy"
description = "Annoy-inspired Approximate Nearest Neighbors in Rust, based on LMDB and optimized for memory usage"
version = "0.3.0"
version = "0.3.1"
documentation = "https://docs.rs/arroy"
repository = "https://github.com/meilisearch/arroy"
keywords = ["ANN-search", "Graph-algorithms", "Vector-Search", "Store"]
Expand All @@ -13,7 +13,7 @@ edition = "2021"
[dependencies]
bytemuck = { version = "1.14.0", features = ["derive", "extern_crate_alloc"] }
byteorder = "1.5.0"
heed = { version = "0.20.0-alpha.9", default-features = false }
heed = { version = "0.20.1", default-features = false }
log = "0.4.20"
memmap2 = "0.9.0"
ordered-float = "4.1.1"
Expand All @@ -28,7 +28,6 @@ anyhow = "1.0.75"
arbitrary = { version = "1.3.2", features = ["derive"] }
clap = { version = "4.4.10", features = ["derive"] }
env_logger = "0.10.1"
heed = { version = "0.20.0-alpha.9", default-features = false }
insta = "1.34.0"
instant-distance = "0.6.1"
rand = { version = "0.8.5", features = ["std_rng"] }
Expand Down
2 changes: 1 addition & 1 deletion examples/build-tree-no-commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fn main() -> Result<(), heed::BoxedError> {
let mut env_builder = EnvOpenOptions::new();
env_builder.map_size(map_size);
unsafe { env_builder.flags(flags) };
let env = env_builder.open(&database).unwrap();
let env = unsafe { env_builder.open(&database) }.unwrap();

let mut wtxn = env.write_txn().unwrap();
let database: Database<DotProduct> = env.create_database(&mut wtxn, None)?;
Expand Down
2 changes: 1 addition & 1 deletion examples/compare_with_hnsw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const NUMBER_FETCHED: usize = 5;

fn main() -> Result<()> {
let dir = tempfile::tempdir().unwrap();
let env = EnvOpenOptions::new().map_size(TWENTY_HUNDRED_MIB).open(dir.path())?;
let env = unsafe { EnvOpenOptions::new().map_size(TWENTY_HUNDRED_MIB).open(dir.path()) }?;

let rng_points = StdRng::seed_from_u64(42);
let mut rng_arroy = rng_points.clone();
Expand Down
2 changes: 1 addition & 1 deletion examples/fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fn main() -> Result<()> {
.map(|s| Duration::from_secs(s.parse().expect("Expected a whole number of seconds")));

let dir = tempfile::tempdir().unwrap();
let env = EnvOpenOptions::new().map_size(TWENTY_GIB).open(dir.path())?;
let env = unsafe { EnvOpenOptions::new().map_size(TWENTY_GIB).open(dir.path()) }?;
let mut wtxn = env.write_txn()?;
let database: Database<Euclidean> = env.create_database(&mut wtxn, None)?;
wtxn.commit()?;
Expand Down
10 changes: 6 additions & 4 deletions examples/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ fn main() {
let output = File::create(&output_path).unwrap();
let writer = BufWriter::new(output);

let env = EnvOpenOptions::new()
.map_size(1024 * 1024 * 1024 * 2) // 2GiB
.open(database)
.unwrap();
let env = unsafe {
EnvOpenOptions::new()
.map_size(1024 * 1024 * 1024 * 2) // 2GiB
.open(database)
}
.unwrap();

let rtxn = env.read_txn().unwrap();
let database: Database<DotProduct> =
Expand Down
2 changes: 1 addition & 1 deletion examples/import-vectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ fn main() -> Result<(), heed::BoxedError> {
let mut env_builder = EnvOpenOptions::new();
env_builder.map_size(map_size);
unsafe { env_builder.flags(flags) };
let env = env_builder.open(&database).unwrap();
let env = unsafe { env_builder.open(&database) }.unwrap();

let mut wtxn = env.write_txn().unwrap();
let database: Database<DotProduct> = env.create_database(&mut wtxn, None)?;
Expand Down
10 changes: 6 additions & 4 deletions examples/search_movies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ fn main() {
let mut args = std::env::args();
let dir_path = args.nth(1).expect("Provide the path to a database");

let env = EnvOpenOptions::new()
.map_size(1024 * 1024 * 1024 * 2) // 2GiB
.open(dir_path)
.unwrap();
let env = unsafe {
EnvOpenOptions::new()
.map_size(1024 * 1024 * 1024 * 2) // 2GiB
.open(dir_path)
}
.unwrap();

let rtxn = env.read_txn().unwrap();
let database: Database<DotProduct> =
Expand Down
2 changes: 1 addition & 1 deletion examples/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn main() -> anyhow::Result<()> {
let Cli { database } = Cli::parse();

let _ = fs::create_dir_all(&database);
let env = EnvOpenOptions::new().open(&database)?;
let env = unsafe { EnvOpenOptions::new().open(&database) }?;

let rtxn = env.read_txn()?;
let database: Database<DotProduct> = env.open_database(&rtxn, None)?.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let dir = tempfile::tempdir()?;
//! let env = heed::EnvOpenOptions::new().map_size(TWENTY_HUNDRED_MIB).open(dir.path())?;
//! let env = unsafe { heed::EnvOpenOptions::new().map_size(TWENTY_HUNDRED_MIB).open(dir.path()) }?;
//!
//! // we will open the default LMDB unnamed database
//! let mut wtxn = env.write_txn()?;
Expand Down
3 changes: 2 additions & 1 deletion src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ fn create_database<D: Distance>() -> DatabaseHandle<D> {
let _ = rayon::ThreadPoolBuilder::new().num_threads(1).build_global();

let dir = tempfile::tempdir().unwrap();
let env = EnvOpenOptions::new().map_size(200 * 1024 * 1024).open(dir.path()).unwrap();
let env =
unsafe { EnvOpenOptions::new().map_size(200 * 1024 * 1024).open(dir.path()) }.unwrap();
let mut wtxn = env.write_txn().unwrap();
let database: Database<D> = env.create_database(&mut wtxn, None).unwrap();
wtxn.commit().unwrap();
Expand Down
3 changes: 2 additions & 1 deletion src/tests/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ fn clear_small_database() {
let _ = rayon::ThreadPoolBuilder::new().num_threads(1).build_global();

let dir = tempfile::tempdir().unwrap();
let env = EnvOpenOptions::new().map_size(200 * 1024 * 1024).open(dir.path()).unwrap();
let env =
unsafe { EnvOpenOptions::new().map_size(200 * 1024 * 1024).open(dir.path()) }.unwrap();

let mut wtxn = env.write_txn().unwrap();
let database: Database<DotProduct> = env.create_database(&mut wtxn, None).unwrap();
Expand Down

0 comments on commit 7d65b82

Please sign in to comment.