pub struct Supervisor<B: Behavior, C: Behavior<Ph = Never, Addr = B::Addr>> { /* private fields */ }Implementations§
Source§impl<B, C> Supervisor<B, C>
impl<B, C> Supervisor<B, C>
Sourcepub fn new(
inner: B,
nonces: fn(usize) -> <B::Addr as Address>::Nonce,
count: usize,
build: fn(usize) -> Option<C>,
strategy: Strategy,
policy: RestartPolicy,
max_restarts: u32,
window: Duration,
) -> Result<Self, FleetError<<B::Addr as Address>::Nonce>>
pub fn new( inner: B, nonces: fn(usize) -> <B::Addr as Address>::Nonce, count: usize, build: fn(usize) -> Option<C>, strategy: Strategy, policy: RestartPolicy, max_restarts: u32, window: Duration, ) -> Result<Self, FleetError<<B::Addr as Address>::Nonce>>
Construct the concrete supervisor behavior hidden by Compose.
Invalid configured routes reject construction before a behavior exists.
§Errors
Returns the first typed topology rejection.
pub fn with_strategy(self, strategy: Strategy) -> Self
pub fn with_policy(self, policy: RestartPolicy) -> Self
pub fn with_budget(self, max: u32, window: Duration) -> Self
Sourcepub fn with_failure_reaction(
self,
reaction: SupervisionFailureReaction<B>,
) -> Self
pub fn with_failure_reaction( self, reaction: SupervisionFailureReaction<B>, ) -> Self
Replace the pure reaction used for typed supervision failures.
Sourcepub fn is_alive(
&self,
nonce: <B::Addr as Address>::Nonce,
) -> Result<bool, SupervisorError<Infallible, <B::Addr as Address>::Nonce>>
pub fn is_alive( &self, nonce: <B::Addr as Address>::Nonce, ) -> Result<bool, SupervisorError<Infallible, <B::Addr as Address>::Nonce>>
Report whether a known supervised proxy is alive.
§Errors
Returns the unknown nonce when it is not part of this topology.
pub fn child_count(&self) -> usize
pub fn restarts_in_window(&self) -> usize
Trait Implementations§
Source§impl<B, C, A, Ph, Sends> Behavior for Supervisor<B, C>where
A: Address,
Sends: SendAlgebra,
B: Behavior<Addr = A, Ph = Ph, Sends = Sends, Birth = Births<C>>,
B::Event: RouteInput<ChildStopped<A>> + RouteInput<CreationResolved<A::Nonce>> + RouteInput<WorkerCreationResolved<A::Nonce>>,
A::Nonce: From<u64>,
C: Behavior<Ph = Never, Addr = B::Addr>,
impl<B, C, A, Ph, Sends> Behavior for Supervisor<B, C>where
A: Address,
Sends: SendAlgebra,
B: Behavior<Addr = A, Ph = Ph, Sends = Sends, Birth = Births<C>>,
B::Event: RouteInput<ChildStopped<A>> + RouteInput<CreationResolved<A::Nonce>> + RouteInput<WorkerCreationResolved<A::Nonce>>,
A::Nonce: From<u64>,
C: Behavior<Ph = Never, Addr = B::Addr>,
type Addr = A
type Msg = <B as Behavior>::Msg
type Event = SupervisionEvent<<B as Behavior>::Event>
type Sends = SupervisorSends<A, Sends, C>
type Ph = Ph
type Error = SupervisorError<<B as Behavior>::Error, <A as Address>::Nonce>
type Birth = Births<Proxy<C>>
Source§fn init(
&mut self,
_: InitializationTurn,
) -> Result<Actions<<B as Behavior>::Addr, <B as Behavior>::Ph, SupervisorSends<<B as Behavior>::Addr, <B as Behavior>::Sends, C>, Births<Proxy<C>>>, Self::Error>
fn init( &mut self, _: InitializationTurn, ) -> Result<Actions<<B as Behavior>::Addr, <B as Behavior>::Ph, SupervisorSends<<B as Behavior>::Addr, <B as Behavior>::Sends, C>, Births<Proxy<C>>>, Self::Error>
Produce initialization actions before the first event is accepted. Read more
Source§fn transition(
&mut self,
_: ActiveTurn,
event: Self::Event,
) -> Result<Actions<<B as Behavior>::Addr, <B as Behavior>::Ph, SupervisorSends<<B as Behavior>::Addr, <B as Behavior>::Sends, C>, Births<Proxy<C>>>, Self::Error>
fn transition( &mut self, _: ActiveTurn, event: Self::Event, ) -> Result<Actions<<B as Behavior>::Addr, <B as Behavior>::Ph, SupervisorSends<<B as Behavior>::Addr, <B as Behavior>::Sends, C>, Births<Proxy<C>>>, Self::Error>
Fold exactly one event into explicit actions and the next behavior. Read more
Source§impl<B, C> BehaviorBase for Supervisor<B, C>
impl<B, C> BehaviorBase for Supervisor<B, C>
Source§impl<B, C> StashStatus for Supervisor<B, C>
impl<B, C> StashStatus for Supervisor<B, C>
fn stashed_messages(&self) -> usize
Auto Trait Implementations§
impl<B, C> Freeze for Supervisor<B, C>where
B: Freeze,
impl<B, C> RefUnwindSafe for Supervisor<B, C>
impl<B, C> Send for Supervisor<B, C>
impl<B, C> Sync for Supervisor<B, C>
impl<B, C> Unpin for Supervisor<B, C>
impl<B, C> UnsafeUnpin for Supervisor<B, C>where
B: UnsafeUnpin,
impl<B, C> UnwindSafe for Supervisor<B, C>
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