Skip to main content

Event

Enum Event 

Source
pub enum Event {
    Tick {
        now: Tick,
    },
    ReadIndex {
        request_id: u64,
        key: Vec<u8>,
    },
    Propose {
        client_id: ClientId,
        seq: u64,
        payload: Vec<u8>,
    },
    ProposeConfig {
        change: ConfigChange,
    },
    SnapshotLoaded {
        meta: SnapshotMeta,
        data: Vec<u8>,
    },
    SnapshotPersisted {
        meta: SnapshotMeta,
    },
    Message {
        from: NodeId,
        msg: Message,
    },
    Persisted {
        kind: PersistKind,
        up_to_index: LogIndex,
    },
    Restored {
        hard_state: HardState,
        entries: Vec<LogEntry>,
        snapshot: Option<SnapshotMeta>,
    },
}
Expand description

One input to Node::step.

Variants§

§

Tick

The driver’s clock reached now. The core compares this against its own deadlines; it never reads any other clock.

Fields

§now: Tick

The current virtual time.

§

ReadIndex

A client asks the leader for a linearizable read of key.

The core runs the ReadIndex protocol (docs/ARCHITECTURE.md section 8) and answers with Action::ReadReady once the read is safe to serve, or Action::ReadRejected when this node cannot serve it. The key is carried opaquely; the value lives in the state machine, not the core.

Fields

§request_id: u64

The client-chosen correlation id for this read.

§key: Vec<u8>

The key to read.

§

Propose

A client proposes a command to this node.

Fields

§client_id: ClientId

The proposing client.

§seq: u64

The per-client sequence number.

§payload: Vec<u8>

The canonical command payload (simraft-kv encoding).

§

ProposeConfig

An operator proposes a single-server membership change (docs/ARCHITECTURE.md section 9). The leader answers with Action::ConfigResponse: immediately when the change is rejected, and when the config entry commits when it is accepted.

Fields

§change: ConfigChange

The change being proposed.

§

SnapshotLoaded

The driver loaded this node’s snapshot payload from its state machine, either for the node’s own log compaction or because the node leads and a follower needs the snapshot relayed. The core holds the bytes until every lagging follower has passed the snapshot base.

Fields

§meta: SnapshotMeta

The snapshot’s identity.

§data: Vec<u8>

The complete snapshot payload bytes.

§

SnapshotPersisted

A snapshot the driver was asked to persist (its own, received over the wire and assembled, or relayed) is now durable. Only on this acknowledgment does the core install the snapshot: advance the log base, retain or discard the log per the prefix rule, and jump the apply cursor (invariant T-02 applied to snapshots).

Fields

§meta: SnapshotMeta

The persisted snapshot’s identity.

§

Message

An RPC message arrived from another node.

Fields

§from: NodeId

The sender.

§msg: Message

The message.

§

Persisted

A durable write the driver was asked to perform has completed. Dependent responses are released only when this arrives (invariant T-02).

Fields

§kind: PersistKind

Which write completed.

§up_to_index: LogIndex

For PersistKind::Entries, the highest index now durable. Ignored for PersistKind::HardState.

§

Restored

The node restarted; this is its recovered durable state. Sent by the driver as the first event after construction when restarting a crashed node.

Fields

§hard_state: HardState

The recovered hard state.

§entries: Vec<LogEntry>

The recovered durable log entries above the snapshot boundary, in index order: every durable entry when snapshot is None, and only the entries the snapshot does not cover when it is present (invariant N-08). A store never returns covered entries at restore.

§snapshot: Option<SnapshotMeta>

The recovered durable snapshot’s boundary, when the storage layer holds one whose payload the driver has verified and installed into its state machine. The core installs the boundary at restore (invariant N-07): without it a restarted node’s base never reflects its snapshot, and the recovered suffix is replayed at the wrong indexes.

Trait Implementations§

Source§

impl Clone for Event

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 Event

Source§

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

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

impl Eq for Event

Source§

impl PartialEq for Event

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 Event

Auto Trait Implementations§

§

impl Forget for Event

§

impl Freeze for Event

§

impl Move for Event

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnsafeUnpin for Event

§

impl UnwindSafe for Event

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.