From 3278d22279095d649b26bf4e3345766ea1f7634b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Tue, 15 Oct 2019 14:54:52 +0200 Subject: [PATCH] Introduce an Index mathod to retrieve the currently processed update --- meilidb-core/src/database.rs | 3 +-- meilidb-core/src/store/mod.rs | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/meilidb-core/src/database.rs b/meilidb-core/src/database.rs index 87bdbf8f1..af733d034 100644 --- a/meilidb-core/src/database.rs +++ b/meilidb-core/src/database.rs @@ -23,8 +23,7 @@ fn update_awaiter( rkv: Arc>, update_fn: Arc, index: Index, -) -{ +) { for () in receiver { // consume all updates in order (oldest first) loop { diff --git a/meilidb-core/src/store/mod.rs b/meilidb-core/src/store/mod.rs index 3bdd4ca18..6318284ca 100644 --- a/meilidb-core/src/store/mod.rs +++ b/meilidb-core/src/store/mod.rs @@ -186,6 +186,13 @@ impl Index { ) } + pub fn current_update_id(&self, reader: &T) -> MResult> { + match self.updates.last_update_id(reader)? { + Some((id, _)) => Ok(Some(id)), + None => Ok(None), + } + } + pub fn update_status( &self, reader: &T,