simplify iterator state constructor arguments
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
cc1889d135
commit
685b127f99
10 changed files with 23 additions and 19 deletions
|
@ -23,7 +23,7 @@ pub fn raw_keys(self: &Arc<Self>) -> impl Stream<Item = Result<Key<'_>>> + Send
|
|||
use crate::pool::Seek;
|
||||
|
||||
let opts = super::iter_options_default();
|
||||
let state = stream::State::new(&self.db, &self.cf, opts);
|
||||
let state = stream::State::new(self, opts);
|
||||
if is_cached(self) {
|
||||
let state = state.init_fwd(None);
|
||||
return task::consume_budget()
|
||||
|
|
|
@ -54,7 +54,7 @@ where
|
|||
use crate::pool::Seek;
|
||||
|
||||
let opts = super::iter_options_default();
|
||||
let state = stream::State::new(&self.db, &self.cf, opts);
|
||||
let state = stream::State::new(self, opts);
|
||||
if is_cached(self, from) {
|
||||
return stream::Keys::<'_>::from(state.init_fwd(from.as_ref().into())).boxed();
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ pub fn rev_raw_keys(self: &Arc<Self>) -> impl Stream<Item = Result<Key<'_>>> + S
|
|||
use crate::pool::Seek;
|
||||
|
||||
let opts = super::iter_options_default();
|
||||
let state = stream::State::new(&self.db, &self.cf, opts);
|
||||
let state = stream::State::new(self, opts);
|
||||
if is_cached(self) {
|
||||
let state = state.init_rev(None);
|
||||
return task::consume_budget()
|
||||
|
|
|
@ -62,7 +62,7 @@ where
|
|||
use crate::pool::Seek;
|
||||
|
||||
let opts = super::iter_options_default();
|
||||
let state = stream::State::new(&self.db, &self.cf, opts);
|
||||
let state = stream::State::new(self, opts);
|
||||
if is_cached(self, from) {
|
||||
return stream::KeysRev::<'_>::from(state.init_rev(from.as_ref().into())).boxed();
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ pub fn rev_raw_stream(self: &Arc<Self>) -> impl Stream<Item = Result<KeyVal<'_>>
|
|||
use crate::pool::Seek;
|
||||
|
||||
let opts = super::read_options_default();
|
||||
let state = stream::State::new(&self.db, &self.cf, opts);
|
||||
let state = stream::State::new(self, opts);
|
||||
if is_cached(self) {
|
||||
let state = state.init_rev(None);
|
||||
return task::consume_budget()
|
||||
|
@ -65,9 +65,9 @@ pub fn rev_raw_stream(self: &Arc<Self>) -> impl Stream<Item = Result<KeyVal<'_>>
|
|||
skip_all,
|
||||
fields(%map),
|
||||
)]
|
||||
pub(super) fn is_cached(map: &super::Map) -> bool {
|
||||
pub(super) fn is_cached(map: &Arc<super::Map>) -> bool {
|
||||
let opts = super::cache_read_options_default();
|
||||
let state = stream::State::new(&map.db, &map.cf, opts).init_rev(None);
|
||||
let state = stream::State::new(map, opts).init_rev(None);
|
||||
|
||||
!state.is_incomplete()
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ where
|
|||
use crate::pool::Seek;
|
||||
|
||||
let opts = super::iter_options_default();
|
||||
let state = stream::State::new(&self.db, &self.cf, opts);
|
||||
let state = stream::State::new(self, opts);
|
||||
if is_cached(self, from) {
|
||||
let state = state.init_rev(from.as_ref().into());
|
||||
return task::consume_budget()
|
||||
|
@ -119,7 +119,7 @@ where
|
|||
P: AsRef<[u8]> + ?Sized,
|
||||
{
|
||||
let cache_opts = super::cache_read_options_default();
|
||||
let cache_status = stream::State::new(&map.db, &map.cf, cache_opts)
|
||||
let cache_status = stream::State::new(map, cache_opts)
|
||||
.init_rev(from.as_ref().into())
|
||||
.status();
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ pub fn raw_stream(self: &Arc<Self>) -> impl Stream<Item = Result<KeyVal<'_>>> +
|
|||
use crate::pool::Seek;
|
||||
|
||||
let opts = super::read_options_default();
|
||||
let state = stream::State::new(&self.db, &self.cf, opts);
|
||||
let state = stream::State::new(self, opts);
|
||||
if is_cached(self) {
|
||||
let state = state.init_fwd(None);
|
||||
return task::consume_budget()
|
||||
|
@ -64,9 +64,9 @@ pub fn raw_stream(self: &Arc<Self>) -> impl Stream<Item = Result<KeyVal<'_>>> +
|
|||
skip_all,
|
||||
fields(%map),
|
||||
)]
|
||||
pub(super) fn is_cached(map: &super::Map) -> bool {
|
||||
pub(super) fn is_cached(map: &Arc<super::Map>) -> bool {
|
||||
let opts = super::cache_read_options_default();
|
||||
let state = stream::State::new(&map.db, &map.cf, opts).init_fwd(None);
|
||||
let state = stream::State::new(map, opts).init_fwd(None);
|
||||
|
||||
!state.is_incomplete()
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ where
|
|||
use crate::pool::Seek;
|
||||
|
||||
let opts = super::read_options_default();
|
||||
let state = stream::State::new(&self.db, &self.cf, opts);
|
||||
let state = stream::State::new(self, opts);
|
||||
if is_cached(self, from) {
|
||||
let state = state.init_fwd(from.as_ref().into());
|
||||
return task::consume_budget()
|
||||
|
@ -116,7 +116,7 @@ where
|
|||
P: AsRef<[u8]> + ?Sized,
|
||||
{
|
||||
let opts = super::cache_read_options_default();
|
||||
let state = stream::State::new(&map.db, &map.cf, opts).init_fwd(from.as_ref().into());
|
||||
let state = stream::State::new(map, opts).init_fwd(from.as_ref().into());
|
||||
|
||||
!state.is_incomplete()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue