Struct tikv::storage::mvcc::reader::scanner::backward::BackwardKvScanner[][src]

pub struct BackwardKvScanner<S: Snapshot> {
    cfg: ScannerConfig<S>,
    lock_cursor: Cursor<S::Iter>,
    write_cursor: Cursor<S::Iter>,
    default_cursor: Option<Cursor<S::Iter>>,
    is_started: bool,
    statistics: Statistics,
    met_newer_ts_data: NewerTsCheckState,
}

This struct can be used to scan keys starting from the given user key in the reverse order (less than).

Internally, for each key, rollbacks are ignored and smaller version will be tried. If the isolation level is SI, locks will be checked first.

Use ScannerBuilder to build BackwardKvScanner.

Fields

cfg: ScannerConfig<S>lock_cursor: Cursor<S::Iter>write_cursor: Cursor<S::Iter>default_cursor: Option<Cursor<S::Iter>>

default cursor is lazy created only when it’s needed.

is_started: bool

Is iteration started

statistics: Statisticsmet_newer_ts_data: NewerTsCheckState

Implementations

impl<S: Snapshot> BackwardKvScanner<S>[src]

pub fn new(
    cfg: ScannerConfig<S>,
    lock_cursor: Cursor<S::Iter>,
    write_cursor: Cursor<S::Iter>
) -> BackwardKvScanner<S>
[src]

pub fn take_statistics(&mut self) -> Statistics[src]

Take out and reset the statistics collected so far.

pub fn met_newer_ts_data(&self) -> NewerTsCheckState[src]

Whether we met newer ts data. The result is always Unknown if check_has_newer_ts_data is not set.

pub fn read_next(&mut self) -> Result<Option<(Key, Value)>>[src]

Get the next key-value pair, in backward order.

fn reverse_get(
    &mut self,
    user_key: &Key,
    ts: TimeStamp,
    met_prev_user_key: &mut bool
) -> Result<Option<Value>>
[src]

Attempt to get the value of a key specified by user_key and self.cfg.ts in reverse order. This function requires that the write cursor is currently pointing to the earliest version of user_key.

fn handle_last_version(
    &mut self,
    some_write: Option<Write>,
    user_key: &Key
) -> Result<Option<Value>>
[src]

Handle last version. Last version may be PUT or DELETE. If it is a PUT, value should be load.

fn reverse_load_data_by_write(
    &mut self,
    write: Write,
    user_key: &Key
) -> Result<Value>
[src]

Load the value by the given some_write. If value is carried in some_write, it will be returned directly. Otherwise there will be a default CF look up.

The implementation is similar to PointGetter::load_data_by_write.

fn move_write_cursor_to_prev_user_key(
    &mut self,
    current_user_key: &Key
) -> Result<()>
[src]

After self.reverse_get(), our write cursor may be pointing to current user key (if we found a desired version), or previous user key (if there is no desired version), or out of bound.

If it is pointing to current user key, we need to step it until we meet a new key. We first try to prev() a few times. If still not reaching another user key, we seek_for_prev().

fn ensure_default_cursor(&mut self) -> Result<()>[src]

Create the default cursor if it doesn’t exist.

Auto Trait Implementations

impl<S> !RefUnwindSafe for BackwardKvScanner<S>

impl<S> Send for BackwardKvScanner<S>

impl<S> !Sync for BackwardKvScanner<S>

impl<S> Unpin for BackwardKvScanner<S> where
    S: Unpin,
    <S as Snapshot>::Iter: Unpin

impl<S> UnwindSafe for BackwardKvScanner<S> where
    S: UnwindSafe,
    <S as Snapshot>::Iter: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<V, W> ConvertFrom<W> for V where
    W: ConvertTo<V>, 
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> Sealed<T> for T where
    T: ?Sized
[src]

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]