Trait txn_core::sync::Cm

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

    // Required methods
    fn new(options: Self::Options) -> Result<Self, Self::Error>;
    fn mark_read(&mut self, key: &Self::Key);
    fn mark_conflict(&mut self, key: &Self::Key);
    fn has_conflict(&self, other: &Self) -> bool;
    fn rollback(&mut self) -> 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) -> Result<Self, Self::Error>

Create a new conflict manager with the given options.

source

fn mark_read(&mut self, key: &Self::Key)

Mark the key is read.

source

fn mark_conflict(&mut self, key: &Self::Key)

Mark the key is .

source

fn has_conflict(&self, other: &Self) -> bool

Returns true if we have a conflict.

source

fn rollback(&mut self) -> Result<(), Self::Error>

Rollback the conflict manager.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<K> Cm for BTreeCm<K>
where K: CheapClone + Ord,

source§

impl<K, S> Cm for HashCm<K, S>
where S: BuildHasher, K: Hash + Eq,