pub struct RecoveryRegistry { /* private fields */ }Expand description
Per-runtime collection of recovery handlers driven by the
meshos tick. Cheap to clone (Arc-wrapped); each
MeshOsRuntime exposes one via recovery_registry() and the
loop’s tick handler calls try_run_all after poll_probes
each tick.
Dropped handlers (e.g. the underlying group was dropped) are detected via panic in the closure and removed on the next pass. Handlers MUST be cheap — they run inside the tick handler’s hot path; expensive recovery work should be dispatched off-loop via the action queue.
Implementations§
Source§impl RecoveryRegistry
impl RecoveryRegistry
Sourcepub fn register(&self, handler: RecoveryHandler) -> usize
pub fn register(&self, handler: RecoveryHandler) -> usize
Add a recovery handler. Returns the number of registered handlers after the insert. The handler runs once per tick from the meshos loop.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of registered handlers — used by tests + operator dashboards.
Sourcepub fn try_run_all(&self) -> Vec<u8> ⓘ
pub fn try_run_all(&self) -> Vec<u8> ⓘ
Run every registered handler once. Concatenates the recovered slot indices each handler reports so callers can observe total recovery work this tick.
Handlers run OUTSIDE the registry lock — the registry briefly
takes the lock to swap the handler vector out, runs each
handler in catch_unwind against the local vector, then
re-takes the lock to merge survivors back. This prevents two
hazards:
- Reentrancy deadlock.
parking_lot::Mutexis non- reentrant; a handler that calls back intoregister/len/is_empty(directly or via the meshos tick path) would self-deadlock if the registry lock were held across the invocation. - Concurrent registration. A new handler installed mid-run lands on the now-empty registry vector and runs on the next tick; pre-fix the register lock would have blocked until the long handler chain finished.
A handler that panics is caught with catch_unwind and its
slot is dropped from the registry, mirroring how
poll_probes handles third-party-installed probe panics.
Trait Implementations§
Source§impl Clone for RecoveryRegistry
impl Clone for RecoveryRegistry
Source§fn clone(&self) -> RecoveryRegistry
fn clone(&self) -> RecoveryRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more