|
@@ -203,12 +203,19 @@ impl Storage for RocksDb {
|
|
|
}
|
|
|
|
|
|
async fn get_event<T: AsRef<[u8]> + Send + Sync>(&self, id: T) -> Result<Option<Event>, Error> {
|
|
|
- Ok(self
|
|
|
+ let id = id.as_ref();
|
|
|
+ for value in self
|
|
|
.db
|
|
|
- .get_cf(&self.reference_to_cf_handle(ReferenceType::Events)?, id)
|
|
|
- .map_err(|e| Error::Internal(e.to_string()))?
|
|
|
- .map(|event| serde_json::from_slice(&event))
|
|
|
- .transpose()?)
|
|
|
+ .prefix_iterator_cf(&self.reference_to_cf_handle(ReferenceType::Events)?, id)
|
|
|
+ {
|
|
|
+ let (key, value) = value.map_err(|e| Error::Internal(e.to_string()))?;
|
|
|
+ if key.starts_with(&id) {
|
|
|
+ return Ok(Some(serde_json::from_slice(&value)?));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ Ok(None)
|
|
|
}
|
|
|
|
|
|
async fn get_by_filter(&self, mut query: Filter) -> Result<Cursor<'_>, Error> {
|