check cache prior to offloading iterator seek

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk authored and strawberry committed 2024-12-18 13:29:43 -05:00
1 parent f54a62dda0
commit ad8cbcaac1
7 files changed
+96 -5

No files matched your search

+17
View File
@@ -26,3 +26,20 @@ pub fn rev_raw_stream(&self) -> impl Stream<Item = Result<KeyVal<'_>>> + Send {
let opts = super::iter_options_default();
stream::ItemsRev::new(&self.db, &self.cf, opts).init(None)
}
#[tracing::instrument(
name = "cached",
level = "trace",
skip_all,
fields(%map),
)]
pub(super) fn _is_cached<P>(map: &super::Map) -> bool
where
P: AsRef<[u8]> + ?Sized,
{
let opts = super::cache_read_options_default();
let mut state = stream::State::new(&map.db, &map.cf, opts);
state.seek_rev();
!state.is_incomplete()
}