Trait Storage

Source
pub trait Storage<T>
where T: Entry,
{
Show 19 methods // Required methods fn append_entry(&mut self, entry: T) -> StorageResult<u64>; fn append_entries(&mut self, entries: Vec<T>) -> StorageResult<u64>; fn append_on_prefix( &mut self, from_idx: u64, entries: Vec<T>, ) -> StorageResult<u64>; fn set_promise(&mut self, n_prom: Ballot) -> StorageResult<()>; fn set_decided_idx(&mut self, ld: u64) -> StorageResult<()>; fn get_decided_idx(&self) -> StorageResult<u64>; fn set_accepted_round(&mut self, na: Ballot) -> StorageResult<()>; fn get_accepted_round(&self) -> StorageResult<Option<Ballot>>; fn get_entries(&self, from: u64, to: u64) -> StorageResult<Vec<T>>; fn get_log_len(&self) -> StorageResult<u64>; fn get_suffix(&self, from: u64) -> StorageResult<Vec<T>>; fn get_promise(&self) -> StorageResult<Option<Ballot>>; fn set_stopsign(&mut self, s: Option<StopSign>) -> StorageResult<()>; fn get_stopsign(&self) -> StorageResult<Option<StopSign>>; fn trim(&mut self, idx: u64) -> StorageResult<()>; fn set_compacted_idx(&mut self, idx: u64) -> StorageResult<()>; fn get_compacted_idx(&self) -> StorageResult<u64>; fn set_snapshot( &mut self, snapshot: Option<T::Snapshot>, ) -> StorageResult<()>; fn get_snapshot(&self) -> StorageResult<Option<T::Snapshot>>;
}
Expand description

Trait for implementing the storage backend of Sequence Paxos.

Required Methods§

Source

fn append_entry(&mut self, entry: T) -> StorageResult<u64>

Appends an entry to the end of the log and returns the log length.

Source

fn append_entries(&mut self, entries: Vec<T>) -> StorageResult<u64>

Appends the entries of entries to the end of the log and returns the log length.

Source

fn append_on_prefix( &mut self, from_idx: u64, entries: Vec<T>, ) -> StorageResult<u64>

Appends the entries of entries to the prefix from index from_index in the log and returns the log length.

Source

fn set_promise(&mut self, n_prom: Ballot) -> StorageResult<()>

Sets the round that has been promised.

Source

fn set_decided_idx(&mut self, ld: u64) -> StorageResult<()>

Sets the decided index in the log.

Source

fn get_decided_idx(&self) -> StorageResult<u64>

Returns the decided index in the log.

Source

fn set_accepted_round(&mut self, na: Ballot) -> StorageResult<()>

Sets the latest accepted round.

Source

fn get_accepted_round(&self) -> StorageResult<Option<Ballot>>

Returns the latest round in which entries have been accepted, returns None if no entries have been accepted.

Source

fn get_entries(&self, from: u64, to: u64) -> StorageResult<Vec<T>>

Returns the entries in the log in the index interval of [from, to). If entries do not exist for the complete interval, an empty Vector should be returned.

Source

fn get_log_len(&self) -> StorageResult<u64>

Returns the current length of the log.

Source

fn get_suffix(&self, from: u64) -> StorageResult<Vec<T>>

Returns the suffix of entries in the log from index from.

Source

fn get_promise(&self) -> StorageResult<Option<Ballot>>

Returns the round that has been promised.

Source

fn set_stopsign(&mut self, s: Option<StopSign>) -> StorageResult<()>

Sets the StopSign used for reconfiguration.

Source

fn get_stopsign(&self) -> StorageResult<Option<StopSign>>

Returns the stored StopSign, returns None if no StopSign has been stored.

Source

fn trim(&mut self, idx: u64) -> StorageResult<()>

Removes elements up to the given [idx] from storage.

Source

fn set_compacted_idx(&mut self, idx: u64) -> StorageResult<()>

Sets the compacted (i.e. trimmed or snapshotted) index.

Source

fn get_compacted_idx(&self) -> StorageResult<u64>

Returns the garbage collector index from storage.

Source

fn set_snapshot(&mut self, snapshot: Option<T::Snapshot>) -> StorageResult<()>

Sets the snapshot.

Source

fn get_snapshot(&self) -> StorageResult<Option<T::Snapshot>>

Returns the stored snapshot.

Implementors§