check cache prior to offloading iterator seek
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
f54a62dda0
commit
ad8cbcaac1
7 changed files with 96 additions and 5 deletions
src/database/map
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue