Struct raft_consensus::persistent_log::mem::MemLog [−][src]
pub struct MemLog { /* fields omitted */ }
This is a Log
implementation that stores entries in a simple in-memory vector. Other data
is stored in a struct. It is chiefly intended for testing.
Panic
No bounds checking is performed and attempted access to non-existing log indexes will panic.
Methods
impl MemLog
[src]
impl MemLog
Trait Implementations
impl Clone for MemLog
[src]
impl Clone for MemLog
fn clone(&self) -> MemLog
[src]
fn clone(&self) -> MemLog
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for MemLog
[src]
impl Debug for MemLog
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Log for MemLog
[src]
impl Log for MemLog
type Error = Error
fn current_term(&self) -> Result<Term, Error>
[src]
fn current_term(&self) -> Result<Term, Error>
Returns the latest known term.
fn set_current_term(&mut self, term: Term) -> Result<(), Error>
[src]
fn set_current_term(&mut self, term: Term) -> Result<(), Error>
Sets the current term to the provided value. The provided term must be greater than the current term. The voted_for
value will be reset. Read more
fn inc_current_term(&mut self) -> Result<Term, Error>
[src]
fn inc_current_term(&mut self) -> Result<Term, Error>
Increment the current term. The voted_for
value will be reset.
fn voted_for(&self) -> Result<Option<ServerId>, Error>
[src]
fn voted_for(&self) -> Result<Option<ServerId>, Error>
Returns the candidate id of the candidate voted for in the current term (or none).
fn set_voted_for(&mut self, address: ServerId) -> Result<(), Error>
[src]
fn set_voted_for(&mut self, address: ServerId) -> Result<(), Error>
Sets the candidate id voted for in the current term.
fn latest_log_index(&self) -> Result<LogIndex, Error>
[src]
fn latest_log_index(&self) -> Result<LogIndex, Error>
Returns the index of the latest persisted log entry (0 if the log is empty).
fn latest_log_term(&self) -> Result<Term, Error>
[src]
fn latest_log_term(&self) -> Result<Term, Error>
Returns the term of the latest persisted log entry (0 if the log is empty).
fn entry<W: Write>(
&self,
index: LogIndex,
buf: Option<W>
) -> Result<Term, Error>
[src]
fn entry<W: Write>(
&self,
index: LogIndex,
buf: Option<W>
) -> Result<Term, Error>
Returns the term for the entry at the provided log index writing entry itself to writer if requested Read more
fn append_entries<R: Read, I: Iterator<Item = (Term, R)>>(
&mut self,
from: LogIndex,
entries: I
) -> Result<(), Self::Error>
[src]
fn append_entries<R: Read, I: Iterator<Item = (Term, R)>>(
&mut self,
from: LogIndex,
entries: I
) -> Result<(), Self::Error>
Appends the provided entries to the log beginning at the given index.
impl Default for MemLog
[src]
impl Default for MemLog