pub struct BookRecovery<E> {
pub cancellation: CancellationToken,
pub outcome: Sender<BookRecoveryOutcome<E>>,
pub gate: SnapshotGate,
}Expand description
One recovery episode, retained across reconnects until a snapshot or terminal failure.
Fields§
§cancellation: CancellationToken§outcome: Sender<BookRecoveryOutcome<E>>§gate: SnapshotGateImplementations§
Source§impl<E: Clone> BookRecovery<E>
impl<E: Clone> BookRecovery<E>
Sourcepub fn begin_replacement(&self) -> bool
pub fn begin_replacement(&self) -> bool
Closes snapshot acceptance, returning false if this episode has already ended.
Sourcepub fn is_accepted(&self) -> bool
pub fn is_accepted(&self) -> bool
Returns whether the adapter has accepted a snapshot for this episode.
Source§impl<E: Clone + Error> BookRecovery<E>
impl<E: Clone + Error> BookRecovery<E>
Sourcepub async fn run<F, Fut>(
&self,
snapshot_timeout: Duration,
replace: F,
should_retry: impl Fn(&E) -> bool,
create_error: impl Fn(String) -> E,
timeout_error: impl Fn() -> E,
) -> Result<(), E>
pub async fn run<F, Fut>( &self, snapshot_timeout: Duration, replace: F, should_retry: impl Fn(&E) -> bool, create_error: impl Fn(String) -> E, timeout_error: impl Fn() -> E, ) -> Result<(), E>
Replaces the subscription and waits for a snapshot, with bounded retries.
Each send receives a child cancellation token. Dropping an attempt cancels queued transport work. Keeping this future alive across reconnects preserves the attempt limit and total elapsed-time budget. A zero snapshot timeout disables only the individual snapshot deadline.
§Errors
Returns the terminal adapter error, cancellation, or exhausted retry budget.
Trait Implementations§
Source§impl<E: Debug> Debug for BookRecovery<E>
impl<E: Debug> Debug for BookRecovery<E>
Auto Trait Implementations§
impl<E> !RefUnwindSafe for BookRecovery<E>
impl<E> !UnwindSafe for BookRecovery<E>
impl<E> Freeze for BookRecovery<E>where
Sender<BookRecoveryOutcome<E>>: Freeze,
impl<E> Send for BookRecovery<E>where
Sender<BookRecoveryOutcome<E>>: Send,
impl<E> Sync for BookRecovery<E>where
Sender<BookRecoveryOutcome<E>>: Sync,
impl<E> Unpin for BookRecovery<E>where
Sender<BookRecoveryOutcome<E>>: Unpin,
impl<E> UnsafeUnpin for BookRecovery<E>where
Sender<BookRecoveryOutcome<E>>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 more