Struct tikv::storage::txn::commands::TypedCommand[][src]

pub struct TypedCommand<T> {
    pub cmd: Command,
    _pd: PhantomData<T>,
}

A Command with its return type, reified as the generic parameter T.

Incoming grpc requests (like CommitRequest, PrewriteRequest) are converted to this type via a series of transformations. That process is described below using CommitRequest as an example:

  1. A CommitRequest is handled by the future_commit method in kv.rs, where it needs to be transformed to a TypedCommand before being passed to the storage.sched_txn_command method.
  2. The From<CommitRequest> impl for TypedCommand gets chosen, and its generic parameter indicates that the result type for this instance of TypedCommand is going to be TxnStatus - one of the variants of the StorageCallback enum.
  3. In the above from method, the details of the commit request are captured by creating an instance of the struct storage::txn::commands::commit::Command via its new method.
  4. This struct is wrapped in a variant of the enum storage::txn::commands::Command. This enum exists to facilitate generic operations over different commands.
  5. Finally, the Command enum variant for Commit is converted to the TypedCommand using the From<Command> impl for TypedCommand.

For other requests, see the corresponding future_ method, the From trait implementation and so on.

Fields

cmd: Command_pd: PhantomData<T>

Track the type of the command’s return value.

Trait Implementations

impl From<BatchRollbackRequest> for TypedCommand<()>[src]

impl From<CheckSecondaryLocksRequest> for TypedCommand<SecondaryLocksStatus>[src]

impl From<CheckTxnStatusRequest> for TypedCommand<TxnStatus>[src]

impl From<CleanupRequest> for TypedCommand<()>[src]

impl<T: StorageCallbackType> From<Command> for TypedCommand<T>[src]

impl From<CommitRequest> for TypedCommand<TxnStatus>[src]

impl From<MvccGetByKeyRequest> for TypedCommand<MvccInfo>[src]

impl From<MvccGetByStartTsRequest> for TypedCommand<Option<(Key, MvccInfo)>>[src]

impl From<PessimisticLockRequest> for TypedCommand<StorageResult<PessimisticLockRes>>[src]

impl From<PessimisticRollbackRequest> for TypedCommand<Vec<StorageResult<()>>>[src]

impl From<PrewriteRequest> for TypedCommand<PrewriteResult>[src]

impl From<ResolveLockRequest> for TypedCommand<()>[src]

impl From<TxnHeartBeatRequest> for TypedCommand<TxnStatus>[src]

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

Auto Trait Implementations

impl<T> RefUnwindSafe for TypedCommand<T> where
    T: RefUnwindSafe

impl<T> Send for TypedCommand<T> where
    T: Send

impl<T> Sync for TypedCommand<T> where
    T: Sync

impl<T> Unpin for TypedCommand<T> where
    T: Unpin

impl<T> UnwindSafe for TypedCommand<T> where
    T: 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]