pub type Recovery<B> = Writer<B, Recovering>;Expand description
Exclusive initialization owner for selecting and durably publishing a retained prefix.
All previous writers and disk-backed readers must close before recovery opens. Only recovery may shorten the retained logical prefix.
Aliased Type§
pub struct Recovery<B> { /* private fields */ }Implementations§
Source§impl<B: Blob> Recovery<B>
impl<B: Blob> Recovery<B>
Sourcepub async fn open(
blob: B,
original_blob_size: u64,
capacity: usize,
cache_ref: CacheRef,
) -> Result<Self, Error>
pub async fn open( blob: B, original_blob_size: u64, capacity: usize, cache_ref: CacheRef, ) -> Result<Self, Error>
Open blob for initialization repair.
blob must already hold original_blob_size physical bytes. Reads are cached through
cache_ref and appends stage in a write buffer of capacity capacity. Trims any invalid
tail so the blob ends at a checksum-validated page. Earlier pages are not scanned.
Before appending, the tail-page contents must be durable: either pass a blob with no writes since it was opened or call Self::sync. Until then, recovery may read or truncate the blob. The discovered checksum slot seeds durable-slot tracking, so appending over a still-volatile tail can overwrite the only durable slot.
Sourcepub async fn truncate(self, size: u64) -> Result<Self, Error>
pub async fn truncate(self, size: u64) -> Result<Self, Error>
Durably retain at most size logical bytes.
A size above the current length leaves the length unchanged. Pending writes are synchronized even when the length does not change.
Outstanding replays that cover the shortened or rewritten suffix are invalidated and must not be consumed afterward.