Struct raft::raw_node::Ready

source ·
pub struct Ready { /* private fields */ }
Expand description

Ready encapsulates the entries and messages that are ready to read, be saved to stable storage, committed or sent to other peers.

Implementations§

source§

impl Ready

source

pub fn number(&self) -> u64

The number of current Ready. It is used for identifying the different Ready and ReadyRecord.

source

pub fn ss(&self) -> Option<&SoftState>

The current volatile state of a Node. SoftState will be None if there is no update. It is not required to consume or store SoftState.

source

pub fn hs(&self) -> Option<&HardState>

The current state of a Node to be saved to stable storage. HardState will be None state if there is no update.

source

pub fn read_states(&self) -> &Vec<ReadState>

ReadStates specifies the state for read only query.

source

pub fn take_read_states(&mut self) -> Vec<ReadState>

Take the ReadStates.

source

pub fn entries(&self) -> &Vec<Entry>

Entries specifies entries to be saved to stable storage.

source

pub fn take_entries(&mut self) -> Vec<Entry>

Take the Entries.

source

pub fn snapshot(&self) -> &Snapshot

Snapshot specifies the snapshot to be saved to stable storage.

source

pub fn committed_entries(&self) -> &Vec<Entry>

CommittedEntries specifies entries to be committed to a store/state-machine. These have previously been committed to stable store.

source

pub fn take_committed_entries(&mut self) -> Vec<Entry>

Take the CommitEntries.

source

pub fn messages(&self) -> &[Message]

Messages specifies outbound messages to be sent. If it contains a MsgSnap message, the application MUST report back to raft when the snapshot has been received or has failed by calling ReportSnapshot.

source

pub fn take_messages(&mut self) -> Vec<Message>

Take the Messages.

source

pub fn persisted_messages(&self) -> &[Message]

Persisted Messages specifies outbound messages to be sent AFTER the HardState, Entries and Snapshot are persisted to stable storage.

source

pub fn take_persisted_messages(&mut self) -> Vec<Message>

Take the Persisted Messages.

source

pub fn must_sync(&self) -> bool

MustSync is false if and only if

  1. no HardState or only its commit is different from before
  2. no Entries and Snapshot If it’s false, an asynchronous write of HardState is permissible before calling RawNode::on_persist_ready or RawNode::advance or its families.

Trait Implementations§

source§

impl Debug for Ready

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Ready

source§

fn default() -> Ready

Returns the “default value” for a type. Read more
source§

impl PartialEq<Ready> for Ready

source§

fn eq(&self, other: &Ready) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for Ready

Auto Trait Implementations§

§

impl RefUnwindSafe for Ready

§

impl Send for Ready

§

impl Sync for Ready

§

impl Unpin for Ready

§

impl UnwindSafe for Ready

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> SendSyncUnwindSafe for Twhere T: Send + Sync + UnwindSafe + ?Sized,