raft_log

Struct RaftLog

Source
pub struct RaftLog<T: Types> { /* private fields */ }

Implementations§

Source§

impl<T: Types> RaftLog<T>

Source

pub fn dump_data(&self) -> DumpData<T>

Dump log data

Source

pub fn dump(&self) -> RefDump<'_, T>

Source

pub fn config(&self) -> &Config

Source

pub fn open(config: Arc<Config>) -> Result<Self, Error>

Source

pub fn load_chunk_ids(config: &Config) -> Result<Vec<ChunkId>, Error>

Source

pub fn update_state(&mut self, state: RaftLogState<T>) -> Result<Segment, Error>

Source

pub fn read( &self, from: u64, to: u64, ) -> impl Iterator<Item = Result<(T::LogId, T::LogPayload), Error>> + '_

Source

pub fn log_state(&self) -> &RaftLogState<T>

Source

pub fn stat(&self) -> Stat<T>

Source

pub fn access_stat(&self) -> &AccessStat

Source

pub fn on_disk_size(&self) -> u64

Trait Implementations§

Source§

impl<T: Debug + Types> Debug for RaftLog<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Types> RaftLogWriter<T> for RaftLog<T>

Source§

fn truncate(&mut self, index: u64) -> Result<Segment, Error>

Truncate at index, keep the record before index.

Source§

fn save_user_data( &mut self, user_data: Option<T::UserData>, ) -> Result<Segment, Error>

Update the Raft log state. Read more
Source§

fn save_vote(&mut self, vote: T::Vote) -> Result<Segment, Error>

Save the vote. Read more
Source§

fn append<I>(&mut self, entries: I) -> Result<Segment, Error>
where I: IntoIterator<Item = (T::LogId, T::LogPayload)>,

Append a batch of entries to the log. Read more
Source§

fn purge(&mut self, upto: T::LogId) -> Result<Segment, Error>

Purge the log entries before and at the given log id. Read more
Source§

fn commit(&mut self, log_id: T::LogId) -> Result<Segment, Error>

Update the committed log id. Read more
Source§

fn flush(&mut self, callback: T::Callback) -> Result<(), Error>

Request to flush all written data to persistent storage. Read more

Auto Trait Implementations§

§

impl<T> Freeze for RaftLog<T>
where <T as Types>::Vote: Freeze, <T as Types>::LogId: Freeze, <T as Types>::UserData: Freeze,

§

impl<T> RefUnwindSafe for RaftLog<T>

§

impl<T> Send for RaftLog<T>
where <T as Types>::Vote: Send, <T as Types>::UserData: Send, T: Send,

§

impl<T> Sync for RaftLog<T>
where <T as Types>::Vote: Sync, <T as Types>::UserData: Sync, T: Sync,

§

impl<T> Unpin for RaftLog<T>
where <T as Types>::Vote: Unpin, <T as Types>::LogId: Unpin, <T as Types>::UserData: Unpin, T: Unpin,

§

impl<T> UnwindSafe for RaftLog<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.