Merge pull request #219 from meilisearch/current-update-id

Introduce an Index mathod to retrieve the currently processed update
This commit is contained in:
Clément Renault 2019-10-15 15:26:22 +02:00 committed by GitHub
commit f6282ca031
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -23,8 +23,7 @@ fn update_awaiter(
rkv: Arc<RwLock<rkv::Rkv>>,
update_fn: Arc<ArcSwapFn>,
index: Index,
)
{
) {
for () in receiver {
// consume all updates in order (oldest first)
loop {

View File

@ -186,6 +186,13 @@ impl Index {
)
}
pub fn current_update_id<T: rkv::Readable>(&self, reader: &T) -> MResult<Option<u64>> {
match self.updates.last_update_id(reader)? {
Some((id, _)) => Ok(Some(id)),
None => Ok(None),
}
}
pub fn update_status<T: rkv::Readable>(
&self,
reader: &T,