pub struct HealthMonitor<L: LifecycleDaemon> { /* private fields */ }Expand description
Background driver for LifecycleGroup auto-respawn.
Construct via HealthMonitor::spawn; stop via
HealthMonitor::stop.
Implementations§
Source§impl<L: LifecycleDaemon> HealthMonitor<L>
impl<L: LifecycleDaemon> HealthMonitor<L>
Sourcepub fn spawn<F>(
group: Arc<AsyncMutex<Option<LifecycleGroup<L>>>>,
factory: F,
interval: Duration,
) -> Self
pub fn spawn<F>( group: Arc<AsyncMutex<Option<LifecycleGroup<L>>>>, factory: F, interval: Duration, ) -> Self
Spawn a background task that polls group.health()
every interval and calls
group.replace(index, factory(index)) for each replica
reporting unhealthy.
The group is an Arc<AsyncMutex<Option<LifecycleGroup<L>>>>
so the registry’s unregister path can take the group
out without disturbing the monitor — the monitor’s poll
becomes a no-op once the Option is None. Pure-RAII
callers wrap their group with Some(...) at construction.
Sourcepub fn stats(&self) -> &Arc<HealthMonitorStats> ⓘ
pub fn stats(&self) -> &Arc<HealthMonitorStats> ⓘ
Borrow the runtime counters for operator tooling.
Auto Trait Implementations§
impl<L> !Freeze for HealthMonitor<L>
impl<L> !RefUnwindSafe for HealthMonitor<L>
impl<L> Send for HealthMonitor<L>
impl<L> Sync for HealthMonitor<L>
impl<L> Unpin for HealthMonitor<L>where
L: Unpin,
impl<L> UnsafeUnpin for HealthMonitor<L>
impl<L> !UnwindSafe for HealthMonitor<L>
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