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 Forget for RaftNode
impl Freeze for RaftNodewhere
*const u8 is !null: Freeze,
PhantomData<RaftEntry>: Freeze,
*const LeafNode<String, JournalVersion> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, JournalVersion)>>: Freeze,
PhantomData<(u64, u64)>: Freeze,
*const LeafNode<usize, SetValZST> is !null: Freeze,
PhantomData<Box<(usize, SetValZST)>>: Freeze,
PhantomData<u64>: Freeze,
*const LeafNode<u64, SetValZST> is !null: Freeze,
PhantomData<Box<(u64, SetValZST)>>: Freeze,
*const LeafNode<u64, RaftOutcome> is !null: Freeze,
PhantomData<Box<(u64, RaftOutcome)>>: Freeze,
PhantomData<RaftEnvelope>: Freeze,
impl Move for RaftNode
impl RefUnwindSafe for RaftNode
impl Send for RaftNodewhere
RawVecInner: Send,
NodeRef<Owned, String, JournalVersion, LeafOrInternal>: Send,
BoxRaw<(String, JournalVersion)>: Send,
NodeRef<Owned, usize, SetValZST, LeafOrInternal>: Send,
BoxRaw<(usize, SetValZST)>: Send,
NodeRef<Owned, u64, SetValZST, LeafOrInternal>: Send,
BoxRaw<(u64, SetValZST)>: Send,
NodeRef<Owned, u64, RaftOutcome, LeafOrInternal>: Send,
BoxRaw<(u64, RaftOutcome)>: Send,
impl Sync for RaftNodewhere
RawVecInner: Sync,
NodeRef<Owned, String, JournalVersion, LeafOrInternal>: Sync,
BoxRaw<(String, JournalVersion)>: Sync,
NodeRef<Owned, usize, SetValZST, LeafOrInternal>: Sync,
BoxRaw<(usize, SetValZST)>: Sync,
NodeRef<Owned, u64, SetValZST, LeafOrInternal>: Sync,
BoxRaw<(u64, SetValZST)>: Sync,
NodeRef<Owned, u64, RaftOutcome, LeafOrInternal>: Sync,
BoxRaw<(u64, RaftOutcome)>: Sync,
impl Unpin for RaftNodewhere
*const u8 is !null: Unpin,
*const LeafNode<String, JournalVersion> is !null: Unpin,
Box<(String, JournalVersion)>: Unpin,
*const LeafNode<usize, SetValZST> is !null: Unpin,
Box<(usize, SetValZST)>: Unpin,
*const LeafNode<u64, SetValZST> is !null: Unpin,
Box<(u64, SetValZST)>: Unpin,
*const LeafNode<u64, RaftOutcome> is !null: Unpin,
Box<(u64, RaftOutcome)>: Unpin,
impl UnsafeUnpin for RaftNodewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<RaftEntry>: UnsafeUnpin,
*const LeafNode<String, JournalVersion> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, JournalVersion)>>: UnsafeUnpin,
PhantomData<(u64, u64)>: UnsafeUnpin,
*const LeafNode<usize, SetValZST> is !null: UnsafeUnpin,
PhantomData<Box<(usize, SetValZST)>>: UnsafeUnpin,
PhantomData<u64>: UnsafeUnpin,
*const LeafNode<u64, SetValZST> is !null: UnsafeUnpin,
PhantomData<Box<(u64, SetValZST)>>: UnsafeUnpin,
*const LeafNode<u64, RaftOutcome> is !null: UnsafeUnpin,
PhantomData<Box<(u64, RaftOutcome)>>: UnsafeUnpin,
PhantomData<RaftEnvelope>: UnsafeUnpin,
impl UnwindSafe for RaftNodewhere
RawVecInner: UnwindSafe,
BTreeMap<String, JournalVersion>: UnwindSafe,
BTreeMap<usize, SetValZST>: UnwindSafe,
BTreeMap<u64, SetValZST>: UnwindSafe,
BTreeMap<u64, RaftOutcome>: UnwindSafe,
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