Update heed to 0.10.0

This commit is contained in:
Clément Renault 2020-10-30 11:42:00 +01:00
parent a30206a665
commit 085d3b9d94
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4
10 changed files with 47 additions and 18 deletions

35
Cargo.lock generated
View File

@ -344,6 +344,15 @@ dependencies = [
"scopeguard", "scopeguard",
] ]
[[package]]
name = "crossbeam-queue"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b"
dependencies = [
"crossbeam-utils 0.6.6",
]
[[package]] [[package]]
name = "crossbeam-queue" name = "crossbeam-queue"
version = "0.2.2" version = "0.2.2"
@ -354,6 +363,16 @@ dependencies = [
"crossbeam-utils 0.7.2", "crossbeam-utils 0.7.2",
] ]
[[package]]
name = "crossbeam-utils"
version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6"
dependencies = [
"cfg-if 0.1.10",
"lazy_static",
]
[[package]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.7.2" version = "0.7.2"
@ -689,9 +708,9 @@ dependencies = [
[[package]] [[package]]
name = "heed" name = "heed"
version = "0.9.0" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cbfcd936aa75c7cb1a8485dd2506ea0ae204e2131bf614d8aa4e5f4177455b1" checksum = "68e5fb45cfad5bc754aeeac84a1e963aed4b34e577e388524e0d8ed6b50fbab0"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"heed-traits", "heed-traits",
@ -700,6 +719,7 @@ dependencies = [
"lmdb-rkv-sys", "lmdb-rkv-sys",
"once_cell", "once_cell",
"page_size", "page_size",
"synchronoise",
"url", "url",
"zerocopy", "zerocopy",
] ]
@ -1604,7 +1624,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e92e15d89083484e11353891f1af602cc661426deb9564c298b270c726973280" checksum = "e92e15d89083484e11353891f1af602cc661426deb9564c298b270c726973280"
dependencies = [ dependencies = [
"crossbeam-deque", "crossbeam-deque",
"crossbeam-queue", "crossbeam-queue 0.2.2",
"crossbeam-utils 0.7.2", "crossbeam-utils 0.7.2",
"lazy_static", "lazy_static",
"num_cpus", "num_cpus",
@ -1925,6 +1945,15 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "synchronoise"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d717ed0efc9d39ab3b642a096bc369a3e02a38a51c41845d7fe31bdad1d6eaeb"
dependencies = [
"crossbeam-queue 0.1.2",
]
[[package]] [[package]]
name = "synstructure" name = "synstructure"
version = "0.12.4" version = "0.12.4"

View File

@ -14,7 +14,7 @@ flate2 = "1.0.17"
fst = "0.4.4" fst = "0.4.4"
fxhash = "0.2.1" fxhash = "0.2.1"
grenad = { git = "https://github.com/Kerollmops/grenad.git", rev = "ce3517f" } grenad = { git = "https://github.com/Kerollmops/grenad.git", rev = "ce3517f" }
heed = { version = "0.9.0", default-features = false, features = ["lmdb"] } heed = { version = "0.10.0", default-features = false, features = ["lmdb"] }
human_format = "1.0.3" human_format = "1.0.3"
indexmap = { version = "1.6.0", features = ["serde-1"] } indexmap = { version = "1.6.0", features = ["serde-1"] }
jemallocator = "0.3.2" jemallocator = "0.3.2"

View File

@ -8,7 +8,7 @@ use crate::Index;
/// A mana depth first search implementation. /// A mana depth first search implementation.
pub struct Mdfs<'a> { pub struct Mdfs<'a> {
index: &'a Index, index: &'a Index,
rtxn: &'a heed::RoTxn, rtxn: &'a heed::RoTxn<'a>,
words: &'a [(HashMap<String, (u8, RoaringBitmap)>, RoaringBitmap)], words: &'a [(HashMap<String, (u8, RoaringBitmap)>, RoaringBitmap)],
union_cache: HashMap<(usize, u8), RoaringBitmap>, union_cache: HashMap<(usize, u8), RoaringBitmap>,
candidates: RoaringBitmap, candidates: RoaringBitmap,

View File

@ -21,7 +21,7 @@ pub struct Search<'a> {
query: Option<String>, query: Option<String>,
offset: usize, offset: usize,
limit: usize, limit: usize,
rtxn: &'a heed::RoTxn, rtxn: &'a heed::RoTxn<'a>,
index: &'a Index, index: &'a Index,
} }

View File

@ -292,7 +292,7 @@ pub fn run(opt: Opt) -> anyhow::Result<()> {
.len() as usize; .len() as usize;
// And the number of documents in the database. // And the number of documents in the database.
let rtxn = index_cloned.clone().read_txn().unwrap(); let rtxn = index_cloned.read_txn().unwrap();
let docs_count = index_cloned.clone().number_of_documents(&rtxn).unwrap() as usize; let docs_count = index_cloned.clone().number_of_documents(&rtxn).unwrap() as usize;
IndexTemplate { db_name: db_name_cloned.clone(), db_size, docs_count } IndexTemplate { db_name: db_name_cloned.clone(), db_size, docs_count }
@ -330,7 +330,7 @@ pub fn run(opt: Opt) -> anyhow::Result<()> {
.len() as usize; .len() as usize;
// And the number of documents in the database. // And the number of documents in the database.
let rtxn = index_cloned.clone().read_txn().unwrap(); let rtxn = index_cloned.read_txn().unwrap();
let docs_count = index_cloned.clone().number_of_documents(&rtxn).unwrap() as usize; let docs_count = index_cloned.clone().number_of_documents(&rtxn).unwrap() as usize;
let template = UpdatesTemplate { let template = UpdatesTemplate {

View File

@ -2,12 +2,12 @@ use roaring::RoaringBitmap;
use crate::Index; use crate::Index;
pub struct ClearDocuments<'t, 'u, 'i> { pub struct ClearDocuments<'t, 'u, 'i> {
wtxn: &'t mut heed::RwTxn<'u>, wtxn: &'t mut heed::RwTxn<'i, 'u>,
index: &'i Index, index: &'i Index,
} }
impl<'t, 'u, 'i> ClearDocuments<'t, 'u, 'i> { impl<'t, 'u, 'i> ClearDocuments<'t, 'u, 'i> {
pub fn new(wtxn: &'t mut heed::RwTxn<'u>, index: &'i Index) -> ClearDocuments<'t, 'u, 'i> { pub fn new(wtxn: &'t mut heed::RwTxn<'i, 'u>, index: &'i Index) -> ClearDocuments<'t, 'u, 'i> {
ClearDocuments { wtxn, index } ClearDocuments { wtxn, index }
} }

View File

@ -8,7 +8,7 @@ use crate::{Index, BEU32, SmallString32};
use super::ClearDocuments; use super::ClearDocuments;
pub struct DeleteDocuments<'t, 'u, 'i> { pub struct DeleteDocuments<'t, 'u, 'i> {
wtxn: &'t mut heed::RwTxn<'u>, wtxn: &'t mut heed::RwTxn<'i, 'u>,
index: &'i Index, index: &'i Index,
users_ids_documents_ids: fst::Map<Vec<u8>>, users_ids_documents_ids: fst::Map<Vec<u8>>,
documents_ids: RoaringBitmap, documents_ids: RoaringBitmap,
@ -16,7 +16,7 @@ pub struct DeleteDocuments<'t, 'u, 'i> {
impl<'t, 'u, 'i> DeleteDocuments<'t, 'u, 'i> { impl<'t, 'u, 'i> DeleteDocuments<'t, 'u, 'i> {
pub fn new( pub fn new(
wtxn: &'t mut heed::RwTxn<'u>, wtxn: &'t mut heed::RwTxn<'i, 'u>,
index: &'i Index, index: &'i Index,
) -> anyhow::Result<DeleteDocuments<'t, 'u, 'i>> ) -> anyhow::Result<DeleteDocuments<'t, 'u, 'i>>
{ {

View File

@ -181,7 +181,7 @@ pub enum IndexDocumentsMethod {
} }
pub struct IndexDocuments<'t, 'u, 'i> { pub struct IndexDocuments<'t, 'u, 'i> {
wtxn: &'t mut heed::RwTxn<'u>, wtxn: &'t mut heed::RwTxn<'i, 'u>,
index: &'i Index, index: &'i Index,
log_every_n: Option<usize>, log_every_n: Option<usize>,
max_nb_chunks: Option<usize>, max_nb_chunks: Option<usize>,
@ -195,7 +195,7 @@ pub struct IndexDocuments<'t, 'u, 'i> {
} }
impl<'t, 'u, 'i> IndexDocuments<'t, 'u, 'i> { impl<'t, 'u, 'i> IndexDocuments<'t, 'u, 'i> {
pub fn new(wtxn: &'t mut heed::RwTxn<'u>, index: &'i Index) -> IndexDocuments<'t, 'u, 'i> { pub fn new(wtxn: &'t mut heed::RwTxn<'i, 'u>, index: &'i Index) -> IndexDocuments<'t, 'u, 'i> {
IndexDocuments { IndexDocuments {
wtxn, wtxn,
index, index,

View File

@ -23,7 +23,7 @@ pub struct TransformOutput {
} }
pub struct Transform<'t, 'i> { pub struct Transform<'t, 'i> {
pub rtxn: &'t heed::RoTxn, pub rtxn: &'t heed::RoTxn<'t>,
pub index: &'i Index, pub index: &'i Index,
pub chunk_compression_type: CompressionType, pub chunk_compression_type: CompressionType,
pub chunk_compression_level: Option<u32>, pub chunk_compression_level: Option<u32>,

View File

@ -72,7 +72,7 @@ impl UpdateBuilder {
pub fn clear_documents<'t, 'u, 'i>( pub fn clear_documents<'t, 'u, 'i>(
self, self,
wtxn: &'t mut heed::RwTxn<'u>, wtxn: &'t mut heed::RwTxn<'i, 'u>,
index: &'i Index, index: &'i Index,
) -> ClearDocuments<'t, 'u, 'i> ) -> ClearDocuments<'t, 'u, 'i>
{ {
@ -81,7 +81,7 @@ impl UpdateBuilder {
pub fn delete_documents<'t, 'u, 'i>( pub fn delete_documents<'t, 'u, 'i>(
self, self,
wtxn: &'t mut heed::RwTxn<'u>, wtxn: &'t mut heed::RwTxn<'i, 'u>,
index: &'i Index, index: &'i Index,
) -> anyhow::Result<DeleteDocuments<'t, 'u, 'i>> ) -> anyhow::Result<DeleteDocuments<'t, 'u, 'i>>
{ {
@ -90,7 +90,7 @@ impl UpdateBuilder {
pub fn index_documents<'t, 'u, 'i>( pub fn index_documents<'t, 'u, 'i>(
self, self,
wtxn: &'t mut heed::RwTxn<'u>, wtxn: &'t mut heed::RwTxn<'i, 'u>,
index: &'i Index, index: &'i Index,
) -> IndexDocuments<'t, 'u, 'i> ) -> IndexDocuments<'t, 'u, 'i>
{ {