pub struct ServiceHost { /* private fields */ }Expand description
Runs Services until told to stop.
The rules it schedules by: Every counts from launch
to launch, a service never overlaps itself, a failure doubles the wait
per failure in a row (up to 2^5, reset by a success),
DailyUtc runs once a day at its UTC time (a
failed run waits for the next day), due work starts on the next tick or
wake-up, and every launch ends with exactly one ServiceEvent::Ended.
Implementations§
Source§impl ServiceHost
impl ServiceHost
Sourcepub fn max_concurrent(self, limit: usize) -> Self
pub fn max_concurrent(self, limit: usize) -> Self
At most limit Schedule::Every runs at once.
Sourcepub fn grace(self, grace: Duration) -> Self
pub fn grace(self, grace: Duration) -> Self
How long a stopping host waits for runs to end before aborting them.
pub fn gate(self, gate: Arc<dyn ServiceGate>) -> Self
pub fn observer(self, observer: Arc<dyn ServiceObserver>) -> Self
pub fn service(self, service: Arc<dyn Service>) -> Self
pub fn waker(&self) -> ServiceWaker
Sourcepub async fn run(self, shutdown: CancellationToken)
pub async fn run(self, shutdown: CancellationToken)
Run until shutdown is cancelled, then stop launching, drain for the
grace period, abort what is left and call each service’s stop.
Auto Trait Implementations§
impl !RefUnwindSafe for ServiceHost
impl !UnwindSafe for ServiceHost
impl Forget for ServiceHost
impl Freeze for ServiceHost
impl Move for ServiceHost
impl Send for ServiceHost
impl Sync for ServiceHost
impl Unpin for ServiceHost
impl UnsafeUnpin for ServiceHost
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