Struct raft_consensus::persistent_log::fs::FsLog
[−]
[src]
pub struct FsLog { /* fields omitted */ }
Stores log on disk as 8 bytes for the version identifier, 8 bytes for current_term, 8 bytes for voted_for, and as much as needed for the log. Each log entry is stored as an 8 byte length specifier which is the total length of the entry in bytes, including the length specifier, followed by 8 bytes specifying the term, plus a variable length entry, which is the serialized command sent to raft by the client.
Methods
impl FsLog
[src]
Trait Implementations
impl Debug for FsLog
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Log for FsLog
[src]
type Error = Error
fn current_term(&self) -> Result<Term>
[src]
Returns the latest known term.
fn set_current_term(&mut self, term: Term) -> Result<()>
[src]
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>
[src]
Increment the current term. The voted_for
value will be reset.
fn voted_for(&self) -> Result<Option<ServerId>>
[src]
Returns the candidate id of the candidate voted for in the current term (or none).
fn set_voted_for(&mut self, address: ServerId) -> Result<()>
[src]
Sets the candidate id voted for in the current term.
fn latest_log_index(&self) -> Result<LogIndex>
[src]
Returns the index of the latest persisted log entry (0 if the log is empty).
fn latest_log_term(&self) -> Result<Term>
[src]
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>
[src]
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]
&mut self,
from: LogIndex,
entries: I
) -> Result<(), Self::Error>
Append entries sent from the leader.