move IndexResolver to real module

This commit is contained in:
ad hoc 2022-06-01 09:53:07 +02:00
parent c3003065e8
commit bbd685af5e
No known key found for this signature in database
GPG Key ID: 4F00A782990CC643

View File

@ -27,6 +27,8 @@ use self::meta_store::IndexMeta;
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
/// bytes long
#[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_store: I,
pub file_store: UpdateFileStore,
}
}
impl IndexResolver<HeedMetaStore, MapIndexStore> {
impl IndexResolver<HeedMetaStore, MapIndexStore> {
pub fn load_dump(
src: impl AsRef<Path>,
dst: impl AsRef<Path>,
@ -120,13 +125,13 @@ impl IndexResolver<HeedMetaStore, MapIndexStore> {
Ok(())
}
}
}
impl<U, I> IndexResolver<U, I>
where
impl<U, I> IndexResolver<U, I>
where
U: IndexMetaStore,
I: IndexStore,
{
{
pub fn new(index_uuid_store: U, index_store: I, file_store: UpdateFileStore) -> Self {
Self {
index_uuid_store,
@ -227,7 +232,9 @@ where
pub async fn process_task(&self, task: &Task) -> Result<TaskResult> {
match &task.content {
TaskContent::DocumentAddition { .. } => panic!("updates should be handled by batch"),
TaskContent::DocumentAddition { .. } => {
panic!("updates should be handled by batch")
}
TaskContent::DocumentDeletion {
deletion: DocumentDeletion::Ids(ids),
index_uid,
@ -417,6 +424,7 @@ where
)
.ok_or(IndexResolverError::UnexistingIndex(uid))
}
}
}
#[cfg(test)]