pub struct LogStore { /* private fields */ }Expand description
In-memory Raft log store.
Entries live in a BTreeMap<u64, Entry> behind an Arc<Mutex<>>.
Sufficient for single-node and small clusters; for durable setups,
swap in a redb-backed implementation.
Implementations§
Trait Implementations§
Source§impl RaftLogReader<OrcaTypeConfig> for LogStore
impl RaftLogReader<OrcaTypeConfig> for LogStore
Source§async fn try_get_log_entries<RB: RangeBounds<u64> + Clone + Debug + Send>(
&mut self,
range: RB,
) -> Result<Vec<Entry<OrcaTypeConfig>>, StorageError<u64>>
async fn try_get_log_entries<RB: RangeBounds<u64> + Clone + Debug + Send>( &mut self, range: RB, ) -> Result<Vec<Entry<OrcaTypeConfig>>, StorageError<u64>>
Get a series of log entries from storage. Read more
Source§fn limited_get_log_entries(
&mut self,
start: u64,
end: u64,
) -> impl Future<Output = Result<Vec<<C as RaftTypeConfig>::Entry>, StorageError<<C as RaftTypeConfig>::NodeId>>> + Send
fn limited_get_log_entries( &mut self, start: u64, end: u64, ) -> impl Future<Output = Result<Vec<<C as RaftTypeConfig>::Entry>, StorageError<<C as RaftTypeConfig>::NodeId>>> + Send
Returns log entries within range
[start, end), end is exclusive,
potentially limited by implementation-defined constraints. Read moreSource§impl RaftLogStorage<OrcaTypeConfig> for LogStore
impl RaftLogStorage<OrcaTypeConfig> for LogStore
Source§async fn get_log_state(
&mut self,
) -> Result<LogState<OrcaTypeConfig>, StorageError<u64>>
async fn get_log_state( &mut self, ) -> Result<LogState<OrcaTypeConfig>, StorageError<u64>>
Returns the last deleted log id and the last log id. Read more
Source§async fn get_log_reader(&mut self) -> Self::LogReader
async fn get_log_reader(&mut self) -> Self::LogReader
Get the log reader. Read more
Source§async fn save_vote(&mut self, vote: &Vote<u64>) -> Result<(), StorageError<u64>>
async fn save_vote(&mut self, vote: &Vote<u64>) -> Result<(), StorageError<u64>>
Save vote to storage. Read more
Source§async fn read_vote(&mut self) -> Result<Option<Vote<u64>>, StorageError<u64>>
async fn read_vote(&mut self) -> Result<Option<Vote<u64>>, StorageError<u64>>
Return the last saved vote by
Self::save_vote.Source§async fn append<I>(
&mut self,
entries: I,
callback: LogFlushed<OrcaTypeConfig>,
) -> Result<(), StorageError<u64>>
async fn append<I>( &mut self, entries: I, callback: LogFlushed<OrcaTypeConfig>, ) -> Result<(), StorageError<u64>>
Append log entries and call the
callback once logs are persisted on disk. Read moreSource§async fn truncate(
&mut self,
log_id: LogId<u64>,
) -> Result<(), StorageError<u64>>
async fn truncate( &mut self, log_id: LogId<u64>, ) -> Result<(), StorageError<u64>>
Truncate logs since
log_id, inclusive Read moreSource§async fn purge(&mut self, log_id: LogId<u64>) -> Result<(), StorageError<u64>>
async fn purge(&mut self, log_id: LogId<u64>) -> Result<(), StorageError<u64>>
Purge logs upto
log_id, inclusive Read moreSource§fn save_committed(
&mut self,
_committed: Option<LogId<<C as RaftTypeConfig>::NodeId>>,
) -> impl Future<Output = Result<(), StorageError<<C as RaftTypeConfig>::NodeId>>> + Send
fn save_committed( &mut self, _committed: Option<LogId<<C as RaftTypeConfig>::NodeId>>, ) -> impl Future<Output = Result<(), StorageError<<C as RaftTypeConfig>::NodeId>>> + Send
Saves the last committed log id to storage. Read more
Source§fn read_committed(
&mut self,
) -> impl Future<Output = Result<Option<LogId<<C as RaftTypeConfig>::NodeId>>, StorageError<<C as RaftTypeConfig>::NodeId>>> + Send
fn read_committed( &mut self, ) -> impl Future<Output = Result<Option<LogId<<C as RaftTypeConfig>::NodeId>>, StorageError<<C as RaftTypeConfig>::NodeId>>> + Send
Return the last saved committed log id by
Self::save_committed.Auto Trait Implementations§
impl Freeze for LogStore
impl !RefUnwindSafe for LogStore
impl Send for LogStore
impl Sync for LogStore
impl Unpin for LogStore
impl UnsafeUnpin for LogStore
impl !UnwindSafe for LogStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<C, LR> RaftLogReaderExt<C> for LRwhere
C: RaftTypeConfig,
LR: RaftLogReader<C>,
impl<C, LR> RaftLogReaderExt<C> for LRwhere
C: RaftTypeConfig,
LR: RaftLogReader<C>,
Source§fn try_get_log_entry(
&mut self,
log_index: u64,
) -> impl Future<Output = Result<Option<<C as RaftTypeConfig>::Entry>, StorageError<<C as RaftTypeConfig>::NodeId>>> + Send
fn try_get_log_entry( &mut self, log_index: u64, ) -> impl Future<Output = Result<Option<<C as RaftTypeConfig>::Entry>, StorageError<<C as RaftTypeConfig>::NodeId>>> + Send
Try to get an log entry. Read more
Source§fn get_log_entries<RB>(
&mut self,
range: RB,
) -> impl Future<Output = Result<Vec<<C as RaftTypeConfig>::Entry>, StorageError<<C as RaftTypeConfig>::NodeId>>> + Send
fn get_log_entries<RB>( &mut self, range: RB, ) -> impl Future<Output = Result<Vec<<C as RaftTypeConfig>::Entry>, StorageError<<C as RaftTypeConfig>::NodeId>>> + Send
Get a series of log entries from storage. Read more
Source§fn get_log_id(
&mut self,
log_index: u64,
) -> impl Future<Output = Result<LogId<<C as RaftTypeConfig>::NodeId>, StorageError<<C as RaftTypeConfig>::NodeId>>> + Send
fn get_log_id( &mut self, log_index: u64, ) -> impl Future<Output = Result<LogId<<C as RaftTypeConfig>::NodeId>, StorageError<<C as RaftTypeConfig>::NodeId>>> + Send
Get the log id of the entry at
index.Source§impl<C, T> RaftLogStorageExt<C> for Twhere
T: RaftLogStorage<C>,
C: RaftTypeConfig,
impl<C, T> RaftLogStorageExt<C> for Twhere
T: RaftLogStorage<C>,
C: RaftTypeConfig,
Source§fn blocking_append<I>(
&mut self,
entries: I,
) -> impl Future<Output = Result<(), StorageError<<C as RaftTypeConfig>::NodeId>>> + Sendwhere
I: IntoIterator<Item = <C as RaftTypeConfig>::Entry> + OptionalSend,
<I as IntoIterator>::IntoIter: OptionalSend,
fn blocking_append<I>(
&mut self,
entries: I,
) -> impl Future<Output = Result<(), StorageError<<C as RaftTypeConfig>::NodeId>>> + Sendwhere
I: IntoIterator<Item = <C as RaftTypeConfig>::Entry> + OptionalSend,
<I as IntoIterator>::IntoIter: OptionalSend,
Blocking mode append log entries to the storage. Read more