[−][src]Struct libraft::raft::Raft
Fields
id: u64
term: u64
vote: u64
read_states: Vec<ReadState>
raft_log: RaftLog<T>
max_inflight: u64
max_msg_size: u64
prs: HashMap<u64, Progress>
learner_prs: HashMap<u64, Progress>
state: StateType
is_learner: bool
votes: HashMap<u64, bool>
msgs: Vec<Message>
lead: u64
lead_transferee: u64
pending_conf_index: u64
read_only: ReadOnly
election_elapsed: u64
heartbeat_elapsed: u64
check_quorum: bool
pre_vote: bool
heartbeat_timeout: u64
election_timeout: u64
randomized_election_timeout: u64
disable_proposal_forwarding: bool
Methods
impl<T: Storage> Raft<T>
[src]
impl<T: Storage> Raft<T>
pub fn new(c: &mut Config, storage: T) -> Raft<T> | [src] |
Storage is the storage for raft. raft generates entries and states to be stored in storage. raft reads the persisted entries and states out of Storage when it needs. raft reads out the previous state and configuration out of storage when restarting.
pub fn get_status(&self) -> Status | [src] |
pub fn load_state(&mut self, state: &HardState) | [src] |
pub fn append_entry(&mut self, ents: &mut [Entry]) | [src] |
pub fn maybe_commit(&mut self) -> bool | [src] |
pub fn become_follower(&mut self, term: u64, lead: u64) | [src] |
pub fn become_leader(&mut self) | [src] |
pub fn become_candidate(&mut self) | [src] |
pub fn become_pre_candidate(&mut self) | [src] |
pub fn reset(&mut self, term: u64) | [src] |
pub fn reset_randomized_election_timeout(&mut self) | [src] |
pub fn abort_leader_transfer(&mut self) | [src] |
pub fn nodes(&self) -> Vec<u64> | [src] |
pub fn learner_nodes(&self) -> Vec<u64> | [src] |
pub fn add_node(&mut self, id: u64) | [src] |
pub fn add_learner(&mut self, id: u64) | [src] |
pub fn add_node_or_learner_node(&mut self, id: u64, is_learner: bool) | [src] |
pub fn remove_node(&mut self, id: u64) | [src] |
pub fn del_progress(&mut self, id: u64) | [src] |
pub fn get_mut_progress(&mut self, id: u64) -> Option<&mut Progress> | [src] |
pub fn get_progress(&self, id: u64) -> Option<&Progress> | [src] |
pub fn set_progress( | [src] |
pub fn soft_state(&self) -> SoftState | [src] |
pub fn hard_state(&self) -> HardState | [src] |
pub fn tick(&mut self) | [src] |
pub fn promotable(&self) -> bool | [src] |
promotable indicates whether state machine can be promoted to leader, which is true when its own id is in progress list.
pub fn past_election_timeout(&self) -> bool | [src] |
past_election_timeout returns true iff r.electionElapsed is greater than or equal to the randomized election timeout in [electiontimeout, 2 * electiontimeout - 1].
pub fn step(&mut self, msg: Message) -> Result<()> | [src] |
pub fn bcast_append(&mut self) | [src] |
pub fn set_prs(&mut self, prs: HashMap<u64, Progress>) | [src] |
pub fn take_prs(&mut self) -> HashMap<u64, Progress> | [src] |
pub fn take_learner_prs(&mut self) -> HashMap<u64, Progress> | [src] |
pub fn set_learner_prs(&mut self, learner_prs: HashMap<u64, Progress>) | [src] |
pub fn restore(&mut self, s: Snapshot) -> bool | [src] |
pub fn handle_heartbeat(&mut self, msg: Message) | [src] |
pub fn handle_append_entries(&mut self, msg: &Message) | [src] |
pub fn campaign(&mut self, campaign_type: &[u8]) | [src] |
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> | [src] |
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T | [src] |
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error> | [src] |
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId | [src] |