check cache prior to offloading iterator seek
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -25,3 +25,20 @@ pub fn raw_stream(&self) -> impl Stream<Item = Result<KeyVal<'_>>> + Send {
|
||||
let opts = super::iter_options_default();
|
||||
stream::Items::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_fwd();
|
||||
!state.is_incomplete()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user