Skip to main content

BackingRecovery

Trait BackingRecovery 

Source
pub trait BackingRecovery:
    Send
    + Sync
    + Sized {
    type Journal: Mutable;

    // Required methods
    fn bounds(&self) -> Range<u64> ⓘ;
    fn read(
        &self,
        position: u64,
    ) -> impl Future<Output = Result<<Self::Journal as Contiguous>::Item, JournalError>> + Send;
    fn reset(
        self,
        size: u64,
    ) -> impl Future<Output = Result<Self, JournalError>> + Send;
    fn finish(
        self,
        size: u64,
    ) -> impl Future<Output = Result<Self::Journal, JournalError>> + Send;

    // Provided method
    fn last_matching<P>(
        &self,
        ceiling: u64,
        predicate: P,
    ) -> impl Future<Output = Result<u64, JournalError>> + Send
       where P: FnMut(&<Self::Journal as Contiguous>::Item) -> bool + Send { ... }
}
Expand description

A journal under initialization, with read access before its retained end is finalized.

Finishing consumes this owner. A live journal cannot regain recovery access. Opening may repair torn storage, but selecting a prefix does not itself discard journal history.

Required Associated Types§

Source

type Journal: Mutable

The live journal produced after recovery finishes.

Required Methods§

Source

fn bounds(&self) -> Range<u64> ⓘ

Available item positions, including the retained pruning boundary.

Source

fn read( &self, position: u64, ) -> impl Future<Output = Result<<Self::Journal as Contiguous>::Item, JournalError>> + Send

Read a retained item for initialization validation.

Source

fn reset( self, size: u64, ) -> impl Future<Output = Result<Self, JournalError>> + Send

Discard stored items and establish an empty journal at size during initialization.

Source

fn finish( self, size: u64, ) -> impl Future<Output = Result<Self::Journal, JournalError>> + Send

Durably retain at most size items and publish the live journal.

Provided Methods§

Source

fn last_matching<P>( &self, ceiling: u64, predicate: P, ) -> impl Future<Output = Result<u64, JournalError>> + Send
where P: FnMut(&<Self::Journal as Contiguous>::Item) -> bool + Send,

Select the latest retained item satisfying predicate below an exclusive ceiling.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<E: Context, A: CodecFixedShared> BackingRecovery for commonware_storage::journal::contiguous::fixed::Recovery<E, A>

Available on neither commonware_stability_BETA nor commonware_stability_DELTA nor commonware_stability_EPSILON nor commonware_stability_GAMMA nor commonware_stability_RESERVED.
Source§

impl<E: Context, V: CodecShared> BackingRecovery for commonware_storage::journal::contiguous::variable::Recovery<E, V>

Available on neither commonware_stability_BETA nor commonware_stability_DELTA nor commonware_stability_EPSILON nor commonware_stability_GAMMA nor commonware_stability_RESERVED.