mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 14:54:27 +01:00
Merge pull request #230 from meilisearch/moving-to-heed
Move to heed 0.1.0
This commit is contained in:
commit
32d8b4b83f
@ -12,6 +12,7 @@ crossbeam-channel = "0.3.9"
|
||||
deunicode = "1.0.0"
|
||||
env_logger = "0.7.0"
|
||||
hashbrown = { version = "0.6.0", features = ["serde"] }
|
||||
heed = "0.1.0"
|
||||
log = "0.4.8"
|
||||
meilidb-schema = { path = "../meilidb-schema", version = "0.1.0" }
|
||||
meilidb-tokenizer = { path = "../meilidb-tokenizer", version = "0.1.0" }
|
||||
@ -24,11 +25,6 @@ siphasher = "0.3.0"
|
||||
slice-group-by = "0.2.6"
|
||||
zerocopy = "0.2.8"
|
||||
|
||||
[dependencies.zlmdb]
|
||||
package = "zerocopy-lmdb"
|
||||
git = "https://github.com/Kerollmops/zerocopy-lmdb.git"
|
||||
branch = "master"
|
||||
|
||||
[dependencies.levenshtein_automata]
|
||||
git = "https://github.com/Kerollmops/levenshtein-automata.git"
|
||||
branch = "arc-byte-slice"
|
||||
|
@ -23,7 +23,7 @@ pub struct AutomatonProducer {
|
||||
|
||||
impl AutomatonProducer {
|
||||
pub fn new(
|
||||
reader: &zlmdb::RoTxn,
|
||||
reader: &heed::RoTxn,
|
||||
query: &str,
|
||||
main_store: store::Main,
|
||||
synonyms_store: store::Synonyms,
|
||||
@ -103,7 +103,7 @@ pub fn normalize_str(string: &str) -> String {
|
||||
}
|
||||
|
||||
fn generate_automatons(
|
||||
reader: &zlmdb::RoTxn,
|
||||
reader: &heed::RoTxn,
|
||||
query: &str,
|
||||
main_store: store::Main,
|
||||
synonym_store: store::Synonyms,
|
||||
|
@ -5,9 +5,9 @@ use std::sync::{Arc, RwLock};
|
||||
use std::{fs, thread};
|
||||
|
||||
use crossbeam_channel::Receiver;
|
||||
use heed::types::{Str, Unit};
|
||||
use heed::{CompactionOption, Result as ZResult};
|
||||
use log::{debug, error};
|
||||
use zlmdb::types::{Str, Unit};
|
||||
use zlmdb::{CompactionOption, Result as ZResult};
|
||||
|
||||
use crate::{store, update, Index, MResult};
|
||||
|
||||
@ -15,18 +15,13 @@ pub type BoxUpdateFn = Box<dyn Fn(update::UpdateResult) + Send + Sync + 'static>
|
||||
type ArcSwapFn = arc_swap::ArcSwapOption<BoxUpdateFn>;
|
||||
|
||||
pub struct Database {
|
||||
pub env: zlmdb::Env,
|
||||
common_store: zlmdb::DynDatabase,
|
||||
indexes_store: zlmdb::Database<Str, Unit>,
|
||||
pub env: heed::Env,
|
||||
common_store: heed::PolyDatabase,
|
||||
indexes_store: heed::Database<Str, Unit>,
|
||||
indexes: RwLock<HashMap<String, (Index, Arc<ArcSwapFn>, thread::JoinHandle<()>)>>,
|
||||
}
|
||||
|
||||
fn update_awaiter(
|
||||
receiver: Receiver<()>,
|
||||
env: zlmdb::Env,
|
||||
update_fn: Arc<ArcSwapFn>,
|
||||
index: Index,
|
||||
) {
|
||||
fn update_awaiter(receiver: Receiver<()>, env: heed::Env, update_fn: Arc<ArcSwapFn>, index: Index) {
|
||||
for () in receiver {
|
||||
// consume all updates in order (oldest first)
|
||||
loop {
|
||||
@ -67,7 +62,7 @@ impl Database {
|
||||
pub fn open_or_create(path: impl AsRef<Path>) -> MResult<Database> {
|
||||
fs::create_dir_all(path.as_ref())?;
|
||||
|
||||
let env = zlmdb::EnvOpenOptions::new()
|
||||
let env = heed::EnvOpenOptions::new()
|
||||
.map_size(10 * 1024 * 1024 * 1024) // 10GB
|
||||
.max_dbs(3000)
|
||||
.open(path)?;
|
||||
@ -199,7 +194,7 @@ impl Database {
|
||||
Ok(indexes.keys().cloned().collect())
|
||||
}
|
||||
|
||||
pub fn common_store(&self) -> zlmdb::DynDatabase {
|
||||
pub fn common_store(&self) -> heed::PolyDatabase {
|
||||
self.common_store
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ pub enum Error {
|
||||
SchemaMissing,
|
||||
WordIndexMissing,
|
||||
MissingDocumentId,
|
||||
Zlmdb(zlmdb::Error),
|
||||
Zlmdb(heed::Error),
|
||||
Fst(fst::Error),
|
||||
SerdeJson(SerdeJsonError),
|
||||
Bincode(bincode::Error),
|
||||
@ -27,8 +27,8 @@ impl From<io::Error> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<zlmdb::Error> for Error {
|
||||
fn from(error: zlmdb::Error) -> Error {
|
||||
impl From<heed::Error> for Error {
|
||||
fn from(error: heed::Error) -> Error {
|
||||
Error::Zlmdb(error)
|
||||
}
|
||||
}
|
||||
@ -79,7 +79,7 @@ impl fmt::Display for Error {
|
||||
SchemaMissing => write!(f, "this index does not have a schema"),
|
||||
WordIndexMissing => write!(f, "this index does not have a word index"),
|
||||
MissingDocumentId => write!(f, "document id is missing"),
|
||||
Zlmdb(e) => write!(f, "zlmdb error; {}", e),
|
||||
Zlmdb(e) => write!(f, "heed error; {}", e),
|
||||
Fst(e) => write!(f, "fst error; {}", e),
|
||||
SerdeJson(e) => write!(f, "serde json error; {}", e),
|
||||
Bincode(e) => write!(f, "bincode error; {}", e),
|
||||
|
@ -137,7 +137,7 @@ fn multiword_rewrite_matches(
|
||||
}
|
||||
|
||||
fn fetch_raw_documents(
|
||||
reader: &zlmdb::RoTxn,
|
||||
reader: &heed::RoTxn,
|
||||
automatons: &[Automaton],
|
||||
query_enhancer: &QueryEnhancer,
|
||||
searchables: Option<&ReorderedAttrs>,
|
||||
@ -285,7 +285,7 @@ impl<'c, 'f, 'd> QueryBuilder<'c, 'f, 'd> {
|
||||
|
||||
pub fn query(
|
||||
self,
|
||||
reader: &zlmdb::RoTxn,
|
||||
reader: &heed::RoTxn,
|
||||
query: &str,
|
||||
range: Range<usize>,
|
||||
) -> MResult<Vec<Document>> {
|
||||
@ -323,7 +323,7 @@ impl<'c, 'f, 'd> QueryBuilder<'c, 'f, 'd> {
|
||||
}
|
||||
|
||||
fn raw_query<'c, FI>(
|
||||
reader: &zlmdb::RoTxn,
|
||||
reader: &heed::RoTxn,
|
||||
|
||||
query: &str,
|
||||
range: Range<usize>,
|
||||
@ -454,7 +454,7 @@ where
|
||||
}
|
||||
|
||||
fn raw_query_with_distinct<'c, FI, FD>(
|
||||
reader: &zlmdb::RoTxn,
|
||||
reader: &heed::RoTxn,
|
||||
|
||||
query: &str,
|
||||
range: Range<usize>,
|
||||
|
@ -14,7 +14,7 @@ use crate::DocumentId;
|
||||
#[derive(Debug)]
|
||||
pub enum DeserializerError {
|
||||
SerdeJson(SerdeJsonError),
|
||||
Zlmdb(zlmdb::Error),
|
||||
Zlmdb(heed::Error),
|
||||
Custom(String),
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ impl fmt::Display for DeserializerError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
DeserializerError::SerdeJson(e) => write!(f, "serde json related error: {}", e),
|
||||
DeserializerError::Zlmdb(e) => write!(f, "zlmdb related error: {}", e),
|
||||
DeserializerError::Zlmdb(e) => write!(f, "heed related error: {}", e),
|
||||
DeserializerError::Custom(s) => f.write_str(s),
|
||||
}
|
||||
}
|
||||
@ -42,15 +42,15 @@ impl From<SerdeJsonError> for DeserializerError {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<zlmdb::Error> for DeserializerError {
|
||||
fn from(error: zlmdb::Error) -> DeserializerError {
|
||||
impl From<heed::Error> for DeserializerError {
|
||||
fn from(error: heed::Error) -> DeserializerError {
|
||||
DeserializerError::Zlmdb(error)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Deserializer<'a> {
|
||||
pub document_id: DocumentId,
|
||||
pub reader: &'a zlmdb::RoTxn,
|
||||
pub reader: &'a heed::RoTxn,
|
||||
pub documents_fields: DocumentsFields,
|
||||
pub schema: &'a Schema,
|
||||
pub attributes: Option<&'a HashSet<SchemaAttr>>,
|
||||
|
@ -35,7 +35,7 @@ use crate::{DocumentId, ParseNumberError};
|
||||
pub enum SerializerError {
|
||||
DocumentIdNotFound,
|
||||
InvalidDocumentIdType,
|
||||
Zlmdb(zlmdb::Error),
|
||||
Zlmdb(heed::Error),
|
||||
SerdeJson(SerdeJsonError),
|
||||
ParseNumber(ParseNumberError),
|
||||
UnserializableType { type_name: &'static str },
|
||||
@ -59,7 +59,7 @@ impl fmt::Display for SerializerError {
|
||||
SerializerError::InvalidDocumentIdType => {
|
||||
f.write_str("document identifier can only be of type string or number")
|
||||
}
|
||||
SerializerError::Zlmdb(e) => write!(f, "zlmdb related error: {}", e),
|
||||
SerializerError::Zlmdb(e) => write!(f, "heed related error: {}", e),
|
||||
SerializerError::SerdeJson(e) => write!(f, "serde json error: {}", e),
|
||||
SerializerError::ParseNumber(e) => {
|
||||
write!(f, "error while trying to parse a number: {}", e)
|
||||
@ -92,8 +92,8 @@ impl From<SerdeJsonError> for SerializerError {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<zlmdb::Error> for SerializerError {
|
||||
fn from(error: zlmdb::Error) -> SerializerError {
|
||||
impl From<heed::Error> for SerializerError {
|
||||
fn from(error: heed::Error) -> SerializerError {
|
||||
SerializerError::Zlmdb(error)
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
use super::BEU64;
|
||||
use crate::DocumentId;
|
||||
use heed::types::{ByteSlice, OwnedType};
|
||||
use heed::Result as ZResult;
|
||||
use std::sync::Arc;
|
||||
use zlmdb::types::{ByteSlice, OwnedType};
|
||||
use zlmdb::Result as ZResult;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct DocsWords {
|
||||
pub(crate) docs_words: zlmdb::Database<OwnedType<BEU64>, ByteSlice>,
|
||||
pub(crate) docs_words: heed::Database<OwnedType<BEU64>, ByteSlice>,
|
||||
}
|
||||
|
||||
impl DocsWords {
|
||||
pub fn put_doc_words(
|
||||
self,
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
document_id: DocumentId,
|
||||
words: &fst::Set,
|
||||
) -> ZResult<()> {
|
||||
@ -21,18 +21,14 @@ impl DocsWords {
|
||||
self.docs_words.put(writer, &document_id, bytes)
|
||||
}
|
||||
|
||||
pub fn del_doc_words(
|
||||
self,
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
document_id: DocumentId,
|
||||
) -> ZResult<bool> {
|
||||
pub fn del_doc_words(self, writer: &mut heed::RwTxn, document_id: DocumentId) -> ZResult<bool> {
|
||||
let document_id = BEU64::new(document_id.0);
|
||||
self.docs_words.delete(writer, &document_id)
|
||||
}
|
||||
|
||||
pub fn doc_words(
|
||||
self,
|
||||
reader: &zlmdb::RoTxn,
|
||||
reader: &heed::RoTxn,
|
||||
document_id: DocumentId,
|
||||
) -> ZResult<Option<fst::Set>> {
|
||||
let document_id = BEU64::new(document_id.0);
|
||||
|
@ -1,19 +1,19 @@
|
||||
use heed::types::{ByteSlice, OwnedType};
|
||||
use heed::Result as ZResult;
|
||||
use meilidb_schema::SchemaAttr;
|
||||
use zlmdb::types::{ByteSlice, OwnedType};
|
||||
use zlmdb::Result as ZResult;
|
||||
|
||||
use super::DocumentAttrKey;
|
||||
use crate::DocumentId;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct DocumentsFields {
|
||||
pub(crate) documents_fields: zlmdb::Database<OwnedType<DocumentAttrKey>, ByteSlice>,
|
||||
pub(crate) documents_fields: heed::Database<OwnedType<DocumentAttrKey>, ByteSlice>,
|
||||
}
|
||||
|
||||
impl DocumentsFields {
|
||||
pub fn put_document_field(
|
||||
self,
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
document_id: DocumentId,
|
||||
attribute: SchemaAttr,
|
||||
value: &[u8],
|
||||
@ -24,7 +24,7 @@ impl DocumentsFields {
|
||||
|
||||
pub fn del_all_document_fields(
|
||||
self,
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
document_id: DocumentId,
|
||||
) -> ZResult<usize> {
|
||||
let start = DocumentAttrKey::new(document_id, SchemaAttr::min());
|
||||
@ -34,7 +34,7 @@ impl DocumentsFields {
|
||||
|
||||
pub fn document_attribute<'txn>(
|
||||
self,
|
||||
reader: &'txn zlmdb::RoTxn,
|
||||
reader: &'txn heed::RoTxn,
|
||||
document_id: DocumentId,
|
||||
attribute: SchemaAttr,
|
||||
) -> ZResult<Option<&'txn [u8]>> {
|
||||
@ -44,7 +44,7 @@ impl DocumentsFields {
|
||||
|
||||
pub fn document_fields<'txn>(
|
||||
self,
|
||||
reader: &'txn zlmdb::RoTxn,
|
||||
reader: &'txn heed::RoTxn,
|
||||
document_id: DocumentId,
|
||||
) -> ZResult<DocumentFieldsIter<'txn>> {
|
||||
let start = DocumentAttrKey::new(document_id, SchemaAttr::min());
|
||||
@ -55,7 +55,7 @@ impl DocumentsFields {
|
||||
}
|
||||
|
||||
pub struct DocumentFieldsIter<'txn> {
|
||||
iter: zlmdb::RoRange<'txn, OwnedType<DocumentAttrKey>, ByteSlice>,
|
||||
iter: heed::RoRange<'txn, OwnedType<DocumentAttrKey>, ByteSlice>,
|
||||
}
|
||||
|
||||
impl<'txn> Iterator for DocumentFieldsIter<'txn> {
|
||||
|
@ -1,18 +1,18 @@
|
||||
use super::DocumentAttrKey;
|
||||
use crate::DocumentId;
|
||||
use heed::types::OwnedType;
|
||||
use heed::Result as ZResult;
|
||||
use meilidb_schema::SchemaAttr;
|
||||
use zlmdb::types::OwnedType;
|
||||
use zlmdb::Result as ZResult;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct DocumentsFieldsCounts {
|
||||
pub(crate) documents_fields_counts: zlmdb::Database<OwnedType<DocumentAttrKey>, OwnedType<u64>>,
|
||||
pub(crate) documents_fields_counts: heed::Database<OwnedType<DocumentAttrKey>, OwnedType<u64>>,
|
||||
}
|
||||
|
||||
impl DocumentsFieldsCounts {
|
||||
pub fn put_document_field_count(
|
||||
self,
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
document_id: DocumentId,
|
||||
attribute: SchemaAttr,
|
||||
value: u64,
|
||||
@ -23,7 +23,7 @@ impl DocumentsFieldsCounts {
|
||||
|
||||
pub fn del_all_document_fields_counts(
|
||||
self,
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
document_id: DocumentId,
|
||||
) -> ZResult<usize> {
|
||||
let start = DocumentAttrKey::new(document_id, SchemaAttr::min());
|
||||
@ -34,7 +34,7 @@ impl DocumentsFieldsCounts {
|
||||
|
||||
pub fn document_field_count(
|
||||
self,
|
||||
reader: &zlmdb::RoTxn,
|
||||
reader: &heed::RoTxn,
|
||||
document_id: DocumentId,
|
||||
attribute: SchemaAttr,
|
||||
) -> ZResult<Option<u64>> {
|
||||
@ -47,7 +47,7 @@ impl DocumentsFieldsCounts {
|
||||
|
||||
pub fn document_fields_counts<'txn>(
|
||||
self,
|
||||
reader: &'txn zlmdb::RoTxn,
|
||||
reader: &'txn heed::RoTxn,
|
||||
document_id: DocumentId,
|
||||
) -> ZResult<DocumentFieldsCountsIter<'txn>> {
|
||||
let start = DocumentAttrKey::new(document_id, SchemaAttr::min());
|
||||
@ -56,10 +56,7 @@ impl DocumentsFieldsCounts {
|
||||
Ok(DocumentFieldsCountsIter { iter })
|
||||
}
|
||||
|
||||
pub fn documents_ids<'txn>(
|
||||
self,
|
||||
reader: &'txn zlmdb::RoTxn,
|
||||
) -> ZResult<DocumentsIdsIter<'txn>> {
|
||||
pub fn documents_ids<'txn>(self, reader: &'txn heed::RoTxn) -> ZResult<DocumentsIdsIter<'txn>> {
|
||||
let iter = self.documents_fields_counts.iter(reader)?;
|
||||
Ok(DocumentsIdsIter {
|
||||
last_seen_id: None,
|
||||
@ -69,7 +66,7 @@ impl DocumentsFieldsCounts {
|
||||
|
||||
pub fn all_documents_fields_counts<'txn>(
|
||||
self,
|
||||
reader: &'txn zlmdb::RoTxn,
|
||||
reader: &'txn heed::RoTxn,
|
||||
) -> ZResult<AllDocumentsFieldsCountsIter<'txn>> {
|
||||
let iter = self.documents_fields_counts.iter(reader)?;
|
||||
Ok(AllDocumentsFieldsCountsIter { iter })
|
||||
@ -77,7 +74,7 @@ impl DocumentsFieldsCounts {
|
||||
}
|
||||
|
||||
pub struct DocumentFieldsCountsIter<'txn> {
|
||||
iter: zlmdb::RoRange<'txn, OwnedType<DocumentAttrKey>, OwnedType<u64>>,
|
||||
iter: heed::RoRange<'txn, OwnedType<DocumentAttrKey>, OwnedType<u64>>,
|
||||
}
|
||||
|
||||
impl Iterator for DocumentFieldsCountsIter<'_> {
|
||||
@ -97,7 +94,7 @@ impl Iterator for DocumentFieldsCountsIter<'_> {
|
||||
|
||||
pub struct DocumentsIdsIter<'txn> {
|
||||
last_seen_id: Option<DocumentId>,
|
||||
iter: zlmdb::RoIter<'txn, OwnedType<DocumentAttrKey>, OwnedType<u64>>,
|
||||
iter: heed::RoIter<'txn, OwnedType<DocumentAttrKey>, OwnedType<u64>>,
|
||||
}
|
||||
|
||||
impl Iterator for DocumentsIdsIter<'_> {
|
||||
@ -121,7 +118,7 @@ impl Iterator for DocumentsIdsIter<'_> {
|
||||
}
|
||||
|
||||
pub struct AllDocumentsFieldsCountsIter<'txn> {
|
||||
iter: zlmdb::RoIter<'txn, OwnedType<DocumentAttrKey>, OwnedType<u64>>,
|
||||
iter: heed::RoIter<'txn, OwnedType<DocumentAttrKey>, OwnedType<u64>>,
|
||||
}
|
||||
|
||||
impl<'r> Iterator for AllDocumentsFieldsCountsIter<'r> {
|
||||
|
@ -1,8 +1,8 @@
|
||||
use crate::RankedMap;
|
||||
use heed::types::{ByteSlice, OwnedType, SerdeBincode, Str};
|
||||
use heed::Result as ZResult;
|
||||
use meilidb_schema::Schema;
|
||||
use std::sync::Arc;
|
||||
use zlmdb::types::{ByteSlice, OwnedType, Serde, Str};
|
||||
use zlmdb::Result as ZResult;
|
||||
|
||||
const CUSTOMS_KEY: &str = "customs-key";
|
||||
const NUMBER_OF_DOCUMENTS_KEY: &str = "number-of-documents";
|
||||
@ -13,16 +13,16 @@ const WORDS_KEY: &str = "words";
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Main {
|
||||
pub(crate) main: zlmdb::DynDatabase,
|
||||
pub(crate) main: heed::PolyDatabase,
|
||||
}
|
||||
|
||||
impl Main {
|
||||
pub fn put_words_fst(self, writer: &mut zlmdb::RwTxn, fst: &fst::Set) -> ZResult<()> {
|
||||
pub fn put_words_fst(self, writer: &mut heed::RwTxn, fst: &fst::Set) -> ZResult<()> {
|
||||
let bytes = fst.as_fst().as_bytes();
|
||||
self.main.put::<Str, ByteSlice>(writer, WORDS_KEY, bytes)
|
||||
}
|
||||
|
||||
pub fn words_fst(self, reader: &zlmdb::RoTxn) -> ZResult<Option<fst::Set>> {
|
||||
pub fn words_fst(self, reader: &heed::RoTxn) -> ZResult<Option<fst::Set>> {
|
||||
match self.main.get::<Str, ByteSlice>(reader, WORDS_KEY)? {
|
||||
Some(bytes) => {
|
||||
let len = bytes.len();
|
||||
@ -34,31 +34,32 @@ impl Main {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn put_schema(self, writer: &mut zlmdb::RwTxn, schema: &Schema) -> ZResult<()> {
|
||||
pub fn put_schema(self, writer: &mut heed::RwTxn, schema: &Schema) -> ZResult<()> {
|
||||
self.main
|
||||
.put::<Str, Serde<Schema>>(writer, SCHEMA_KEY, schema)
|
||||
.put::<Str, SerdeBincode<Schema>>(writer, SCHEMA_KEY, schema)
|
||||
}
|
||||
|
||||
pub fn schema(self, reader: &zlmdb::RoTxn) -> ZResult<Option<Schema>> {
|
||||
self.main.get::<Str, Serde<Schema>>(reader, SCHEMA_KEY)
|
||||
}
|
||||
|
||||
pub fn put_ranked_map(self, writer: &mut zlmdb::RwTxn, ranked_map: &RankedMap) -> ZResult<()> {
|
||||
pub fn schema(self, reader: &heed::RoTxn) -> ZResult<Option<Schema>> {
|
||||
self.main
|
||||
.put::<Str, Serde<RankedMap>>(writer, RANKED_MAP_KEY, &ranked_map)
|
||||
.get::<Str, SerdeBincode<Schema>>(reader, SCHEMA_KEY)
|
||||
}
|
||||
|
||||
pub fn ranked_map(self, reader: &zlmdb::RoTxn) -> ZResult<Option<RankedMap>> {
|
||||
pub fn put_ranked_map(self, writer: &mut heed::RwTxn, ranked_map: &RankedMap) -> ZResult<()> {
|
||||
self.main
|
||||
.get::<Str, Serde<RankedMap>>(reader, RANKED_MAP_KEY)
|
||||
.put::<Str, SerdeBincode<RankedMap>>(writer, RANKED_MAP_KEY, &ranked_map)
|
||||
}
|
||||
|
||||
pub fn put_synonyms_fst(self, writer: &mut zlmdb::RwTxn, fst: &fst::Set) -> ZResult<()> {
|
||||
pub fn ranked_map(self, reader: &heed::RoTxn) -> ZResult<Option<RankedMap>> {
|
||||
self.main
|
||||
.get::<Str, SerdeBincode<RankedMap>>(reader, RANKED_MAP_KEY)
|
||||
}
|
||||
|
||||
pub fn put_synonyms_fst(self, writer: &mut heed::RwTxn, fst: &fst::Set) -> ZResult<()> {
|
||||
let bytes = fst.as_fst().as_bytes();
|
||||
self.main.put::<Str, ByteSlice>(writer, SYNONYMS_KEY, bytes)
|
||||
}
|
||||
|
||||
pub fn synonyms_fst(self, reader: &zlmdb::RoTxn) -> ZResult<Option<fst::Set>> {
|
||||
pub fn synonyms_fst(self, reader: &heed::RoTxn) -> ZResult<Option<fst::Set>> {
|
||||
match self.main.get::<Str, ByteSlice>(reader, SYNONYMS_KEY)? {
|
||||
Some(bytes) => {
|
||||
let len = bytes.len();
|
||||
@ -70,7 +71,7 @@ impl Main {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn put_number_of_documents<F>(self, writer: &mut zlmdb::RwTxn, f: F) -> ZResult<u64>
|
||||
pub fn put_number_of_documents<F>(self, writer: &mut heed::RwTxn, f: F) -> ZResult<u64>
|
||||
where
|
||||
F: Fn(u64) -> u64,
|
||||
{
|
||||
@ -80,7 +81,7 @@ impl Main {
|
||||
Ok(new)
|
||||
}
|
||||
|
||||
pub fn number_of_documents(self, reader: &zlmdb::RoTxn) -> ZResult<u64> {
|
||||
pub fn number_of_documents(self, reader: &heed::RoTxn) -> ZResult<u64> {
|
||||
match self
|
||||
.main
|
||||
.get::<Str, OwnedType<u64>>(reader, NUMBER_OF_DOCUMENTS_KEY)?
|
||||
@ -90,12 +91,12 @@ impl Main {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn put_customs(self, writer: &mut zlmdb::RwTxn, customs: &[u8]) -> ZResult<()> {
|
||||
pub fn put_customs(self, writer: &mut heed::RwTxn, customs: &[u8]) -> ZResult<()> {
|
||||
self.main
|
||||
.put::<Str, ByteSlice>(writer, CUSTOMS_KEY, customs)
|
||||
}
|
||||
|
||||
pub fn customs<'txn>(self, reader: &'txn zlmdb::RoTxn) -> ZResult<Option<&'txn [u8]>> {
|
||||
pub fn customs<'txn>(self, reader: &'txn heed::RoTxn) -> ZResult<Option<&'txn [u8]>> {
|
||||
self.main.get::<Str, ByteSlice>(reader, CUSTOMS_KEY)
|
||||
}
|
||||
}
|
||||
|
@ -20,10 +20,10 @@ pub use self::updates_results::UpdatesResults;
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
||||
use heed::Result as ZResult;
|
||||
use meilidb_schema::{Schema, SchemaAttr};
|
||||
use serde::de;
|
||||
use zerocopy::{AsBytes, FromBytes};
|
||||
use zlmdb::Result as ZResult;
|
||||
|
||||
use crate::criterion::Criteria;
|
||||
use crate::serde::Deserializer;
|
||||
@ -97,7 +97,7 @@ pub struct Index {
|
||||
impl Index {
|
||||
pub fn document<T: de::DeserializeOwned>(
|
||||
&self,
|
||||
reader: &zlmdb::RoTxn,
|
||||
reader: &heed::RoTxn,
|
||||
attributes: Option<&HashSet<&str>>,
|
||||
document_id: DocumentId,
|
||||
) -> MResult<Option<T>> {
|
||||
@ -127,7 +127,7 @@ impl Index {
|
||||
|
||||
pub fn document_attribute<T: de::DeserializeOwned>(
|
||||
&self,
|
||||
reader: &zlmdb::RoTxn,
|
||||
reader: &heed::RoTxn,
|
||||
document_id: DocumentId,
|
||||
attribute: SchemaAttr,
|
||||
) -> MResult<Option<T>> {
|
||||
@ -140,12 +140,12 @@ impl Index {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn schema_update(&self, writer: &mut zlmdb::RwTxn, schema: Schema) -> MResult<u64> {
|
||||
pub fn schema_update(&self, writer: &mut heed::RwTxn, schema: Schema) -> MResult<u64> {
|
||||
let _ = self.updates_notifier.send(());
|
||||
update::push_schema_update(writer, self.updates, self.updates_results, schema)
|
||||
}
|
||||
|
||||
pub fn customs_update(&self, writer: &mut zlmdb::RwTxn, customs: Vec<u8>) -> ZResult<u64> {
|
||||
pub fn customs_update(&self, writer: &mut heed::RwTxn, customs: Vec<u8>) -> ZResult<u64> {
|
||||
let _ = self.updates_notifier.send(());
|
||||
update::push_customs_update(writer, self.updates, self.updates_results, customs)
|
||||
}
|
||||
@ -182,7 +182,7 @@ impl Index {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn current_update_id(&self, reader: &zlmdb::RoTxn) -> MResult<Option<u64>> {
|
||||
pub fn current_update_id(&self, reader: &heed::RoTxn) -> MResult<Option<u64>> {
|
||||
match self.updates.last_update_id(reader)? {
|
||||
Some((id, _)) => Ok(Some(id)),
|
||||
None => Ok(None),
|
||||
@ -191,7 +191,7 @@ impl Index {
|
||||
|
||||
pub fn update_status(
|
||||
&self,
|
||||
reader: &zlmdb::RoTxn,
|
||||
reader: &heed::RoTxn,
|
||||
update_id: u64,
|
||||
) -> MResult<update::UpdateStatus> {
|
||||
update::update_status(reader, self.updates, self.updates_results, update_id)
|
||||
@ -221,7 +221,7 @@ impl Index {
|
||||
}
|
||||
|
||||
pub fn create(
|
||||
env: &zlmdb::Env,
|
||||
env: &heed::Env,
|
||||
name: &str,
|
||||
updates_notifier: crossbeam_channel::Sender<()>,
|
||||
) -> MResult<Index> {
|
||||
@ -261,7 +261,7 @@ pub fn create(
|
||||
}
|
||||
|
||||
pub fn open(
|
||||
env: &zlmdb::Env,
|
||||
env: &heed::Env,
|
||||
name: &str,
|
||||
updates_notifier: crossbeam_channel::Sender<()>,
|
||||
) -> MResult<Option<Index>> {
|
||||
|
@ -1,31 +1,31 @@
|
||||
use crate::DocIndex;
|
||||
use heed::types::{ByteSlice, CowSlice};
|
||||
use heed::Result as ZResult;
|
||||
use sdset::{Set, SetBuf};
|
||||
use std::borrow::Cow;
|
||||
use zlmdb::types::{ByteSlice, CowSlice};
|
||||
use zlmdb::Result as ZResult;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct PostingsLists {
|
||||
pub(crate) postings_lists: zlmdb::Database<ByteSlice, CowSlice<DocIndex>>,
|
||||
pub(crate) postings_lists: heed::Database<ByteSlice, CowSlice<DocIndex>>,
|
||||
}
|
||||
|
||||
impl PostingsLists {
|
||||
pub fn put_postings_list(
|
||||
self,
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
word: &[u8],
|
||||
words_indexes: &Set<DocIndex>,
|
||||
) -> ZResult<()> {
|
||||
self.postings_lists.put(writer, word, words_indexes)
|
||||
}
|
||||
|
||||
pub fn del_postings_list(self, writer: &mut zlmdb::RwTxn, word: &[u8]) -> ZResult<bool> {
|
||||
pub fn del_postings_list(self, writer: &mut heed::RwTxn, word: &[u8]) -> ZResult<bool> {
|
||||
self.postings_lists.delete(writer, word)
|
||||
}
|
||||
|
||||
pub fn postings_list<'txn>(
|
||||
self,
|
||||
reader: &'txn zlmdb::RoTxn,
|
||||
reader: &'txn heed::RoTxn,
|
||||
word: &[u8],
|
||||
) -> ZResult<Option<Cow<'txn, Set<DocIndex>>>> {
|
||||
match self.postings_lists.get(reader, word)? {
|
||||
|
@ -1,16 +1,16 @@
|
||||
use heed::types::ByteSlice;
|
||||
use heed::Result as ZResult;
|
||||
use std::sync::Arc;
|
||||
use zlmdb::types::ByteSlice;
|
||||
use zlmdb::Result as ZResult;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Synonyms {
|
||||
pub(crate) synonyms: zlmdb::Database<ByteSlice, ByteSlice>,
|
||||
pub(crate) synonyms: heed::Database<ByteSlice, ByteSlice>,
|
||||
}
|
||||
|
||||
impl Synonyms {
|
||||
pub fn put_synonyms(
|
||||
self,
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
word: &[u8],
|
||||
synonyms: &fst::Set,
|
||||
) -> ZResult<()> {
|
||||
@ -18,11 +18,11 @@ impl Synonyms {
|
||||
self.synonyms.put(writer, word, bytes)
|
||||
}
|
||||
|
||||
pub fn del_synonyms(self, writer: &mut zlmdb::RwTxn, word: &[u8]) -> ZResult<bool> {
|
||||
pub fn del_synonyms(self, writer: &mut heed::RwTxn, word: &[u8]) -> ZResult<bool> {
|
||||
self.synonyms.delete(writer, word)
|
||||
}
|
||||
|
||||
pub fn synonyms(self, reader: &zlmdb::RoTxn, word: &[u8]) -> ZResult<Option<fst::Set>> {
|
||||
pub fn synonyms(self, reader: &heed::RoTxn, word: &[u8]) -> ZResult<Option<fst::Set>> {
|
||||
match self.synonyms.get(reader, word)? {
|
||||
Some(bytes) => {
|
||||
let len = bytes.len();
|
||||
|
@ -1,42 +1,16 @@
|
||||
use super::BEU64;
|
||||
use crate::update::Update;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::borrow::Cow;
|
||||
use zlmdb::types::OwnedType;
|
||||
use zlmdb::{BytesDecode, BytesEncode, Result as ZResult};
|
||||
|
||||
pub struct SerdeJson<T>(std::marker::PhantomData<T>);
|
||||
|
||||
impl<T> BytesEncode for SerdeJson<T>
|
||||
where
|
||||
T: Serialize,
|
||||
{
|
||||
type EItem = T;
|
||||
|
||||
fn bytes_encode(item: &Self::EItem) -> Option<Cow<[u8]>> {
|
||||
serde_json::to_vec(item).map(Cow::Owned).ok()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: 'a> BytesDecode<'a> for SerdeJson<T>
|
||||
where
|
||||
T: Deserialize<'a> + Clone,
|
||||
{
|
||||
type DItem = T;
|
||||
|
||||
fn bytes_decode(bytes: &'a [u8]) -> Option<Self::DItem> {
|
||||
serde_json::from_slice(bytes).ok()
|
||||
}
|
||||
}
|
||||
use heed::types::{OwnedType, SerdeJson};
|
||||
use heed::Result as ZResult;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Updates {
|
||||
pub(crate) updates: zlmdb::Database<OwnedType<BEU64>, SerdeJson<Update>>,
|
||||
pub(crate) updates: heed::Database<OwnedType<BEU64>, SerdeJson<Update>>,
|
||||
}
|
||||
|
||||
impl Updates {
|
||||
// TODO do not trigger deserialize if possible
|
||||
pub fn last_update_id(self, reader: &zlmdb::RoTxn) -> ZResult<Option<(u64, Update)>> {
|
||||
pub fn last_update_id(self, reader: &heed::RoTxn) -> ZResult<Option<(u64, Update)>> {
|
||||
match self.updates.last(reader)? {
|
||||
Some((key, data)) => Ok(Some((key.get(), data))),
|
||||
None => Ok(None),
|
||||
@ -44,7 +18,7 @@ impl Updates {
|
||||
}
|
||||
|
||||
// TODO do not trigger deserialize if possible
|
||||
fn first_update_id(self, reader: &zlmdb::RoTxn) -> ZResult<Option<(u64, Update)>> {
|
||||
fn first_update_id(self, reader: &heed::RoTxn) -> ZResult<Option<(u64, Update)>> {
|
||||
match self.updates.first(reader)? {
|
||||
Some((key, data)) => Ok(Some((key.get(), data))),
|
||||
None => Ok(None),
|
||||
@ -52,14 +26,14 @@ impl Updates {
|
||||
}
|
||||
|
||||
// TODO do not trigger deserialize if possible
|
||||
pub fn contains(self, reader: &zlmdb::RoTxn, update_id: u64) -> ZResult<bool> {
|
||||
pub fn contains(self, reader: &heed::RoTxn, update_id: u64) -> ZResult<bool> {
|
||||
let update_id = BEU64::new(update_id);
|
||||
self.updates.get(reader, &update_id).map(|v| v.is_some())
|
||||
}
|
||||
|
||||
pub fn put_update(
|
||||
self,
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
update_id: u64,
|
||||
update: &Update,
|
||||
) -> ZResult<()> {
|
||||
@ -68,7 +42,7 @@ impl Updates {
|
||||
self.updates.put(writer, &update_id, update)
|
||||
}
|
||||
|
||||
pub fn pop_front(self, writer: &mut zlmdb::RwTxn) -> ZResult<Option<(u64, Update)>> {
|
||||
pub fn pop_front(self, writer: &mut heed::RwTxn) -> ZResult<Option<(u64, Update)>> {
|
||||
match self.first_update_id(writer)? {
|
||||
Some((update_id, update)) => {
|
||||
let key = BEU64::new(update_id);
|
||||
|
@ -1,15 +1,15 @@
|
||||
use super::BEU64;
|
||||
use crate::update::UpdateResult;
|
||||
use zlmdb::types::{OwnedType, Serde};
|
||||
use zlmdb::Result as ZResult;
|
||||
use heed::types::{OwnedType, SerdeBincode};
|
||||
use heed::Result as ZResult;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct UpdatesResults {
|
||||
pub(crate) updates_results: zlmdb::Database<OwnedType<BEU64>, Serde<UpdateResult>>,
|
||||
pub(crate) updates_results: heed::Database<OwnedType<BEU64>, SerdeBincode<UpdateResult>>,
|
||||
}
|
||||
|
||||
impl UpdatesResults {
|
||||
pub fn last_update_id(self, reader: &zlmdb::RoTxn) -> ZResult<Option<(u64, UpdateResult)>> {
|
||||
pub fn last_update_id(self, reader: &heed::RoTxn) -> ZResult<Option<(u64, UpdateResult)>> {
|
||||
match self.updates_results.last(reader)? {
|
||||
Some((key, data)) => Ok(Some((key.get(), data))),
|
||||
None => Ok(None),
|
||||
@ -18,7 +18,7 @@ impl UpdatesResults {
|
||||
|
||||
pub fn put_update_result(
|
||||
self,
|
||||
writer: &mut zlmdb::RwTxn,
|
||||
writer: &mut heed::RwTxn,
|
||||
update_id: u64,
|
||||
update_result: &UpdateResult,
|
||||
) -> ZResult<()> {
|
||||
@ -28,7 +28,7 @@ impl UpdatesResults {
|
||||
|
||||
pub fn update_result(
|
||||
self,
|
||||
reader: &zlmdb::RoTxn,
|
||||
reader: &heed::RoTxn,
|
||||
update_id: u64,
|
||||
) -> ZResult<Option<UpdateResult>> {
|
||||
let update_id = BEU64::new(update_id);
|
||||
|
@ -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…
Reference in New Issue
Block a user