1
0
Fork 0
mirror of https://forgejo.ellis.link/continuwuation/continuwuity.git synced 2025-08-07 15:20:55 +00:00

check cache prior to offloading iterator seek

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-12-17 10:43:14 +00:00 committed by strawberry
parent f54a62dda0
commit ad8cbcaac1
7 changed files with 96 additions and 5 deletions

View file

@ -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()
}