mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-02-21 09:48:28 +01:00
move IndexResolver to real module
This commit is contained in:
parent
c3003065e8
commit
bbd685af5e
@ -27,6 +27,8 @@ use self::meta_store::IndexMeta;
|
|||||||
|
|
||||||
pub type HardStateIndexResolver = IndexResolver<HeedMetaStore, MapIndexStore>;
|
pub type HardStateIndexResolver = IndexResolver<HeedMetaStore, MapIndexStore>;
|
||||||
|
|
||||||
|
pub use real::IndexResolver;
|
||||||
|
|
||||||
/// An index uid is composed of only ascii alphanumeric characters, - and _, between 1 and 400
|
/// An index uid is composed of only ascii alphanumeric characters, - and _, between 1 and 400
|
||||||
/// bytes long
|
/// bytes long
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
|
||||||
@ -96,13 +98,16 @@ impl FromStr for IndexUid {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct IndexResolver<U, I> {
|
mod real {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
pub struct IndexResolver<U, I> {
|
||||||
index_uuid_store: U,
|
index_uuid_store: U,
|
||||||
index_store: I,
|
index_store: I,
|
||||||
pub file_store: UpdateFileStore,
|
pub file_store: UpdateFileStore,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IndexResolver<HeedMetaStore, MapIndexStore> {
|
impl IndexResolver<HeedMetaStore, MapIndexStore> {
|
||||||
pub fn load_dump(
|
pub fn load_dump(
|
||||||
src: impl AsRef<Path>,
|
src: impl AsRef<Path>,
|
||||||
dst: impl AsRef<Path>,
|
dst: impl AsRef<Path>,
|
||||||
@ -120,13 +125,13 @@ impl IndexResolver<HeedMetaStore, MapIndexStore> {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<U, I> IndexResolver<U, I>
|
impl<U, I> IndexResolver<U, I>
|
||||||
where
|
where
|
||||||
U: IndexMetaStore,
|
U: IndexMetaStore,
|
||||||
I: IndexStore,
|
I: IndexStore,
|
||||||
{
|
{
|
||||||
pub fn new(index_uuid_store: U, index_store: I, file_store: UpdateFileStore) -> Self {
|
pub fn new(index_uuid_store: U, index_store: I, file_store: UpdateFileStore) -> Self {
|
||||||
Self {
|
Self {
|
||||||
index_uuid_store,
|
index_uuid_store,
|
||||||
@ -227,7 +232,9 @@ where
|
|||||||
|
|
||||||
pub async fn process_task(&self, task: &Task) -> Result<TaskResult> {
|
pub async fn process_task(&self, task: &Task) -> Result<TaskResult> {
|
||||||
match &task.content {
|
match &task.content {
|
||||||
TaskContent::DocumentAddition { .. } => panic!("updates should be handled by batch"),
|
TaskContent::DocumentAddition { .. } => {
|
||||||
|
panic!("updates should be handled by batch")
|
||||||
|
}
|
||||||
TaskContent::DocumentDeletion {
|
TaskContent::DocumentDeletion {
|
||||||
deletion: DocumentDeletion::Ids(ids),
|
deletion: DocumentDeletion::Ids(ids),
|
||||||
index_uid,
|
index_uid,
|
||||||
@ -417,6 +424,7 @@ where
|
|||||||
)
|
)
|
||||||
.ok_or(IndexResolverError::UnexistingIndex(uid))
|
.ok_or(IndexResolverError::UnexistingIndex(uid))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user