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

View File

@ -114,8 +114,14 @@ impl IndexController {
todo!()
}
fn update_settings(&self, index_uid: String, settings: Settings) -> anyhow::Result<UpdateStatus> {
todo!()
pub async fn update_settings(&self, index_uid: String, settings: Settings) -> anyhow::Result<UpdateStatus> {
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> {