pub struct RaftConsensus { /* private fields */ }
Expand description
Raft consensus implementation
Implementations§
Source§impl RaftConsensus
impl RaftConsensus
Sourcepub async fn start(
&mut self,
_cluster_state: Arc<ClusterState>,
) -> Result<(), ConsensusError>
pub async fn start( &mut self, _cluster_state: Arc<ClusterState>, ) -> Result<(), ConsensusError>
Start the consensus algorithm
Sourcepub async fn handle_message(
&self,
message: RaftMessage,
cluster_state: &ClusterState,
) -> Result<(), ConsensusError>
pub async fn handle_message( &self, message: RaftMessage, cluster_state: &ClusterState, ) -> Result<(), ConsensusError>
Handle incoming Raft messages
Sourcepub fn command_sender(&self) -> Sender<ConsensusCommand>
pub fn command_sender(&self) -> Sender<ConsensusCommand>
Get command sender for client requests
Sourcepub fn add_node_channel(&mut self, node_id: NodeId, sender: Sender<RaftMessage>)
pub fn add_node_channel(&mut self, node_id: NodeId, sender: Sender<RaftMessage>)
Add communication channel for a node
Auto Trait Implementations§
impl Freeze for RaftConsensus
impl !RefUnwindSafe for RaftConsensus
impl Send for RaftConsensus
impl Sync for RaftConsensus
impl Unpin for RaftConsensus
impl !UnwindSafe for RaftConsensus
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