pub struct Supervisor { /* private fields */ }Expand description
Owns a pool of workers and supervises them.
Implementations§
Source§impl Supervisor
impl Supervisor
pub fn new(specs: Vec<WorkerSpec>) -> Self
pub fn rate_limit(self, max_restarts: u32, window: Duration) -> Self
pub fn cooldown(self, cooldown: Duration) -> Self
Sourcepub fn register_drain(&mut self, worker_id: &str) -> Option<Arc<Notify>>
pub fn register_drain(&mut self, worker_id: &str) -> Option<Arc<Notify>>
Register a drain signal for a worker and return a handle to trigger it.
Call notify_one() on the returned Arc<Notify> to gracefully restart
that specific worker. Must be called before run().
Sourcepub async fn run(self, drain: DrainController) -> Vec<WorkerInfo>
pub async fn run(self, drain: DrainController) -> Vec<WorkerInfo>
Run the supervision loop until drain begins, then return final snapshots.
Auto Trait Implementations§
impl Freeze for Supervisor
impl RefUnwindSafe for Supervisor
impl Send for Supervisor
impl Sync for Supervisor
impl Unpin for Supervisor
impl UnsafeUnpin for Supervisor
impl UnwindSafe for Supervisor
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