Skip to main content

Action

Enum Action 

Source
pub enum Action {
    Send {
        to: NodeId,
        msg: Message,
    },
    PersistHardState {
        current_term: Term,
        voted_for: Option<NodeId>,
    },
    PersistEntries {
        from_index: LogIndex,
        entries: Vec<LogEntry>,
    },
    Apply {
        index: LogIndex,
        entry: LogEntry,
    },
    ReadReady {
        request_id: u64,
        key: Vec<u8>,
        read_index: LogIndex,
    },
    ReadRejected {
        request_id: u64,
        leader: Option<NodeId>,
    },
    ClientResponse {
        client_id: ClientId,
        seq: u64,
        result: ClientResult,
    },
    PersistSnapshot {
        meta: SnapshotMeta,
        data: Vec<u8>,
    },
    LoadSnapshot {
        meta: SnapshotMeta,
    },
    ConfigResponse {
        change: ConfigChange,
        result: ConfigResult,
    },
    StepDown {
        term: Term,
    },
}
Expand description

One output of Node::step.

Variants§

§

Send

Send an RPC message to a peer.

Fields

§to: NodeId

The recipient.

§msg: Message

The message.

§

PersistHardState

Persist the hard state (current term and voted-for) before any response that depends on it is released.

Fields

§current_term: Term

The current term to store.

§voted_for: Option<NodeId>

The vote to store.

§

PersistEntries

Persist log entries. Storage semantics: truncate the durable log to from_index - 1, then store entries at consecutive indexes starting at from_index.

Fields

§from_index: LogIndex

The index of the first entry in entries.

§entries: Vec<LogEntry>

The entries to store, in index order.

§

Apply

Apply the committed entry at index to the state machine. Applies are emitted in index order, exactly once per index per node lifetime.

Fields

§index: LogIndex

The entry’s log index.

§entry: LogEntry

The entry to apply.

§

ReadReady

A ReadIndex read is confirmed linearizable. The driver serves the value of key from its state machine once its applied index reaches read_index, and must not serve a newer-or-older value.

Fields

§request_id: u64

The correlation id from Event::ReadIndex.

§key: Vec<u8>

The key that was read.

§read_index: LogIndex

The commit index the read is pinned to.

§

ReadRejected

A ReadIndex read cannot be served by this node (it is not the leader, or it stopped being the leader mid-round).

Fields

§request_id: u64

The correlation id from Event::ReadIndex.

§leader: Option<NodeId>

The known leader, if any.

§

ClientResponse

Answer a client proposal.

Fields

§client_id: ClientId

The proposing client.

§seq: u64

The proposal’s sequence number.

§result: ClientResult

The outcome.

§

PersistSnapshot

Persist a fully assembled snapshot payload (received over the wire, or this node’s own once loaded) before the core installs it. The matching Event::SnapshotPersisted releases the install.

Fields

§meta: SnapshotMeta

The snapshot’s identity.

§data: Vec<u8>

The complete snapshot payload bytes.

§

LoadSnapshot

The core needs this node’s snapshot payload (its log base has advanced past entries a follower still needs, or the driver asked for compaction headroom). The driver answers with Event::SnapshotLoaded.

Fields

§meta: SnapshotMeta

The identity of the snapshot to load.

§

ConfigResponse

Answer a membership change proposal.

Fields

§change: ConfigChange

The change that was proposed.

§result: ConfigResult

The outcome.

§

StepDown

This node was a leader and stepped down on discovering a higher term. Drivers use it to fail in-flight leader work promptly.

Fields

§term: Term

The term the node stepped down into.

Trait Implementations§

Source§

impl Clone for Action

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Action

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Action

Source§

impl PartialEq for Action

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Action

Auto Trait Implementations§

§

impl Forget for Action

§

impl Freeze for Action

§

impl Move for Action

§

impl RefUnwindSafe for Action

§

impl Send for Action

§

impl Sync for Action

§

impl Unpin for Action

§

impl UnsafeUnpin for Action

§

impl UnwindSafe for Action

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.