pub struct RaftNode { /* private fields */ }Expand description
The Raft consensus node
Implementations§
Source§impl RaftNode
impl RaftNode
Sourcepub fn new(config: RaftNodeConfig) -> Self
pub fn new(config: RaftNodeConfig) -> Self
Create a new Raft node
Sourcepub async fn submit_command(&self, data: Vec<u8>) -> RaftResult<CommandResult>
pub async fn submit_command(&self, data: Vec<u8>) -> RaftResult<CommandResult>
Submit a command to the Raft cluster
Sourcepub fn current_state(&self) -> RaftState
pub fn current_state(&self) -> RaftState
Get current state
Sourcepub fn current_term(&self) -> Term
pub fn current_term(&self) -> Term
Get current term
Sourcepub fn current_leader(&self) -> Option<NodeId>
pub fn current_leader(&self) -> Option<NodeId>
Get current leader
Auto Trait Implementations§
impl Freeze for RaftNode
impl !RefUnwindSafe for RaftNode
impl Send for RaftNode
impl Sync for RaftNode
impl Unpin 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