pub struct RecoveryObserver {
pub observations: UnboundedSender<RecoveryObservation>,
pub gate: Arc<RecoveryGate>,
}Expand description
Reports session activity to the recovery coordinator.
Reporting is a queued hand-off, never a round trip: the caller is often a UI event loop, and a copy decision must never hold that loop up. The queue is unbounded so an observation is never dropped, which matters because the idle observation that ends a turn is the one that makes a copy due. Queue depth stays small in practice: the coordinator only folds an observation into per-session policy state and hands the copy itself to another task. It does pause while it records a failed copy, and the queue is what absorbs that pause instead of the caller.
A caller that must know no copy can start uses RecoveryObserver::reserve
rather than the queue: the reservation blocks a copy from starting whether
or not queued observations have been read yet.
Fields§
§observations: UnboundedSender<RecoveryObservation>§gate: Arc<RecoveryGate>Implementations§
Source§impl RecoveryObserver
impl RecoveryObserver
Sourcepub fn observe(&self, observation: RecoveryObservation)
pub fn observe(&self, observation: RecoveryObservation)
Queues one observation for the coordinator. Returns as soon as the observation is queued; a stopped coordinator makes this a no-op.
pub fn is_busy(&self, session_id: &str) -> bool
Sourcepub fn reserve(&self, session_id: &str) -> RecoveryReservation
pub fn reserve(&self, session_id: &str) -> RecoveryReservation
Holds off any recovery copy for this session until the returned reservation is dropped. This, not the observation queue, is what a lifecycle operation relies on: queued observations may still be unread, and the coordinator refuses to start a copy for a reserved session whenever it reads them.
Sourcepub fn cancel_busy(&self, session_id: &str)
pub fn cancel_busy(&self, session_id: &str)
Asks an in-flight recovery copy for this session to stop. A foreground lifecycle operation calls this after reserving so it preempts the copy instead of waiting behind it.
pub async fn wait_idle(&self, session_id: &str)
Trait Implementations§
Source§impl Clone for RecoveryObserver
impl Clone for RecoveryObserver
Source§fn clone(&self) -> RecoveryObserver
fn clone(&self) -> RecoveryObserver
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for RecoveryObserver
impl !UnwindSafe for RecoveryObserver
impl Freeze for RecoveryObserver
impl Send for RecoveryObserver
impl Sync for RecoveryObserver
impl Unpin for RecoveryObserver
impl UnsafeUnpin for RecoveryObserver
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> 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> ⓘ
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> ⓘ
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