pub struct RaftStore { /* private fields */ }Expand description
The log and vote live in raft.db, the state machine is orch’s own database. Apply writes
each entry and raft:applied in one transaction on orch.db, so a crash never applies an
entry twice, and a log that runs ahead of the state is normal for Raft
Implementations§
Trait Implementations§
Source§impl RaftLogReader<TypeConfig> for RaftStore
impl RaftLogReader<TypeConfig> for RaftStore
Source§async fn try_get_log_entries<RB: RangeBounds<u64> + Clone + Debug + OptionalSend>(
&mut self,
range: RB,
) -> Result<Vec<Entry<TypeConfig>>, StorageError<NodeId>>
async fn try_get_log_entries<RB: RangeBounds<u64> + Clone + Debug + OptionalSend>( &mut self, range: RB, ) -> Result<Vec<Entry<TypeConfig>>, StorageError<NodeId>>
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 RaftSnapshotBuilder<TypeConfig> for RaftStore
impl RaftSnapshotBuilder<TypeConfig> for RaftStore
Source§async fn build_snapshot(
&mut self,
) -> Result<Snapshot<TypeConfig>, StorageError<NodeId>>
async fn build_snapshot( &mut self, ) -> Result<Snapshot<TypeConfig>, StorageError<NodeId>>
Build snapshot Read more
Source§impl RaftStorage<TypeConfig> for RaftStore
impl RaftStorage<TypeConfig> for RaftStore
Source§type SnapshotBuilder = RaftStore
type SnapshotBuilder = RaftStore
Snapshot builder type.
Source§async fn save_vote(
&mut self,
vote: &Vote<NodeId>,
) -> Result<(), StorageError<NodeId>>
async fn save_vote( &mut self, vote: &Vote<NodeId>, ) -> Result<(), StorageError<NodeId>>
To ensure correctness: the vote must be persisted on disk before returning.
async fn read_vote( &mut self, ) -> Result<Option<Vote<NodeId>>, StorageError<NodeId>>
Source§async fn save_committed(
&mut self,
committed: Option<LogId<NodeId>>,
) -> Result<(), StorageError<NodeId>>
async fn save_committed( &mut self, committed: Option<LogId<NodeId>>, ) -> Result<(), StorageError<NodeId>>
Saves the last committed log id to storage. Read more
Source§async fn read_committed(
&mut self,
) -> Result<Option<LogId<NodeId>>, StorageError<NodeId>>
async fn read_committed( &mut self, ) -> Result<Option<LogId<NodeId>>, StorageError<NodeId>>
Return the last saved committed log id by
Self::save_committed.Source§async fn get_log_state(
&mut self,
) -> Result<LogState<TypeConfig>, StorageError<NodeId>>
async fn get_log_state( &mut self, ) -> Result<LogState<TypeConfig>, StorageError<NodeId>>
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 append_to_log<I>(
&mut self,
entries: I,
) -> Result<(), StorageError<NodeId>>
async fn append_to_log<I>( &mut self, entries: I, ) -> Result<(), StorageError<NodeId>>
Append a payload of entries to the log. Read more
Source§async fn delete_conflict_logs_since(
&mut self,
log_id: LogId<NodeId>,
) -> Result<(), StorageError<NodeId>>
async fn delete_conflict_logs_since( &mut self, log_id: LogId<NodeId>, ) -> Result<(), StorageError<NodeId>>
Delete conflict log entries since
log_id, inclusive. Read moreSource§async fn purge_logs_upto(
&mut self,
log_id: LogId<NodeId>,
) -> Result<(), StorageError<NodeId>>
async fn purge_logs_upto( &mut self, log_id: LogId<NodeId>, ) -> Result<(), StorageError<NodeId>>
Delete applied log entries upto
log_id, inclusive. Read moreSource§async fn last_applied_state(
&mut self,
) -> Result<(Option<LogId<NodeId>>, StoredMembership<NodeId, BasicNode>), StorageError<NodeId>>
async fn last_applied_state( &mut self, ) -> Result<(Option<LogId<NodeId>>, StoredMembership<NodeId, BasicNode>), StorageError<NodeId>>
Returns the last applied log id which is recorded in state machine, and the last applied
membership config. Read more
Source§async fn apply_to_state_machine(
&mut self,
entries: &[Entry<TypeConfig>],
) -> Result<Vec<Reply>, StorageError<NodeId>>
async fn apply_to_state_machine( &mut self, entries: &[Entry<TypeConfig>], ) -> Result<Vec<Reply>, StorageError<NodeId>>
Apply the given payload of entries to the state machine. Read more
Source§async fn get_snapshot_builder(&mut self) -> Self::SnapshotBuilder
async fn get_snapshot_builder(&mut self) -> Self::SnapshotBuilder
Get the snapshot builder for the state machine. Read more
Source§async fn begin_receiving_snapshot(
&mut self,
) -> Result<Box<Cursor<Vec<u8>>>, StorageError<NodeId>>
async fn begin_receiving_snapshot( &mut self, ) -> Result<Box<Cursor<Vec<u8>>>, StorageError<NodeId>>
Create a new blank snapshot, returning a writable handle to the snapshot object. Read more
Source§async fn install_snapshot(
&mut self,
meta: &SnapshotMeta<NodeId, BasicNode>,
snapshot: Box<Cursor<Vec<u8>>>,
) -> Result<(), StorageError<NodeId>>
async fn install_snapshot( &mut self, meta: &SnapshotMeta<NodeId, BasicNode>, snapshot: Box<Cursor<Vec<u8>>>, ) -> Result<(), StorageError<NodeId>>
Install a snapshot which has finished streaming from the leader. Read more
Source§async fn get_current_snapshot(
&mut self,
) -> Result<Option<Snapshot<TypeConfig>>, StorageError<NodeId>>
async fn get_current_snapshot( &mut self, ) -> Result<Option<Snapshot<TypeConfig>>, StorageError<NodeId>>
Get a readable handle to the current snapshot, along with its metadata. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for RaftStore
impl !UnwindSafe for RaftStore
impl Freeze for RaftStore
impl Send for RaftStore
impl Sync for RaftStore
impl Unpin for RaftStore
impl UnsafeUnpin for RaftStore
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> 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 moreimpl<T> OptionalSend for T
impl<T> OptionalSync 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.