diff --git a/src/update_store.rs b/src/update_store.rs index 55fa480f6..5bc90d1c4 100644 --- a/src/update_store.rs +++ b/src/update_store.rs @@ -170,4 +170,21 @@ impl UpdateStore { Ok(()) } + + /// Returns the update associated meta or `None` if the update deosn't exist. + pub fn update_meta(&self, update_id: u64) -> heed::Result> + where M: for<'a> Deserialize<'a>, + { + let rtxn = self.env.read_txn()?; + let key = BEU64::new(update_id); + + if let Some(meta) = self.pending_meta.get(&rtxn, &key)? { + return Ok(Some(meta)); + } + + match self.processed_meta.get(&rtxn, &key)? { + Some(meta) => Ok(Some(meta)), + None => Ok(None), + } + } }