Struct bastion::supervisor::RestartStrategy [−][src]
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
impl RestartStrategy
[src]
pub fn new(
restart_policy: RestartPolicy,
strategy: ActorRestartStrategy
) -> Self
[src]
restart_policy: RestartPolicy,
strategy: ActorRestartStrategy
) -> Self
Creates a new instance of RestartStrategy.
Arguments
-
restart_policy
- Defines a restart policy to use for failed actor:RestartStrategy::Always
would restart the failed actor each time as it fails.RestartStrategy::Never
would not restart the failed actor and remove it from tracking.RestartStrategy::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);
pub fn restart_policy(&self) -> RestartPolicy
[src]
Returns the acceptable count of retries for the failed actor.
The None
value means the amount of attempts is unlimited.
pub fn strategy(&self) -> ActorRestartStrategy
[src]
Returns the current strategy for restarting failed actors.
pub fn with_restart_policy(
mut self: Self,
restart_policy: RestartPolicy
) -> Self
[src]
mut self: Self,
restart_policy: RestartPolicy
) -> Self
Sets the limit of attempts for restoring failed actors.
pub fn with_actor_restart_strategy(
mut self: Self,
strategy: ActorRestartStrategy
) -> Self
[src]
mut self: Self,
strategy: ActorRestartStrategy
) -> Self
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
impl Clone for RestartStrategy
[src]
fn clone(&self) -> RestartStrategy
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for RestartStrategy
[src]
impl Default for RestartStrategy
[src]
impl PartialEq<RestartStrategy> for RestartStrategy
[src]
fn eq(&self, other: &RestartStrategy) -> bool
[src]
fn ne(&self, other: &RestartStrategy) -> bool
[src]
impl StructuralPartialEq for RestartStrategy
[src]
Auto Trait Implementations
impl RefUnwindSafe for RestartStrategy
[src]
impl Send for RestartStrategy
[src]
impl Sync for RestartStrategy
[src]
impl Unpin for RestartStrategy
[src]
impl UnwindSafe for RestartStrategy
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AsAny for T where
T: Any,
[src]
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Message for T where
T: Any + Send + Sync + Debug,
[src]
T: Any + Send + Sync + Debug,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> State for T where
T: Send + Sync + 'static,
[src]
T: Send + Sync + 'static,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,