Struct tikv::server::lock_manager::waiter_manager::Waiter[][src]

pub(crate) struct Waiter {
    pub(crate) start_ts: TimeStamp,
    pub(crate) cb: StorageCallback,
    pub(crate) pr: ProcessResult,
    pub(crate) lock: Lock,
    pub diag_ctx: DiagnosticContext,
    delay: Delay,
    _lifetime_timer: HistogramTimer,
}

If a pessimistic transaction meets a lock, it will wait for the lock released in WaiterManager.

Waiter contains the context of the pessimistic transaction. Each Waiter has a timeout. Transaction will be notified when the lock is released or the corresponding waiter times out.

Fields

start_ts: TimeStampcb: StorageCallbackpr: ProcessResult

The result of Command::AcquirePessimisticLock.

It contains a KeyIsLocked error at the beginning. It will be changed to WriteConflict error if the lock is released or Deadlock error if it causes deadlock.

lock: Lockdiag_ctx: DiagnosticContextdelay: Delay_lifetime_timer: HistogramTimer

Implementations

impl Waiter[src]

fn new(
    start_ts: TimeStamp,
    cb: StorageCallback,
    pr: ProcessResult,
    lock: Lock,
    deadline: Instant,
    diag_ctx: DiagnosticContext
) -> Self
[src]

fn on_timeout<F: FnOnce()>(&self, f: F) -> impl Future<Output = ()>[src]

The F will be invoked if the Waiter times out normally.

fn reset_timeout(&self, deadline: Instant)[src]

fn notify(self)[src]

Notify consumes the Waiter to notify the corresponding transaction going on.

fn conflict_with(&mut self, lock_ts: TimeStamp, commit_ts: TimeStamp)[src]

Changes the ProcessResult to WriteConflict. It may be invoked more than once.

fn deadlock_with(
    &mut self,
    deadlock_key_hash: u64,
    wait_chain: Vec<WaitForEntry>
)
[src]

Changes the ProcessResult to Deadlock.

fn extract_key_info(&mut self) -> (Vec<u8>, Vec<u8>)[src]

Extracts key and primary key from ProcessResult.

Auto Trait Implementations

impl !RefUnwindSafe for Waiter

impl !Send for Waiter

impl !Sync for Waiter

impl Unpin for Waiter

impl !UnwindSafe for Waiter

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, 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]