update settings

This commit is contained in:
mpostma 2021-03-04 12:20:14 +01:00
parent 8432c8584a
commit 47138c7632
No known key found for this signature in database
GPG Key ID: CBC8A7C1D7A28C3A
2 changed files with 12 additions and 8 deletions

View File

@ -25,13 +25,11 @@ impl Data {
pub async fn update_settings( pub async fn update_settings(
&self, &self,
_index: impl AsRef<str> + Send + Sync + 'static, index: String,
_settings: Settings settings: Settings
) -> anyhow::Result<UpdateStatus> { ) -> anyhow::Result<UpdateStatus> {
todo!() let update = self.index_controller.update_settings(index, settings).await?;
//let index_controller = self.index_controller.clone(); Ok(update.into())
//let update = tokio::task::spawn_blocking(move || index_controller.update_settings(index, settings)).await??;
//Ok(update.into())
} }
pub async fn clear_documents( pub async fn clear_documents(

View File

@ -114,8 +114,14 @@ impl IndexController {
todo!() todo!()
} }
fn update_settings(&self, index_uid: String, settings: Settings) -> anyhow::Result<UpdateStatus> { pub async fn update_settings(&self, index_uid: String, settings: Settings) -> anyhow::Result<UpdateStatus> {
todo!() let uuid = self.uuid_resolver.get_or_create(index_uid).await?;
let meta = UpdateMeta::Settings(settings);
// Nothing so send, drop the sender right away, as not to block the update actor.
let (_, receiver) = mpsc::channel(1);
let status = self.update_handle.update(meta, receiver, uuid).await?;
Ok(status)
} }
pub async fn create_index(&self, index_settings: IndexSettings) -> anyhow::Result<IndexMetadata> { pub async fn create_index(&self, index_settings: IndexSettings) -> anyhow::Result<IndexMetadata> {