pub struct RestartPolicy {
pub mode: RestartMode,
pub restart_budget: u32,
pub restart_window: Duration,
pub backoff: Duration,
pub jitter: Duration,
pub shutdown_timeout: Duration,
}Expand description
Bounded restart and shutdown behavior for one service.
Fields§
§mode: RestartModeAutomatic restart condition.
restart_budget: u32Maximum restart attempts inside restart_window.
restart_window: DurationSliding time window applied to the restart budget.
backoff: DurationBase delay before a restart.
jitter: DurationMaximum random delay added to the base backoff.
shutdown_timeout: DurationCooperative shutdown deadline.
Implementations§
Source§impl RestartPolicy
impl RestartPolicy
Sourcepub fn bounded(
restart_budget: u32,
restart_window: Duration,
) -> SupervisorResult<Self>
pub fn bounded( restart_budget: u32, restart_window: Duration, ) -> SupervisorResult<Self>
Creates the default bounded on-failure policy.
Sourcepub fn with_backoff(self, backoff: Duration, jitter: Duration) -> Self
pub fn with_backoff(self, backoff: Duration, jitter: Duration) -> Self
Replaces backoff and jitter bounds.
Sourcepub fn with_shutdown_timeout(self, shutdown_timeout: Duration) -> Self
pub fn with_shutdown_timeout(self, shutdown_timeout: Duration) -> Self
Replaces the cooperative shutdown deadline.
Sourcepub fn validate(&self) -> SupervisorResult<()>
pub fn validate(&self) -> SupervisorResult<()>
Validates policy bounds.
Trait Implementations§
Source§impl Clone for RestartPolicy
impl Clone for RestartPolicy
Source§fn clone(&self) -> RestartPolicy
fn clone(&self) -> RestartPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for RestartPolicy
Source§impl Debug for RestartPolicy
impl Debug for RestartPolicy
Source§impl Default for RestartPolicy
impl Default for RestartPolicy
impl Eq for RestartPolicy
Source§impl PartialEq for RestartPolicy
impl PartialEq for RestartPolicy
impl StructuralPartialEq for RestartPolicy
Auto Trait Implementations§
impl Freeze for RestartPolicy
impl RefUnwindSafe for RestartPolicy
impl Send for RestartPolicy
impl Sync for RestartPolicy
impl Unpin for RestartPolicy
impl UnsafeUnpin for RestartPolicy
impl UnwindSafe for RestartPolicy
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