Struct tikv::storage::mvcc::MvccReader[][src]

pub struct MvccReader<S: EngineSnapshot> {
    snapshot: S,
    pub statistics: Statistics,
    data_cursor: Option<Cursor<S::Iter>>,
    lock_cursor: Option<Cursor<S::Iter>>,
    write_cursor: Option<Cursor<S::Iter>>,
    scan_mode: Option<ScanMode>,
    current_key: Option<Key>,
    fill_cache: bool,
}

Fields

snapshot: Sstatistics: Statisticsdata_cursor: Option<Cursor<S::Iter>>lock_cursor: Option<Cursor<S::Iter>>write_cursor: Option<Cursor<S::Iter>>scan_mode: Option<ScanMode>

None means following operations are performed on a single user key, i.e., different versions of the same key. It can use prefix seek to speed up reads from the write-cf.

current_key: Option<Key>fill_cache: bool

Implementations

impl<S: EngineSnapshot> MvccReader<S>[src]

pub fn new(snapshot: S, scan_mode: Option<ScanMode>, fill_cache: bool) -> Self[src]

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

load the value associated with key and pointed by write

pub fn load_lock(&mut self, key: &Key) -> Result<Option<Lock>>[src]

fn get_scan_mode(&self, allow_backward: bool) -> ScanMode[src]

pub fn seek_write(
    &mut self,
    key: &Key,
    ts: TimeStamp
) -> Result<Option<(TimeStamp, Write)>>
[src]

Return: (commit_ts, write_record) of the write record for key committed before or equal tots Post Condition: leave the write_cursor at the first record which key is less or equal to the ts encoded version of key

fn get(
    &mut self,
    key: &Key,
    ts: TimeStamp,
    gc_fence_limit: Option<TimeStamp>
) -> Result<Option<Value>>
[src]

Gets the value of the specified key’s latest version before specified ts.

It tries to ensure the write record’s gc_fence’s ts, if any, greater than specified gc_fence_limit. Pass None to gc_fence_limit to skip the check. The caller must guarantee that there’s no other PUT or DELETE versions whose commit_ts is between the found version and the provided gc_fence_limit (gc_fence_limit is inclusive).

For transactional reads, the gc_fence_limit must be provided to ensure the result is correct. Generally, it should be the read_ts of the current transaction, which might be different from the ts passed to this function.

Note that this function does not check for locks on key.

pub fn get_write(
    &mut self,
    key: &Key,
    ts: TimeStamp,
    gc_fence_limit: Option<TimeStamp>
) -> Result<Option<Write>>
[src]

Gets the write record of the specified key’s latest version before specified ts. It tries to ensure the write record’s gc_fence’s ts, if any, greater than specified gc_fence_limit. Pass None to gc_fence_limit to skip the check. The caller must guarantee that there’s no other PUT or DELETE versions whose commit_ts is between the found version and the provided gc_fence_limit (gc_fence_limit is inclusive). For transactional reads, the gc_fence_limit must be provided to ensure the result is correct. Generally, it should be the read_ts of the current transaction, which might be different from the ts passed to this function.

fn get_txn_commit_record(
    &mut self,
    key: &Key,
    start_ts: TimeStamp
) -> Result<TxnCommitRecord>
[src]

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

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

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

pub fn seek_ts(&mut self, ts: TimeStamp) -> Result<Option<Key>>[src]

Return the first committed key for which start_ts equals to ts

pub fn scan_locks<F>(
    &mut self,
    start: Option<&Key>,
    end: Option<&Key>,
    filter: F,
    limit: usize
) -> Result<(Vec<(Key, Lock)>, bool)> where
    F: Fn(&Lock) -> bool
[src]

Scan locks that satisfies filter(lock) returns true, from the given start key start. At most limit locks will be returned. If limit is set to 0, it means unlimited.

The return type is (locks, is_remain). is_remain indicates whether there MAY be remaining locks that can be scanned.

pub fn scan_keys(
    &mut self,
    start: Option<Key>,
    limit: usize
) -> Result<(Vec<Key>, Option<Key>)>
[src]

pub fn scan_values_in_default(
    &mut self,
    key: &Key
) -> Result<Vec<(TimeStamp, Value)>>
[src]

fn get_old_value(
    &mut self,
    key: &Key,
    start_ts: TimeStamp,
    prev_write_loaded: bool,
    prev_write: Option<Write>
) -> Result<OldValue>
[src]

Read the old value for key for CDC. prev_write stands for the previous write record of the key it must be read in the caller and be passed in for optimization

Auto Trait Implementations

impl<S> !RefUnwindSafe for MvccReader<S>

impl<S> Send for MvccReader<S>

impl<S> !Sync for MvccReader<S>

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

impl<S> UnwindSafe for MvccReader<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]