Trait openraft::DefensiveCheck
source · pub trait DefensiveCheck<C, T>: DefensiveCheckBase<C>where
C: RaftTypeConfig,
T: RaftStorage<C>,
Self: Wrapper<C, T>,{
// Provided methods
fn defensive_no_dirty_log<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn defensive_incremental_vote<'life0, 'life1, 'async_trait>(
&'life0 mut self,
vote: &'life1 Vote<C::NodeId>
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn defensive_consecutive_input<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
entries: &'life1 [&'life2 Entry<C>]
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn defensive_nonempty_input<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
entries: &'life1 [&'life2 Entry<C>]
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn defensive_append_log_index_is_last_plus_one<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
entries: &'life1 [&'life2 Entry<C>]
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn defensive_append_log_id_gt_last<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
entries: &'life1 [&'life2 Entry<C>]
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn defensive_purge_applied_le_last_applied<'life0, 'async_trait>(
&'life0 mut self,
upto: LogId<C::NodeId>
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn defensive_delete_conflict_gt_last_applied<'life0, 'async_trait>(
&'life0 mut self,
since: LogId<C::NodeId>
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn defensive_apply_index_is_last_applied_plus_one<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
entries: &'life1 [&'life2 Entry<C>]
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn defensive_half_open_range<'life0, 'async_trait, RB>(
&'life0 self,
range: RB
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>
where RB: 'async_trait + RangeBounds<u64> + Clone + Debug + Send,
Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn defensive_range_hits_logs<'life0, 'life1, 'async_trait, RB>(
&'life0 self,
range: RB,
logs: &'life1 [Entry<C>]
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>
where RB: 'async_trait + RangeBounds<u64> + Debug + Send,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn defensive_apply_log_id_gt_last<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
entries: &'life1 [&'life2 Entry<C>]
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}
Expand description
Defines methods of defensive checks for RaftStorage.
Provided Methods§
sourcefn defensive_no_dirty_log<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn defensive_no_dirty_log<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where Self: Send + 'async_trait, 'life0: 'async_trait,
Ensure that logs that have greater index than last_applied should have greater log_id.
Invariant must hold: log.log_id.index > last_applied.index
implies log.log_id > last_applied
.
sourcefn defensive_incremental_vote<'life0, 'life1, 'async_trait>(
&'life0 mut self,
vote: &'life1 Vote<C::NodeId>
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn defensive_incremental_vote<'life0, 'life1, 'async_trait>( &'life0 mut self, vote: &'life1 Vote<C::NodeId> ) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Ensure that current_term must increment for every update, and for every term there could be only one value for voted_for.
sourcefn defensive_consecutive_input<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
entries: &'life1 [&'life2 Entry<C>]
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn defensive_consecutive_input<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, entries: &'life1 [&'life2 Entry<C>] ) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
The log entries fed into a store must be consecutive otherwise it is a bug.
sourcefn defensive_nonempty_input<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
entries: &'life1 [&'life2 Entry<C>]
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn defensive_nonempty_input<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, entries: &'life1 [&'life2 Entry<C>] ) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
Trying to feed in empty entries slice is an inappropriate action.
The impl has to avoid this otherwise it may be a bug.
sourcefn defensive_append_log_index_is_last_plus_one<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
entries: &'life1 [&'life2 Entry<C>]
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn defensive_append_log_index_is_last_plus_one<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, entries: &'life1 [&'life2 Entry<C>] ) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
The entries to append has to be last_log_id.index + 1
sourcefn defensive_append_log_id_gt_last<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
entries: &'life1 [&'life2 Entry<C>]
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn defensive_append_log_id_gt_last<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, entries: &'life1 [&'life2 Entry<C>] ) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
The entries to append has to be greater than any known log ids
fn defensive_purge_applied_le_last_applied<'life0, 'async_trait>( &'life0 mut self, upto: LogId<C::NodeId> ) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where Self: Send + 'async_trait, 'life0: 'async_trait,
fn defensive_delete_conflict_gt_last_applied<'life0, 'async_trait>( &'life0 mut self, since: LogId<C::NodeId> ) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where Self: Send + 'async_trait, 'life0: 'async_trait,
sourcefn defensive_apply_index_is_last_applied_plus_one<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
entries: &'life1 [&'life2 Entry<C>]
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn defensive_apply_index_is_last_applied_plus_one<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, entries: &'life1 [&'life2 Entry<C>] ) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
The entries to apply to state machine has to be last_applied_log_id.index + 1
sourcefn defensive_half_open_range<'life0, 'async_trait, RB>(
&'life0 self,
range: RB
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where
RB: 'async_trait + RangeBounds<u64> + Clone + Debug + Send,
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn defensive_half_open_range<'life0, 'async_trait, RB>( &'life0 self, range: RB ) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where RB: 'async_trait + RangeBounds<u64> + Clone + Debug + Send, Self: Sync + 'async_trait, 'life0: 'async_trait,
Requires a range must be at least half open: (-oo, n] or [n, +oo); In order to keep logs continuity.
sourcefn defensive_range_hits_logs<'life0, 'life1, 'async_trait, RB>(
&'life0 self,
range: RB,
logs: &'life1 [Entry<C>]
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where
RB: 'async_trait + RangeBounds<u64> + Debug + Send,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn defensive_range_hits_logs<'life0, 'life1, 'async_trait, RB>( &'life0 self, range: RB, logs: &'life1 [Entry<C>] ) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where RB: 'async_trait + RangeBounds<u64> + Debug + Send, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
An range operation such as get or delete has to actually covers some log entries in store.
sourcefn defensive_apply_log_id_gt_last<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
entries: &'life1 [&'life2 Entry<C>]
) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn defensive_apply_log_id_gt_last<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, entries: &'life1 [&'life2 Entry<C>] ) -> Pin<Box<dyn Future<Output = Result<(), StorageError<C::NodeId>>> + Send + 'async_trait>>where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
The log id of the entries to apply has to be greater than the last known one.