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]
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>>)
Initiate Raft election. This method doesn’t start the election.
Arguments
self_id
- Identifier of this nodeelection_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 messagemessage_timeout
- Timout before treating message sending as failurepeers
- other nodestx
- MPSC Sender to communicate with outside. Control messages will use this channelmax_node
- Maximum number of allowed node in the clustermin_node
- Minimum node required. Election will not start until number of node reachmin_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,
T: Send,
impl<T> Sync for RaftElectionState<T> where
T: Send + Sync,
T: Send + Sync,
impl<T> Unpin for RaftElectionState<T> where
T: Unpin,
T: Unpin,
impl<T> !UnwindSafe for RaftElectionState<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
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]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,