[−][src]Struct libraft::raft_log::RaftLog
Fields
storage: T
storage contains all stable entries since the last snapshot.
unstable: Unstable
unstable contains all unstable entries and snapshot. they will be saved into storage.
committed: u64
committed is the highest log position that is known to be in stable storage on a quorum of nodes.
applied: u64
applied is the highest log position that the application has been instructed to apply to its state machine. Invariant: applied <= committed
tag: String
tag only used for logger.
Methods
impl<T: Storage> RaftLog<T>
[src]
impl<T: Storage> RaftLog<T>
pub fn new(storage: T, tag: String) -> RaftLog<T> | [src] |
pub fn last_index(&self) -> u64 | [src] |
pub fn first_index(&self) -> u64 | [src] |
pub fn applied_to(&mut self, i: u64) | [src] |
pub fn last_term(&self) -> u64 | [src] |
pub fn term(&self, i: u64) -> Result<u64> | [src] |
pub fn get_applied(&self) -> u64 | [src] |
pub fn get_storage(&self) -> &T | [src] |
pub fn append(&mut self, ents: &[Entry]) -> u64 | [src] |
pub fn maybe_commit(&mut self, max_index: u64, term: u64) -> bool | [src] |
pub fn commit_to(&mut self, tocommit: u64) | [src] |
pub fn zero_term_on_err_compacted(&self, t: Result<u64>) -> u64 | [src] |
pub fn must_check_out_of_bounds(&self, low: u64, hight: u64) -> Result<()> | [src] |
pub fn slice(&self, lo: u64, hi: u64, max_size: u64) -> Result<Vec<Entry>> | [src] |
pub fn entries(&self, i: u64, max_size: u64) -> Result<Vec<Entry>> | [src] |
pub fn is_up_to_date(&self, index: u64, term: u64) -> bool | [src] |
is_up_to_date determines if the given (last_index,term) log is more up-to-date by comparing the index and term of the last entries in the existing logs. If the logs have last entries with different terms, then the log with the later term is more up-to-date. If the logs end with the same term, then whichever log has the larger last_index is more up-to-date. If the logs are the same, the given log is up-to-date.
pub fn match_term(&self, i: u64, term: u64) -> bool | [src] |
pub fn maybe_append( | [src] |
pub fn restore(&mut self, s: Snapshot) | [src] |
pub fn snapshot(&self) -> Result<Snapshot> | [src] |
pub fn unstable_entries(&self) -> Vec<Entry> | [src] |
pub fn next_ents(&self) -> Vec<Entry> | [src] |
pub fn has_next_ents(&self) -> bool | [src] |
pub fn stable_to(&mut self, index: u64, term: u64) | [src] |
pub fn stable_snap_to(&mut self, index: u64) | [src] |
pub fn all_entries(&self) -> Vec<Entry> | [src] |
Trait Implementations
impl<T: Default + Storage> Default for RaftLog<T>
[src]
impl<T: Default + Storage> Default for RaftLog<T>
impl<T: Storage> ToString for RaftLog<T>
[src]
impl<T: Storage> ToString for RaftLog<T>
impl<T: Debug + Storage> Debug for RaftLog<T>
[src]
impl<T: Debug + Storage> Debug for RaftLog<T>
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> ToString for T where
T: Display + ?Sized,
[src]
impl<T> ToString for T where
T: Display + ?Sized,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
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
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] |