pub trait Controlled:
Clone
+ Debug
+ Send
+ Sync
+ 'static {
type StateInner: RemoteMessage + Clone + Debug + 'static;
// Required methods
fn stall_counter() -> &'static Counter<u64>;
fn id(&self) -> &ResourceId;
fn region(&self) -> &Region;
fn subscribe_to_stream(
&self,
cx: &impl Actor,
subscriber: PortRef<State<Self::StateInner>>,
) -> Result<()>;
fn forward_wait_rank_status(
&self,
cx: &impl Actor,
msg: WaitRankStatus,
) -> Result<()>;
fn poll_states<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
cx: &'life1 (impl 'async_trait + Actor),
supervision_display_name: &'life2 str,
health_state: &'life3 mut HealthState,
) -> Pin<Box<dyn Future<Output = PollResult> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn process_state(
&self,
cx: &impl Actor,
state: State<Self::StateInner>,
health_state: &mut HealthState,
) -> bool;
fn handle_stop_request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
cx: &'life1 (impl 'async_trait + Actor),
supervision_display_name: &'life2 str,
reason: String,
health_state: &'life3 mut HealthState,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn cleanup_stop<'life0, 'life1, 'async_trait>(
&'life0 self,
cx: &'life1 (impl 'async_trait + Actor),
reason: String,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Mesh-specific behavior required by the generic ResourceController.
Each variant of resource mesh (actor, proc) implements this trait to
provide the details that cannot be shared by the generic controller:
the state type carried in resource::State<_>, how to query or stream
that state from the underlying agents, how to stop the resources, and
how to notify observers when the state changes.
Required Associated Types§
Sourcetype StateInner: RemoteMessage + Clone + Debug + 'static
type StateInner: RemoteMessage + Clone + Debug + 'static
Inner payload carried in resource::State<Self::StateInner>.
Required Methods§
Sourcefn stall_counter() -> &'static Counter<u64>
fn stall_counter() -> &'static Counter<u64>
Counter bumped when the supervision loop detects a stall.
Sourcefn id(&self) -> &ResourceId
fn id(&self) -> &ResourceId
The mesh’s resource identifier.
Sourcefn subscribe_to_stream(
&self,
cx: &impl Actor,
subscriber: PortRef<State<Self::StateInner>>,
) -> Result<()>
fn subscribe_to_stream( &self, cx: &impl Actor, subscriber: PortRef<State<Self::StateInner>>, ) -> Result<()>
Subscribe the given port to StreamState<StateInner> updates from
the underlying agents.
Sourcefn forward_wait_rank_status(
&self,
cx: &impl Actor,
msg: WaitRankStatus,
) -> Result<()>
fn forward_wait_rank_status( &self, cx: &impl Actor, msg: WaitRankStatus, ) -> Result<()>
Forward a WaitRankStatus message to the underlying agents.
Sourcefn poll_states<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
cx: &'life1 (impl 'async_trait + Actor),
supervision_display_name: &'life2 str,
health_state: &'life3 mut HealthState,
) -> Pin<Box<dyn Future<Output = PollResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn poll_states<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
cx: &'life1 (impl 'async_trait + Actor),
supervision_display_name: &'life2 str,
health_state: &'life3 mut HealthState,
) -> Pin<Box<dyn Future<Output = PollResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Mesh-specific polling step for the supervision loop. Implementations
may do pre-checks (such as the actor mesh’s proc-aliveness check)
before querying rank states; updates to health_state happen
in-place. supervision_display_name is used for synthesised
supervision events (e.g., when a proc dies).
Sourcefn process_state(
&self,
cx: &impl Actor,
state: State<Self::StateInner>,
health_state: &mut HealthState,
) -> bool
fn process_state( &self, cx: &impl Actor, state: State<Self::StateInner>, health_state: &mut HealthState, ) -> bool
Process a single streamed or polled state. Updates the health state
and notifies owner/subscribers as appropriate. Returns true if a
notification was emitted (used to suppress heartbeats).
Sourcefn handle_stop_request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
cx: &'life1 (impl 'async_trait + Actor),
supervision_display_name: &'life2 str,
reason: String,
health_state: &'life3 mut HealthState,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn handle_stop_request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
cx: &'life1 (impl 'async_trait + Actor),
supervision_display_name: &'life2 str,
reason: String,
health_state: &'life3 mut HealthState,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Perform the mesh-specific stop: issue stop messages to the underlying
agents and, where appropriate, update health_state and notify
subscribers. The caller has already taken the monitor and logged.
Sourcefn cleanup_stop<'life0, 'life1, 'async_trait>(
&'life0 self,
cx: &'life1 (impl 'async_trait + Actor),
reason: String,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cleanup_stop<'life0, 'life1, 'async_trait>(
&'life0 self,
cx: &'life1 (impl 'async_trait + Actor),
reason: String,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stop this mesh on controller cleanup (when Stop was not received
but the actor is shutting down).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
Source§impl Controlled for ProcMeshRef
Controlled implementation for a proc mesh.
impl Controlled for ProcMeshRef
Controlled implementation for a proc mesh.
type StateInner = ProcState
Source§impl<A: Referable> Controlled for ActorMeshRef<A>
Controlled implementation for an actor mesh.
impl<A: Referable> Controlled for ActorMeshRef<A>
Controlled implementation for an actor mesh.