pub struct RaftNode { /* private fields */ }Implementations§
Source§impl RaftNode
impl RaftNode
pub fn new(config: RaftConfig, now: u64) -> Self
Sourcepub fn restart(&mut self, now: u64)
pub fn restart(&mut self, now: u64)
A process restart: the hard state and the log survive, everything else (commit index, applied state, pending outcomes) is rebuilt.
pub fn id(&self) -> usize
pub fn role(&self) -> RaftRole
pub fn term(&self) -> u64
pub fn leader(&self) -> Option<usize>
pub fn hard_state(&self) -> &RaftHardState
pub fn commit_index(&self) -> u64
pub fn applied_index(&self) -> u64
pub fn state(&self) -> &JournalState
Sourcepub fn take_messages(&mut self) -> Vec<RaftEnvelope>
pub fn take_messages(&mut self) -> Vec<RaftEnvelope>
Messages to deliver; persist the hard state and log first.
Sourcepub fn take_outcome(&mut self, id: u64) -> Option<RaftOutcome>
pub fn take_outcome(&mut self, id: u64) -> Option<RaftOutcome>
The outcome of a command proposed on this node, once applied here.
Sourcepub fn propose(&mut self, now: u64, command: RaftCommand) -> bool
pub fn propose(&mut self, now: u64, command: RaftCommand) -> bool
Proposes a command. Returns false when no leader is known, so the proposal went nowhere. Even on true the proposal may be lost.
Sourcepub fn tick(&mut self, now: u64)
pub fn tick(&mut self, now: u64)
Advances timers to the local time now. A clock that jumps backward
only delays them.
pub fn step(&mut self, now: u64, envelope: RaftEnvelope)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RaftNode
impl RefUnwindSafe for RaftNode
impl Send for RaftNode
impl Sync for RaftNode
impl Unpin for RaftNode
impl UnsafeUnpin for RaftNode
impl UnwindSafe for RaftNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more