derive specific ReadOptions for iterators
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
aa6d0fcaa7
commit
65a370836c
8 changed files with 16 additions and 10 deletions
|
@ -116,18 +116,24 @@ fn open(db: &Arc<Engine>, name: &str) -> Result<Arc<ColumnFamily>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn cache_read_options_default() -> ReadOptions {
|
pub(crate) fn iter_options_default() -> ReadOptions {
|
||||||
|
let mut read_options = read_options_default();
|
||||||
|
read_options
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub(crate) fn cache_read_options_default() -> ReadOptions {
|
||||||
let mut read_options = read_options_default();
|
let mut read_options = read_options_default();
|
||||||
read_options.set_read_tier(ReadTier::BlockCache);
|
read_options.set_read_tier(ReadTier::BlockCache);
|
||||||
read_options
|
read_options
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn read_options_default() -> ReadOptions {
|
pub(crate) fn read_options_default() -> ReadOptions {
|
||||||
let mut read_options = ReadOptions::default();
|
let mut read_options = ReadOptions::default();
|
||||||
read_options.set_total_order_seek(true);
|
read_options.set_total_order_seek(true);
|
||||||
read_options
|
read_options
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn write_options_default() -> WriteOptions { WriteOptions::default() }
|
pub(crate) fn write_options_default() -> WriteOptions { WriteOptions::default() }
|
||||||
|
|
|
@ -15,6 +15,6 @@ where
|
||||||
#[implement(super::Map)]
|
#[implement(super::Map)]
|
||||||
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
|
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
|
||||||
pub fn raw_keys(&self) -> impl Stream<Item = Result<Key<'_>>> + Send {
|
pub fn raw_keys(&self) -> impl Stream<Item = Result<Key<'_>>> + Send {
|
||||||
let opts = super::read_options_default();
|
let opts = super::iter_options_default();
|
||||||
stream::Keys::new(&self.db, &self.cf, opts).init(None)
|
stream::Keys::new(&self.db, &self.cf, opts).init(None)
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ where
|
||||||
{
|
{
|
||||||
use crate::pool::Seek;
|
use crate::pool::Seek;
|
||||||
|
|
||||||
let opts = super::read_options_default();
|
let opts = super::iter_options_default();
|
||||||
let state = stream::State::new(&self.db, &self.cf, opts);
|
let state = stream::State::new(&self.db, &self.cf, opts);
|
||||||
let seek = Seek {
|
let seek = Seek {
|
||||||
map: self.clone(),
|
map: self.clone(),
|
||||||
|
|
|
@ -15,6 +15,6 @@ where
|
||||||
#[implement(super::Map)]
|
#[implement(super::Map)]
|
||||||
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
|
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
|
||||||
pub fn rev_raw_keys(&self) -> impl Stream<Item = Result<Key<'_>>> + Send {
|
pub fn rev_raw_keys(&self) -> impl Stream<Item = Result<Key<'_>>> + Send {
|
||||||
let opts = super::read_options_default();
|
let opts = super::iter_options_default();
|
||||||
stream::KeysRev::new(&self.db, &self.cf, opts).init(None)
|
stream::KeysRev::new(&self.db, &self.cf, opts).init(None)
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ where
|
||||||
{
|
{
|
||||||
use crate::pool::Seek;
|
use crate::pool::Seek;
|
||||||
|
|
||||||
let opts = super::read_options_default();
|
let opts = super::iter_options_default();
|
||||||
let state = stream::State::new(&self.db, &self.cf, opts);
|
let state = stream::State::new(&self.db, &self.cf, opts);
|
||||||
let seek = Seek {
|
let seek = Seek {
|
||||||
map: self.clone(),
|
map: self.clone(),
|
||||||
|
|
|
@ -23,6 +23,6 @@ where
|
||||||
#[implement(super::Map)]
|
#[implement(super::Map)]
|
||||||
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
|
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
|
||||||
pub fn rev_raw_stream(&self) -> impl Stream<Item = Result<KeyVal<'_>>> + Send {
|
pub fn rev_raw_stream(&self) -> impl Stream<Item = Result<KeyVal<'_>>> + Send {
|
||||||
let opts = super::read_options_default();
|
let opts = super::iter_options_default();
|
||||||
stream::ItemsRev::new(&self.db, &self.cf, opts).init(None)
|
stream::ItemsRev::new(&self.db, &self.cf, opts).init(None)
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ where
|
||||||
{
|
{
|
||||||
use crate::pool::Seek;
|
use crate::pool::Seek;
|
||||||
|
|
||||||
let opts = super::read_options_default();
|
let opts = super::iter_options_default();
|
||||||
let state = stream::State::new(&self.db, &self.cf, opts);
|
let state = stream::State::new(&self.db, &self.cf, opts);
|
||||||
let seek = Seek {
|
let seek = Seek {
|
||||||
map: self.clone(),
|
map: self.clone(),
|
||||||
|
|
|
@ -22,6 +22,6 @@ where
|
||||||
#[implement(super::Map)]
|
#[implement(super::Map)]
|
||||||
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
|
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
|
||||||
pub fn raw_stream(&self) -> impl Stream<Item = Result<KeyVal<'_>>> + Send {
|
pub fn raw_stream(&self) -> impl Stream<Item = Result<KeyVal<'_>>> + Send {
|
||||||
let opts = super::read_options_default();
|
let opts = super::iter_options_default();
|
||||||
stream::Items::new(&self.db, &self.cf, opts).init(None)
|
stream::Items::new(&self.db, &self.cf, opts).init(None)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue