LogReader

Trait LogReader 

Source
pub trait LogReader {
    // Required methods
    fn applied_index_id(&self) -> u64;
    fn channel_applied_entry_id(&self, channel_id: u64) -> u64;
    fn read_meta(&self, channel_id: u64, id: u64) -> Result<u64, IoError>;
    fn read_entries(
        &self,
        channel_id: u64,
        start: u64,
        end: u64,
    ) -> Result<Vec<Entry>, IoError>;
    fn read_indexes(
        &self,
        start: u64,
        end: u64,
    ) -> Result<Vec<LogIndex>, IoError>;
}
Expand description

A trait is used by RawNode to load logs from persistent device.

Required Methods§

Source

fn applied_index_id(&self) -> u64

The index id of applied logs which has already persisted in FSM. Sdcons uses this value to load and recovery logs into memory storage. Only logs which index id is larged than applied_id will be transmit to FSM.

Source

fn channel_applied_entry_id(&self, channel_id: u64) -> u64

Return the maximum applied entry id of specified channel from the persistent device.

Source

fn read_meta(&self, channel_id: u64, id: u64) -> Result<u64, IoError>

Read the term of specified log of target channel from the persistent device.

Source

fn read_entries( &self, channel_id: u64, start: u64, end: u64, ) -> Result<Vec<Entry>, IoError>

Read the entries log between range [start, end) of specified channel from the persistent device.

Source

fn read_indexes(&self, start: u64, end: u64) -> Result<Vec<LogIndex>, IoError>

Read the indexes log between range [start, end) from the persistent device.

Implementors§