Enum almost_raft::Message[][src]

pub enum Message<T> {
    RequestVote {
        node_id: String,
        term: usize,
    },
    RequestVoteResponse {
        term: usize,
        vote: bool,
    },
    HeartBeat {
        leader_node_id: String,
        term: usize,
    },
    ControlAddNode(T),
    ControlRemoveNode(T),
    ControlLeaderChanged(String),
}
Expand description

Messages to communicate with Raft

Variants

RequestVote

Asking for vote from other nodes for term

Fields of RequestVote

node_id: String

Sender node id

term: usize

raft election term

RequestVoteResponse

Message in response to Message::RequestVote

Fields of RequestVoteResponse

term: usize

raft election term for which the vote was requested for

vote: bool

Is voting for the term

HeartBeat

Heartbeat message

Fields of HeartBeat

leader_node_id: String

Current leader, i.e. message sender’s node ID

term: usize

Term of the leader

ControlAddNode

Add a new node

Tuple Fields of ControlAddNode

0: T
ControlRemoveNode

Remove an existing node, removing self will cause node termination

Tuple Fields of ControlRemoveNode

0: T
ControlLeaderChanged

A leader has been elected or change of existing one

Tuple Fields of ControlLeaderChanged

0: String

Trait Implementations

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.