pub struct RestartStrategy { /* private fields */ }Expand description
Restart strategy for a supervisor.
Defaults to one-to-one mode (only restart the failed process) and a restart intensity of 1 over a period of 5 seconds.
§Restarts and permanent failure
A supervisor will allow up to intensity process restarts, across all child processes, over a given period. When
this limit is exceeded, the supervisor will stop all child processes and return an error itself, indicating that the
supervisor has failed overall.
Permanent failure bubbles up to the parent supervisor, until reaching the root supervisor. Once permanent failure reaches the root supervisor, and the root supervisor exceeds its own restart limits, the root supervisor will fail and cease execution.
Implementations§
Source§impl RestartStrategy
impl RestartStrategy
Sourcepub const fn new(mode: RestartMode, intensity: usize, period: Duration) -> Self
pub const fn new(mode: RestartMode, intensity: usize, period: Duration) -> Self
Creates a new RestartStrategy with the given mode, intensity, and period.
Sourcepub fn one_to_one() -> Self
pub fn one_to_one() -> Self
Creates a new RestartStrategy with the one-to-one restart mode, and the default intensity/period.
Sourcepub fn one_for_all() -> Self
pub fn one_for_all() -> Self
Creates a new RestartStrategy with the one-for-all restart mode, and the default intensity/period.
Sourcepub const fn with_intensity_and_period(
self,
intensity: usize,
period: Duration,
) -> Self
pub const fn with_intensity_and_period( self, intensity: usize, period: Duration, ) -> Self
Sets the restart intensity and period for the strategy.
Trait Implementations§
Source§impl Clone for RestartStrategy
impl Clone for RestartStrategy
Source§fn clone(&self) -> RestartStrategy
fn clone(&self) -> RestartStrategy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for RestartStrategy
impl Default for RestartStrategy
impl Copy for RestartStrategy
Auto Trait Implementations§
impl Freeze for RestartStrategy
impl RefUnwindSafe for RestartStrategy
impl Send for RestartStrategy
impl Sync for RestartStrategy
impl Unpin for RestartStrategy
impl UnwindSafe for RestartStrategy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Track for T
impl<T> Track for T
§fn track_allocations(self, token: AllocationGroupToken) -> Tracked<Self>
fn track_allocations(self, token: AllocationGroupToken) -> Tracked<Self>
Tracked wrapper. Read more§fn in_current_allocation_group(self) -> Tracked<Self>
fn in_current_allocation_group(self) -> Tracked<Self>
Tracked wrapper. Read more