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 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,6 +98,9 @@ impl FromStr for IndexUid {
} }
} }
mod real {
use super::*;
pub struct IndexResolver<U, I> { pub struct IndexResolver<U, I> {
index_uuid_store: U, index_uuid_store: U,
index_store: I, index_store: I,
@ -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,
@ -418,6 +425,7 @@ where
.ok_or(IndexResolverError::UnexistingIndex(uid)) .ok_or(IndexResolverError::UnexistingIndex(uid))
} }
} }
}
#[cfg(test)] #[cfg(test)]
mod test { mod test {