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

View file

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

View file

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

View file

@ -292,7 +292,7 @@ pub fn run(opt: Opt) -> anyhow::Result<()> {
.len() as usize;
// 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;
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;
// 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 template = UpdatesTemplate {

View file

@ -2,12 +2,12 @@ use roaring::RoaringBitmap;
use crate::Index;
pub struct ClearDocuments<'t, 'u, 'i> {
wtxn: &'t mut heed::RwTxn<'u>,
wtxn: &'t mut heed::RwTxn<'i, 'u>,
index: &'i Index,
}
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 }
}

View file

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

View file

@ -181,7 +181,7 @@ pub enum IndexDocumentsMethod {
}
pub struct IndexDocuments<'t, 'u, 'i> {
wtxn: &'t mut heed::RwTxn<'u>,
wtxn: &'t mut heed::RwTxn<'i, 'u>,
index: &'i Index,
log_every_n: 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> {
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 {
wtxn,
index,

View file

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

View file

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