pub struct RaftNode<LogEntry: AbstractLogEntry + Send + 'static, FSM: AbstractStateMachine + Clone + 'static> { /* private fields */ }
Implementations§
source§impl<LogEntry: AbstractLogEntry + Send + 'static, FSM: AbstractStateMachine + Clone + Send + 'static> RaftNode<LogEntry, FSM>
impl<LogEntry: AbstractLogEntry + Send + 'static, FSM: AbstractStateMachine + Clone + Send + 'static> RaftNode<LogEntry, FSM>
pub fn bootstrap( node_id: u64, should_be_leader: bool, fsm: FSM, config: Config, raft_addr: SocketAddr, logger: Arc<dyn Logger>, tx_server: Sender<ServerRequestMsg<LogEntry, FSM>>, rx_server: Receiver<ServerRequestMsg<LogEntry, FSM>> ) -> Result<Self>
pub async fn is_leader(&self) -> bool
pub async fn get_id(&self) -> u64
pub async fn get_leader_id(&self) -> u64
pub async fn get_peers(&self) -> Peers
pub async fn add_peer<A: ToSocketAddrs>( &self, id: u64, addr: A, role: Option<InitialRole> )
pub async fn add_peers(&self, peers: HashMap<u64, SocketAddr>)
pub async fn inspect(&self) -> Result<String>
pub async fn state_machine(&self) -> FSM
pub async fn storage(&self) -> HeedStorage
pub async fn propose(&self, proposal: Vec<u8>) -> Result<()>
pub async fn change_config( &self, conf_change: ConfChangeV2 ) -> ConfChangeResponseResult
pub async fn get_cluster_size(&self) -> usize
pub async fn quit(&self)
pub async fn transfer_leader(&self, node_id: u64)
pub async fn campaign(&self)
pub async fn demote(&self, term: u64, leader_id: u64)
pub async fn leave(&self)
pub async fn leave_joint(&self)
pub async fn send_message(&self, message: RaftMessage)
pub async fn make_snapshot(&self, index: u64, term: u64)
pub async fn join_cluster(&self, tickets: Vec<ClusterJoinTicket>)
Trait Implementations§
source§impl<LogEntry: Clone + AbstractLogEntry + Send + 'static, FSM: Clone + AbstractStateMachine + Clone + 'static> Clone for RaftNode<LogEntry, FSM>
impl<LogEntry: Clone + AbstractLogEntry + Send + 'static, FSM: Clone + AbstractStateMachine + Clone + 'static> Clone for RaftNode<LogEntry, FSM>
Auto Trait Implementations§
impl<LogEntry, FSM> Freeze for RaftNode<LogEntry, FSM>
impl<LogEntry, FSM> !RefUnwindSafe for RaftNode<LogEntry, FSM>
impl<LogEntry, FSM> Send for RaftNode<LogEntry, FSM>
impl<LogEntry, FSM> Sync for RaftNode<LogEntry, FSM>
impl<LogEntry, FSM> Unpin for RaftNode<LogEntry, FSM>
impl<LogEntry, FSM> !UnwindSafe for RaftNode<LogEntry, FSM>
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request