diff --git a/Cargo.toml b/Cargo.toml index 28b946b8..dfe8336d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"] @@ -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" @@ -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"] } diff --git a/examples/build-tree-no-commit.rs b/examples/build-tree-no-commit.rs index 15892acd..740f8c8c 100644 --- a/examples/build-tree-no-commit.rs +++ b/examples/build-tree-no-commit.rs @@ -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 = env.create_database(&mut wtxn, None)?; diff --git a/examples/compare_with_hnsw.rs b/examples/compare_with_hnsw.rs index 38fc1a7a..841d9f39 100644 --- a/examples/compare_with_hnsw.rs +++ b/examples/compare_with_hnsw.rs @@ -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(); diff --git a/examples/fuzz.rs b/examples/fuzz.rs index ef5dfd01..4256a79f 100644 --- a/examples/fuzz.rs +++ b/examples/fuzz.rs @@ -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 = env.create_database(&mut wtxn, None)?; wtxn.commit()?; diff --git a/examples/graph.rs b/examples/graph.rs index 978f19cc..535dd94f 100644 --- a/examples/graph.rs +++ b/examples/graph.rs @@ -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 = diff --git a/examples/import-vectors.rs b/examples/import-vectors.rs index f121aff6..a5b861d5 100644 --- a/examples/import-vectors.rs +++ b/examples/import-vectors.rs @@ -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 = env.create_database(&mut wtxn, None)?; diff --git a/examples/search_movies.rs b/examples/search_movies.rs index cb1553a5..6b43ec9d 100644 --- a/examples/search_movies.rs +++ b/examples/search_movies.rs @@ -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 = diff --git a/examples/stats.rs b/examples/stats.rs index 04e8ec1e..fdca6334 100644 --- a/examples/stats.rs +++ b/examples/stats.rs @@ -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 = env.open_database(&rtxn, None)?.unwrap(); diff --git a/src/lib.rs b/src/lib.rs index 7f9e1704..46a61e12 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -20,7 +20,7 @@ //! //! # fn main() -> Result<(), Box> { //! 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()?; diff --git a/src/tests/mod.rs b/src/tests/mod.rs index 9fd10306..4655ddcb 100644 --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -90,7 +90,8 @@ fn create_database() -> DatabaseHandle { 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 = env.create_database(&mut wtxn, None).unwrap(); wtxn.commit().unwrap(); diff --git a/src/tests/writer.rs b/src/tests/writer.rs index b7f051c2..9d039dce 100644 --- a/src/tests/writer.rs +++ b/src/tests/writer.rs @@ -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 = env.create_database(&mut wtxn, None).unwrap();