Struct almost_raft::election::RaftElectionState[][src]

pub struct RaftElectionState<T> { /* fields omitted */ }

Current state of the Raft

Implementations

impl<T: Node> RaftElectionState<T>[src]

pub fn init(
    self_id: String,
    election_timeout: u64,
    heartbeat_interval: u64,
    message_timeout: u64,
    peers: Vec<T>,
    tx: Sender<Message<T>>,
    max_node: usize,
    min_node: usize
) -> (Self, Sender<Message<T>>)
[src]

Initiate Raft election. This method doesn’t start the election.

Arguments

  • self_id - Identifier of this node
  • election_timeout - Time between the elections if no heartbeat is received. Will use a randomized value in range [election_timeout..election_timeout*2]
  • heartbeat_interval - Interval between heartbeat message
  • message_timeout - Timout before treating message sending as failure
  • peers - other nodes
  • tx - MPSC Sender to communicate with outside. Control messages will use this channel
  • max_node - Maximum number of allowed node in the cluster
  • min_node - Minimum node required. Election will not start until number of node reach min_node

Returns

Tuple - the initialized RaftElectionState & a Sender of mpsc channel for incoming control messages

Trait Implementations

impl<T: Debug> Debug for RaftElectionState<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for RaftElectionState<T>

impl<T> Send for RaftElectionState<T> where
    T: Send

impl<T> Sync for RaftElectionState<T> where
    T: Send + Sync

impl<T> Unpin for RaftElectionState<T> where
    T: Unpin

impl<T> !UnwindSafe for RaftElectionState<T>

Blanket Implementations

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

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

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

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

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

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.

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.

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