restore settings updates

This commit is contained in:
mpostma 2021-09-24 14:55:57 +02:00
parent dfce44fa3b
commit c32012c44a
8 changed files with 264 additions and 280 deletions

View file

@ -18,7 +18,7 @@ use dump_actor::DumpActorHandle;
pub use dump_actor::{DumpInfo, DumpStatus};
use snapshot::load_snapshot;
use crate::index::{Checked, Document, IndexMeta, IndexStats, SearchQuery, SearchResult, Settings};
use crate::index::{Checked, Document, IndexMeta, IndexStats, SearchQuery, SearchResult, Settings, Unchecked};
use crate::index_controller::index_resolver::create_index_resolver;
use crate::options::IndexerOpts;
use error::Result;
@ -95,6 +95,7 @@ pub struct Stats {
#[derive(derivative::Derivative)]
#[derivative(Debug)]
pub enum Update {
Settings(Settings<Unchecked>),
DocumentAddition {
#[derivative(Debug="ignore")]
payload: Payload,
@ -242,8 +243,8 @@ impl IndexController {
IndexControllerBuilder::default()
}
pub async fn register_update(&self, uid: &str, update: Update) -> Result<UpdateStatus> {
match self.index_resolver.get_uuid(uid.to_string()).await {
pub async fn register_update(&self, uid: String, update: Update) -> Result<UpdateStatus> {
match self.index_resolver.get_uuid(uid).await {
Ok(uuid) => {
let update_result = UpdateMsg::update(&self.update_handle, uuid, update).await?;
Ok(update_result)

View file

@ -24,6 +24,7 @@ use uuid::Uuid;
use self::error::{Result, UpdateLoopError};
pub use self::message::UpdateMsg;
use self::store::{UpdateStore, UpdateStoreInfo};
use crate::index::{Settings, Unchecked};
use crate::index_controller::update_file_store::UpdateFileStore;
use status::UpdateStatus;
@ -53,6 +54,7 @@ pub enum RegisterUpdate {
method: IndexDocumentsMethod,
content_uuid: Uuid,
},
Settings(Settings<Unchecked>),
}
/// A wrapper type to implement read on a `Stream<Result<Bytes, Error>>`.
@ -207,6 +209,7 @@ impl UpdateLoop {
content_uuid,
}
}
Update::Settings(settings) => RegisterUpdate::Settings(settings),
};
let store = self.store.clone();