mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
Move to heed 0.1.0
This commit is contained in:
parent
6c9a238973
commit
78535b3e33
23 changed files with 132 additions and 176 deletions
|
@ -1,9 +1,9 @@
|
|||
use crate::store;
|
||||
use crate::update::{next_update_id, Update};
|
||||
use zlmdb::Result as ZResult;
|
||||
use heed::Result as ZResult;
|
||||
|
||||
pub fn apply_customs_update(
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
main_store: store::Main,
|
||||
customs: &[u8],
|
||||
) -> ZResult<()> {
|
||||
|
@ -11,7 +11,7 @@ pub fn apply_customs_update(
|
|||
}
|
||||
|
||||
pub fn push_customs_update(
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
updates_store: store::Updates,
|
||||
updates_results_store: store::UpdatesResults,
|
||||
customs: Vec<u8>,
|
||||
|
|
|
@ -35,7 +35,7 @@ impl<D> DocumentsAddition<D> {
|
|||
self.documents.push(document);
|
||||
}
|
||||
|
||||
pub fn finalize(self, writer: &mut zlmdb::RwTxn) -> MResult<u64>
|
||||
pub fn finalize(self, writer: &mut heed::RwTxn) -> MResult<u64>
|
||||
where
|
||||
D: serde::Serialize,
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ impl<D> Extend<D> for DocumentsAddition<D> {
|
|||
}
|
||||
|
||||
pub fn push_documents_addition<D: serde::Serialize>(
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
updates_store: store::Updates,
|
||||
updates_results_store: store::UpdatesResults,
|
||||
addition: Vec<D>,
|
||||
|
@ -78,7 +78,7 @@ pub fn push_documents_addition<D: serde::Serialize>(
|
|||
}
|
||||
|
||||
pub fn apply_documents_addition(
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
main_store: store::Main,
|
||||
documents_fields_store: store::DocumentsFields,
|
||||
documents_fields_counts_store: store::DocumentsFieldsCounts,
|
||||
|
|
|
@ -49,7 +49,7 @@ impl DocumentsDeletion {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn finalize(self, writer: &mut zlmdb::RwTxn) -> MResult<u64> {
|
||||
pub fn finalize(self, writer: &mut heed::RwTxn) -> MResult<u64> {
|
||||
let _ = self.updates_notifier.send(());
|
||||
let update_id = push_documents_deletion(
|
||||
writer,
|
||||
|
@ -68,7 +68,7 @@ impl Extend<DocumentId> for DocumentsDeletion {
|
|||
}
|
||||
|
||||
pub fn push_documents_deletion(
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
updates_store: store::Updates,
|
||||
updates_results_store: store::UpdatesResults,
|
||||
deletion: Vec<DocumentId>,
|
||||
|
@ -82,7 +82,7 @@ pub fn push_documents_deletion(
|
|||
}
|
||||
|
||||
pub fn apply_documents_deletion(
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
main_store: store::Main,
|
||||
documents_fields_store: store::DocumentsFields,
|
||||
documents_fields_counts_store: store::DocumentsFieldsCounts,
|
||||
|
|
|
@ -16,9 +16,9 @@ use std::cmp;
|
|||
use std::collections::BTreeMap;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use heed::Result as ZResult;
|
||||
use log::debug;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use zlmdb::Result as ZResult;
|
||||
|
||||
use crate::{store, DocumentId, MResult, RankedMap};
|
||||
use meilidb_schema::Schema;
|
||||
|
@ -64,7 +64,7 @@ pub enum UpdateStatus {
|
|||
}
|
||||
|
||||
pub fn update_status(
|
||||
reader: &zlmdb::RoTxn,
|
||||
reader: &heed::RoTxn,
|
||||
updates_store: store::Updates,
|
||||
updates_results_store: store::UpdatesResults,
|
||||
update_id: u64,
|
||||
|
@ -82,7 +82,7 @@ pub fn update_status(
|
|||
}
|
||||
|
||||
pub fn next_update_id(
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
updates_store: store::Updates,
|
||||
updates_results_store: store::UpdatesResults,
|
||||
) -> ZResult<u64> {
|
||||
|
@ -98,10 +98,7 @@ pub fn next_update_id(
|
|||
Ok(new_update_id)
|
||||
}
|
||||
|
||||
pub fn update_task(
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
index: store::Index,
|
||||
) -> MResult<Option<UpdateResult>> {
|
||||
pub fn update_task(writer: &mut heed::RwTxn, index: store::Index) -> MResult<Option<UpdateResult>> {
|
||||
let (update_id, update) = match index.updates.pop_front(writer)? {
|
||||
Some(value) => value,
|
||||
None => return Ok(None),
|
||||
|
|
|
@ -3,7 +3,7 @@ use crate::{error::UnsupportedOperation, store, MResult};
|
|||
use meilidb_schema::Schema;
|
||||
|
||||
pub fn apply_schema_update(
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
main_store: store::Main,
|
||||
new_schema: &Schema,
|
||||
) -> MResult<()> {
|
||||
|
@ -17,7 +17,7 @@ pub fn apply_schema_update(
|
|||
}
|
||||
|
||||
pub fn push_schema_update(
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
updates_store: store::Updates,
|
||||
updates_results_store: store::UpdatesResults,
|
||||
schema: Schema,
|
||||
|
|
|
@ -42,7 +42,7 @@ impl SynonymsAddition {
|
|||
.extend(alternatives);
|
||||
}
|
||||
|
||||
pub fn finalize(self, writer: &mut zlmdb::RwTxn) -> MResult<u64> {
|
||||
pub fn finalize(self, writer: &mut heed::RwTxn) -> MResult<u64> {
|
||||
let _ = self.updates_notifier.send(());
|
||||
let update_id = push_synonyms_addition(
|
||||
writer,
|
||||
|
@ -55,7 +55,7 @@ impl SynonymsAddition {
|
|||
}
|
||||
|
||||
pub fn push_synonyms_addition(
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
updates_store: store::Updates,
|
||||
updates_results_store: store::UpdatesResults,
|
||||
addition: BTreeMap<String, Vec<String>>,
|
||||
|
@ -69,7 +69,7 @@ pub fn push_synonyms_addition(
|
|||
}
|
||||
|
||||
pub fn apply_synonyms_addition(
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
main_store: store::Main,
|
||||
synonyms_store: store::Synonyms,
|
||||
addition: BTreeMap<String, Vec<String>>,
|
||||
|
|
|
@ -49,7 +49,7 @@ impl SynonymsDeletion {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn finalize(self, writer: &mut zlmdb::RwTxn) -> MResult<u64> {
|
||||
pub fn finalize(self, writer: &mut heed::RwTxn) -> MResult<u64> {
|
||||
let _ = self.updates_notifier.send(());
|
||||
let update_id = push_synonyms_deletion(
|
||||
writer,
|
||||
|
@ -62,7 +62,7 @@ impl SynonymsDeletion {
|
|||
}
|
||||
|
||||
pub fn push_synonyms_deletion(
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
updates_store: store::Updates,
|
||||
updates_results_store: store::UpdatesResults,
|
||||
deletion: BTreeMap<String, Option<Vec<String>>>,
|
||||
|
@ -76,7 +76,7 @@ pub fn push_synonyms_deletion(
|
|||
}
|
||||
|
||||
pub fn apply_synonyms_deletion(
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
main_store: store::Main,
|
||||
synonyms_store: store::Synonyms,
|
||||
deletion: BTreeMap<String, Option<Vec<String>>>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue