[][src]Trait node_replication::Dispatch

pub trait Dispatch {
    type ReadOperation: Sized + Clone + PartialEq + Debug;
    type WriteOperation: Sized + Clone + PartialEq + Debug + Send;
    type Response: Sized + Clone;
    fn dispatch(&self, op: Self::ReadOperation) -> Self::Response;
fn dispatch_mut(&mut self, op: Self::WriteOperation) -> Self::Response; }

Trait that a data structure must implement to be usable with this library.

When this library executes a read-only operation against the data structure, it invokes the dispatch() method with the operation as an argument.

When this library executes a write operation against the data structure, it invokes the dispatch_mut() method with the operation as an argument.

Associated Types

type ReadOperation: Sized + Clone + PartialEq + Debug

A read-only operation. When executed against the data structure, an operation of this type must not mutate the data structure in anyway. Otherwise, the assumptions made by this library no longer hold.

type WriteOperation: Sized + Clone + PartialEq + Debug + Send

A write operation. When executed against the data structure, an operation of this type is allowed to mutate state. The library ensures that this is done so in a thread-safe manner.

type Response: Sized + Clone

The type on the value returned by the data structure when a ReadOperation or a WriteOperation successfully executes against it.

Loading content...

Required methods

fn dispatch(&self, op: Self::ReadOperation) -> Self::Response

Method on the data structure that allows a read-only operation to be executed against it.

fn dispatch_mut(&mut self, op: Self::WriteOperation) -> Self::Response

Method on the data structure that allows a write operation to be executed against it.

Loading content...

Implementors

Loading content...