Struct simple_raft::log::mem::RaftLogMemory[][src]

pub struct RaftLogMemory { /* fields omitted */ }
Expand description

A naive in-memory implementation of RaftLog, primarily for testing.

Implementations

Constructs an empty Raft log with unbounded capacity.

Constructs an empty Raft log with bounded capacity.

initial_entries_capacity specifies how many log entries the Raft log will be able to store without reallocating. data_capacity specifies the maximum size of log entry data to store before discarding entries from the beginning of the log.

Trait Implementations

The type of error returned by fallable operations.

Appends an entry to the end of the log. Read more

Cancels all entries including and after the entry at index from_index, removing them from the log. Returns the number of entries removed. Read more

Returns the approximate serialized length in bytes of a given log entry.

Returns the entry at a given index, or None if the index is greater than the length of the log or if the entry has been discarded. Read more

Returns the term of the entry at a given index, or None if the index is greater than the length of the log or if the entry has been discarded. Read more

Returns the index immediately before the index of the first undiscarded entry in the log (see “Log Truncation”). Read more

Returns the index of the last entry in the log, or LogIndex::default() if empty. Read more

Returns the index of the last entry which has been returned by take_next, or LogIndex::default() if none have been. Read more

Returns the term of the last entry in the log, or TermId::default() if empty. Read more

Returns the term of the entry immediately preceding the first undiscarded entry in the log (see “Log Truncation”). Read more

Returns the next entry in the log not previously returned by this function, marking the returned entry eligible for future discard (see “Log Truncation”). Returns None if there is no such entry. Read more

Returns the approximate serialized length of the entry at a given index, or None if the index is greater than the length of the log or if the entry has been discarded. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.