offload initial iterator seeks to threadpool
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use std::{pin::Pin, sync::Arc};
|
||||
use std::{convert, pin::Pin, sync::Arc};
|
||||
|
||||
use conduit::Result;
|
||||
use futures::{
|
||||
@@ -16,9 +16,17 @@ pub(crate) struct ItemsRev<'a> {
|
||||
}
|
||||
|
||||
impl<'a> ItemsRev<'a> {
|
||||
pub(crate) fn new(db: &'a Arc<Engine>, cf: &'a Arc<ColumnFamily>, opts: ReadOptions, from: From<'_>) -> Self {
|
||||
pub(crate) fn new(db: &'a Arc<Engine>, cf: &'a Arc<ColumnFamily>, opts: ReadOptions) -> Self {
|
||||
Self {
|
||||
state: State::new(db, cf, opts).init_rev(from),
|
||||
state: State::new(db, cf, opts),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> convert::From<State<'a>> for ItemsRev<'a> {
|
||||
fn from(state: State<'a>) -> Self {
|
||||
Self {
|
||||
state,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,6 +38,13 @@ impl<'a> Cursor<'a, KeyVal<'a>> for ItemsRev<'a> {
|
||||
|
||||
#[inline]
|
||||
fn seek(&mut self) { self.state.seek_rev(); }
|
||||
|
||||
#[inline]
|
||||
fn init(self, from: From<'a>) -> Self {
|
||||
Self {
|
||||
state: self.state.init_rev(from),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Stream for ItemsRev<'a> {
|
||||
|
||||
Reference in New Issue
Block a user