mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-08-10 15:30:54 +00:00
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
|
@ -5,6 +5,7 @@ use futures::{FutureExt, Stream, StreamExt, TryFutureExt, TryStreamExt};
|
|||
use rocksdb::Direction;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::rev_stream_from::is_cached;
|
||||
use crate::{
|
||||
keyval::{result_deserialize_key, serialize_key, Key},
|
||||
stream,
|
||||
|
@ -62,6 +63,10 @@ where
|
|||
|
||||
let opts = super::iter_options_default();
|
||||
let state = stream::State::new(&self.db, &self.cf, opts);
|
||||
if is_cached(self, from) {
|
||||
return stream::KeysRev::<'_>::from(state.init_rev(from.as_ref().into())).boxed();
|
||||
}
|
||||
|
||||
let seek = Seek {
|
||||
map: self.clone(),
|
||||
dir: Direction::Reverse,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue