Trait txn_core::future::AsyncCm

source ·
pub trait AsyncCm: Sized {
    type Error: Error;
    type Key;
    type Options;

    // Required methods
    fn new(
        options: Self::Options
    ) -> impl Future<Output = Result<Self, Self::Error>>;
    fn mark_read(&mut self, key: &Self::Key) -> impl Future<Output = ()>;
    fn mark_conflict(&mut self, key: &Self::Key) -> impl Future<Output = ()>;
    fn has_conflict(&self, other: &Self) -> impl Future<Output = bool>;
    fn rollback(&mut self) -> impl Future<Output = Result<(), Self::Error>>;
}
Expand description

The conflict manager that can be used to manage the conflicts in a transaction.

The conflict normally needs to have:

  1. Contains fingerprints of keys read.
  2. Contains fingerprints of keys written. This is used for conflict detection.

Required Associated Types§

source

type Error: Error

The error type returned by the conflict manager.

source

type Key

The key type.

source

type Options

The options type used to create the conflict manager.

Required Methods§

source

fn new( options: Self::Options ) -> impl Future<Output = Result<Self, Self::Error>>

Create a new conflict manager with the given options.

source

fn mark_read(&mut self, key: &Self::Key) -> impl Future<Output = ()>

Mark the key is read.

source

fn mark_conflict(&mut self, key: &Self::Key) -> impl Future<Output = ()>

Mark the key is .

source

fn has_conflict(&self, other: &Self) -> impl Future<Output = bool>

Returns true if we have a conflict.

source

fn rollback(&mut self) -> impl Future<Output = Result<(), Self::Error>>

Rollback the conflict manager.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> AsyncCm for T
where T: Cm,

§

type Error = <T as Cm>::Error

§

type Key = <T as Cm>::Key

§

type Options = <T as Cm>::Options