Struct agreed_memstore::MemStore[][src]

pub struct MemStore { /* fields omitted */ }
Expand description

An in-memory storage system implementing the agreed::RaftStorage trait.

Implementations

impl MemStore[src]

pub fn new(id: NodeId) -> Self[src]

Create a new MemStore instance.

pub async fn get_log(
    &self
) -> RwLockWriteGuard<'_, BTreeMap<u64, Entry<ClientRequest>>>
[src]

Get a handle to the log for testing purposes.

pub async fn get_state_machine(
    &self
) -> RwLockWriteGuard<'_, MemStoreStateMachine>
[src]

Get a handle to the state machine for testing purposes.

pub async fn read_hard_state(&self) -> RwLockReadGuard<'_, Option<HardState>>[src]

Get a handle to the current hard state for testing purposes.

Trait Implementations

impl RaftStorage<ClientRequest, ClientResponse> for MemStore[src]

type Snapshot = Cursor<Vec<u8>>

The storage engine’s associated type used for exposing a snapshot for reading & writing. Read more

type ShutdownError = ShutdownError

The error type used to indicate to Raft that shutdown is needed when calling the apply_entry_to_state_machine method. Read more

fn get_membership_config<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = Result<MembershipConfig>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Get the latest membership config found in the log. Read more

fn get_initial_state<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = Result<InitialState>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Get Raft’s state information from storage. Read more

fn save_hard_state<'life0, 'life1, 'async_trait>(
    &'life0 self,
    hs: &'life1 HardState
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 
[src]

Save Raft’s hard-state. Read more

fn get_log_entries<'life0, 'async_trait>(
    &'life0 self,
    start: u64,
    stop: u64
) -> Pin<Box<dyn Future<Output = Result<Vec<Entry<ClientRequest>>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Get a series of log entries from storage. Read more

fn delete_logs_from<'life0, 'async_trait>(
    &'life0 self,
    start: u64,
    stop: Option<u64>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Delete all logs starting from start and stopping at stop, else continuing to the end of the log if stop is None. Read more

fn append_entry_to_log<'life0, 'life1, 'async_trait>(
    &'life0 self,
    entry: &'life1 Entry<ClientRequest>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 
[src]

Append a new entry to the log. Read more

fn replicate_to_log<'life0, 'life1, 'async_trait>(
    &'life0 self,
    entries: &'life1 [Entry<ClientRequest>]
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 
[src]

Replicate a payload of entries to the log. Read more

fn apply_entry_to_state_machine<'life0, 'life1, 'life2, 'async_trait>(
    &'life0 self,
    index: &'life1 u64,
    data: &'life2 ClientRequest
) -> Pin<Box<dyn Future<Output = Result<ClientResponse>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    Self: 'async_trait, 
[src]

Apply the given log entry to the state machine. Read more

fn replicate_to_state_machine<'life0, 'life1, 'life2, 'life3, 'async_trait>(
    &'life0 self,
    entries: &'life1 [(&'life2 u64, &'life3 ClientRequest)]
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    'life3: 'async_trait,
    Self: 'async_trait, 
[src]

Apply the given payload of entries to the state machine, as part of replication. Read more

fn do_log_compaction<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = Result<CurrentSnapshotData<Self::Snapshot>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Perform log compaction, returning a handle to the generated snapshot. Read more

fn create_snapshot<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = Result<(String, Box<Self::Snapshot>)>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Create a new blank snapshot, returning a writable handle to the snapshot object along with the ID of the snapshot. Read more

fn finalize_snapshot_installation<'life0, 'async_trait>(
    &'life0 self,
    index: u64,
    term: u64,
    delete_through: Option<u64>,
    id: String,
    snapshot: Box<Self::Snapshot>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Finalize the installation of a snapshot which has finished streaming from the cluster leader. Read more

fn get_current_snapshot<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = Result<Option<CurrentSnapshotData<Self::Snapshot>>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Get a readable handle to the current snapshot, along with its metadata. Read more

Auto Trait Implementations

impl !RefUnwindSafe for MemStore

impl Send for MemStore

impl Sync for MemStore

impl Unpin for MemStore

impl UnwindSafe for MemStore

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V

impl<T> WithSubscriber for T[src]

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
    S: Into<Dispatch>, 
[src]

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

fn with_current_subscriber(self) -> WithDispatch<Self>[src]

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more