Struct bastion::supervisor::RestartStrategy [−][src]
pub struct RestartStrategy { /* fields omitted */ }
Expand description
The strategy for a supervisor which is used for restoring failed actors. It it fails after N attempts, the supervisor will remove an actor.
The default strategy used is ActorRestartStrategy::Immediate
with the RestartPolicy::Always
restart policy.
Implementations
Creates a new instance of RestartStrategy.
Arguments
-
restart_policy
- Defines a restart policy to use for failed actor:RestartPolicy::Always
would restart the failed actor each time as it fails.RestartPolicy::Never
would not restart the failed actor and remove it from tracking.RestartPolicy::Tries
would restart the failed actor a limited amount of times. If can’t be started, then will remove it from tracking.
-
strategy
- The strategy to use:ActorRestartStrategy::Immediate
would restart the failed actor as soon as possible.ActorRestartStrategy::LinearBackOff
would restart the failed actor with the delay increasing linearly.ActorRestartStrategy::ExponentialBackOff
would restart the failed actor with the delay, multiplied by given coefficient.
Example
let actor_restart_strategy = ActorRestartStrategy::LinearBackOff {
timeout: Duration::from_secs(5)
};
let restart_strategy = RestartStrategy::default()
.with_actor_restart_strategy(actor_restart_strategy);
Returns the acceptable count of retries for the failed actor.
The None
value means the amount of attempts is unlimited.
Returns the current strategy for restarting failed actors.
Sets the limit of attempts for restoring failed actors.
Sets the actor restart strategy the supervisor should use of its supervised children groups or supervisors dies to restore in the correct state.
Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for RestartStrategy
impl Send for RestartStrategy
impl Sync for RestartStrategy
impl Unpin for RestartStrategy
impl UnwindSafe for RestartStrategy
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more