pub struct RaftNodeCore<LogEntry: AbstractLogEntry + Send + 'static, LogStorage: StableStorage + Send + Clone + 'static, FSM: AbstractStateMachine + Clone + 'static> {
pub raw_node: RawNode<LogStorage>,
pub fsm: FSM,
pub peers: Arc<Mutex<Peers>>,
/* private fields */
}Fields§
§raw_node: RawNode<LogStorage>§fsm: FSM§peers: Arc<Mutex<Peers>>Implementations§
Source§impl<LogEntry: AbstractLogEntry + Send + 'static, LogStorage: StableStorage + Send + Clone + 'static, FSM: AbstractStateMachine + Clone + Send + 'static> RaftNodeCore<LogEntry, LogStorage, FSM>
impl<LogEntry: AbstractLogEntry + Send + 'static, LogStorage: StableStorage + Send + Clone + 'static, FSM: AbstractStateMachine + Clone + Send + 'static> RaftNodeCore<LogEntry, LogStorage, FSM>
pub fn bootstrap( node_id: u64, should_be_leader: bool, log_storage: LogStorage, fsm: FSM, config: Config, raft_addr: SocketAddr, logger: Arc<dyn Logger>, tx_server: Sender<ServerRequestMsg<LogEntry, LogStorage, FSM>>, rx_server: Receiver<ServerRequestMsg<LogEntry, LogStorage, FSM>>, tx_local: Sender<LocalRequestMsg<LogEntry, LogStorage, FSM>>, rx_local: Receiver<LocalRequestMsg<LogEntry, LogStorage, FSM>>, ) -> Result<Self>
pub fn is_leader(&self) -> bool
pub fn get_id(&self) -> u64
pub fn get_leader_id(&self) -> u64
pub async fn get_peers(&self) -> Peers
pub async fn add_peer<A: ToSocketAddrs>( &mut self, id: u64, addr: A, role: Option<InitialRole>, ) -> Result<()>
pub async fn add_peers(&mut self, peers: HashMap<u64, SocketAddr>) -> Result<()>
pub async fn make_snapshot(&mut self, index: u64, term: u64) -> Result<()>
pub async fn inspect(&self) -> Result<String>
pub async fn run(self) -> Result<()>
Auto Trait Implementations§
impl<LogEntry, LogStorage, FSM> !Freeze for RaftNodeCore<LogEntry, LogStorage, FSM>
impl<LogEntry, LogStorage, FSM> !RefUnwindSafe for RaftNodeCore<LogEntry, LogStorage, FSM>
impl<LogEntry, LogStorage, FSM> Send for RaftNodeCore<LogEntry, LogStorage, FSM>where
LogStorage: Sync,
impl<LogEntry, LogStorage, FSM> Sync for RaftNodeCore<LogEntry, LogStorage, FSM>where
LogStorage: Sync,
impl<LogEntry, LogStorage, FSM> Unpin for RaftNodeCore<LogEntry, LogStorage, FSM>
impl<LogEntry, LogStorage, FSM> !UnwindSafe for RaftNodeCore<LogEntry, LogStorage, 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