get update id

This commit is contained in:
mpostma 2021-01-28 17:20:51 +01:00
parent 4119ae8655
commit 60371b9dcf
No known key found for this signature in database
GPG key ID: CBC8A7C1D7A28C3A
4 changed files with 47 additions and 38 deletions

View file

@ -8,6 +8,7 @@ use std::path::Path;
use std::sync::Arc;
use milli::Index;
use anyhow::bail;
use crate::option::IndexerOpts;
use super::IndexController;
@ -73,4 +74,11 @@ impl IndexController for LocalIndexController {
let index = self.indexes.index(name)?.map(|(i, _)| i);
Ok(index)
}
fn update_status(&self, index: impl AsRef<str>, id: u64) -> anyhow::Result<Option<UpdateStatus<UpdateMeta, UpdateResult, String>>> {
match self.indexes.index(&index)? {
Some((_, update_store)) => Ok(update_store.meta(id)?),
None => bail!("index {:?} doesn't exist", index.as_ref()),
}
}
}

View file

@ -135,4 +135,6 @@ pub trait IndexController {
/// Returns, if it exists, an `IndexView` to the requested index.
fn index(&self, uid: impl AsRef<str>) -> anyhow::Result<Option<Arc<Index>>>;
fn update_status(&self, index: impl AsRef<str>, id: u64) -> anyhow::Result<Option<UpdateStatus<UpdateMeta, UpdateResult, String>>>;
}