Struct raft::raw_node::RawNode [−][src]
RawNode is a thread-unsafe Node. The methods of this struct correspond to the methods of Node and are described more fully there.
Fields
raft: Raft<T>
The internal raft state.
Methods
impl<T: Storage> RawNode<T>
[src]
impl<T: Storage> RawNode<T>
pub fn new(config: &Config, store: T, peers: Vec<Peer>) -> Result<RawNode<T>>
[src]
pub fn new(config: &Config, store: T, peers: Vec<Peer>) -> Result<RawNode<T>>
pub fn tick(&mut self) -> bool
[src]
pub fn tick(&mut self) -> bool
Tick advances the internal logical clock by a single tick.
Returns true to indicate that there will probably be some readiness which needs to be handled.
pub fn campaign(&mut self) -> Result<()>
[src]
pub fn campaign(&mut self) -> Result<()>
Campaign causes this RawNode to transition to candidate state.
pub fn propose(&mut self, context: Vec<u8>, data: Vec<u8>) -> Result<()>
[src]
pub fn propose(&mut self, context: Vec<u8>, data: Vec<u8>) -> Result<()>
Propose proposes data be appended to the raft log.
pub fn propose_conf_change(
&mut self,
context: Vec<u8>,
cc: ConfChange
) -> Result<()>
[src]
pub fn propose_conf_change(
&mut self,
context: Vec<u8>,
cc: ConfChange
) -> Result<()>
ProposeConfChange proposes a config change.
pub fn apply_conf_change(&mut self, cc: &ConfChange) -> ConfState
[src]
pub fn apply_conf_change(&mut self, cc: &ConfChange) -> ConfState
Takes the conf change and applies it.
pub fn step(&mut self, m: Message) -> Result<()>
[src]
pub fn step(&mut self, m: Message) -> Result<()>
Step advances the state machine using the given message.
pub fn ready_since(&mut self, applied_idx: u64) -> Ready
[src]
pub fn ready_since(&mut self, applied_idx: u64) -> Ready
Given an index, creates a new Ready value from that index.
pub fn ready(&mut self) -> Ready
[src]
pub fn ready(&mut self) -> Ready
Ready returns the current point-in-time state of this RawNode.
pub fn has_ready_since(&self, applied_idx: Option<u64>) -> bool
[src]
pub fn has_ready_since(&self, applied_idx: Option<u64>) -> bool
Given an index, can determine if there is a ready state from that time.
pub fn has_ready(&self) -> bool
[src]
pub fn has_ready(&self) -> bool
HasReady called when RawNode user need to check if any Ready pending. Checking logic in this method should be consistent with Ready.containsUpdates().
pub fn get_snap(&self) -> Option<&Snapshot>
[src]
pub fn get_snap(&self) -> Option<&Snapshot>
Grabs the snapshot from the raft if available.
pub fn advance(&mut self, rd: Ready)
[src]
pub fn advance(&mut self, rd: Ready)
Advance notifies the RawNode that the application has applied and saved progress in the last Ready results.
pub fn advance_append(&mut self, rd: Ready)
[src]
pub fn advance_append(&mut self, rd: Ready)
Appends and commits the ready value.
pub fn advance_apply(&mut self, applied: u64)
[src]
pub fn advance_apply(&mut self, applied: u64)
Advance apply to the passed index.
pub fn status(&self) -> Status
[src]
pub fn status(&self) -> Status
Status returns the current status of the given group.
pub fn report_unreachable(&mut self, id: u64)
[src]
pub fn report_unreachable(&mut self, id: u64)
ReportUnreachable reports the given node is not reachable for the last send.
pub fn report_snapshot(&mut self, id: u64, status: SnapshotStatus)
[src]
pub fn report_snapshot(&mut self, id: u64, status: SnapshotStatus)
ReportSnapshot reports the status of the sent snapshot.
pub fn transfer_leader(&mut self, transferee: u64)
[src]
pub fn transfer_leader(&mut self, transferee: u64)
TransferLeader tries to transfer leadership to the given transferee.
pub fn read_index(&mut self, rctx: Vec<u8>)
[src]
pub fn read_index(&mut self, rctx: Vec<u8>)
ReadIndex requests a read state. The read state will be set in ready. Read State has a read index. Once the application advances further than the read index, any linearizable read requests issued before the read request can be processed safely. The read state will have the same rctx attached.
pub fn get_store(&self) -> &T
[src]
pub fn get_store(&self) -> &T
Returns the store as an immutable reference.
pub fn mut_store(&mut self) -> &mut T
[src]
pub fn mut_store(&mut self) -> &mut T
Returns the store as a mutable reference.
pub fn skip_bcast_commit(&mut self, skip: bool)
[src]
pub fn skip_bcast_commit(&mut self, skip: bool)
Set whether skip broadcast empty commit messages at runtime.