pub struct ResourceController<T: Controlled> { /* private fields */ }Expand description
Generic controller for a mesh of resources. Currently instantiated as
ActorMeshController<A> = ResourceController<ActorMeshRef<A>>. All
shared behavior lives here; mesh-specific behavior is delegated through
the Controlled trait.
resource::mesh::Spec<()> and resource::mesh::State<()> (instead of
Spec<T::Spec> / State<T::StateInner>) are used because the
controller participates in the mesh resource protocol only at the
outer layer: callers of GetState on the controller want the
per-rank statuses and the mesh-wide status that resource::mesh::State
already carries, not the inner T::StateInner payload (which is
available rank-by-rank via the resource::State<T::StateInner> stream).
The unit type is the explicit “no extra payload” choice.
Trait Implementations§
Source§impl<T: Controlled> Actor for ResourceController<T>
impl<T: Controlled> Actor for ResourceController<T>
Source§fn init<'life0, 'life1, 'async_trait>(
&'life0 mut self,
this: &'life1 Instance<Self>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn init<'life0, 'life1, 'async_trait>(
&'life0 mut self,
this: &'life1 Instance<Self>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn cleanup<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
this: &'life1 Instance<Self>,
_err: Option<&'life2 ActorError>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn cleanup<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
this: &'life1 Instance<Self>,
_err: Option<&'life2 ActorError>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn handle_undeliverable_message<'life0, 'life1, 'async_trait>(
&'life0 mut self,
cx: &'life1 Instance<Self>,
envelope: Undeliverable<MessageEnvelope>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_undeliverable_message<'life0, 'life1, 'async_trait>(
&'life0 mut self,
cx: &'life1 Instance<Self>,
envelope: Undeliverable<MessageEnvelope>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn handle_stop<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
this: &'life1 Instance<Self>,
mode: StopMode,
reason: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn handle_stop<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
this: &'life1 Instance<Self>,
mode: StopMode,
reason: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Source§fn spawn(self, cx: &impl Actor) -> Result<ActorHandle<Self>, Error>
fn spawn(self, cx: &impl Actor) -> Result<ActorHandle<Self>, Error>
Instance).
The spawned actor will be supervised by the parent (spawning) actor.Source§fn spawn_with_name(
self,
cx: &impl Actor,
name: &str,
) -> Result<ActorHandle<Self>, Error>
fn spawn_with_name( self, cx: &impl Actor, name: &str, ) -> Result<ActorHandle<Self>, Error>
spawn, but the child gets name in its ActorAddr.Source§fn spawn_detached(self) -> Result<ActorHandle<Self>, Error>
fn spawn_detached(self) -> Result<ActorHandle<Self>, Error>
Source§fn spawn_server_task<F>(future: F) -> JoinHandle<<F as Future>::Output>
fn spawn_server_task<F>(future: F) -> JoinHandle<<F as Future>::Output>
Source§fn handle_supervision_event<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
_this: &'life1 Instance<Self>,
event: &'life2 ActorSupervisionEvent,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn handle_supervision_event<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
_this: &'life1 Instance<Self>,
event: &'life2 ActorSupervisionEvent,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Source§fn display_name(&self) -> Option<String>
fn display_name(&self) -> Option<String>
Source§impl<T: Controlled + Named> Binds<ResourceController<T>> for ResourceController<T>where
Subscribe: RemoteMessage,
ResourceController<T>: Handler<Subscribe> + Handler<Unsubscribe> + Handler<GetSubscriberCount> + Handler<CheckState> + Handler<WaitRankStatus> + Handler<CreateOrUpdate<Spec<()>>> + Handler<GetState<State<()>>> + Handler<Stop> + Handler<State<T::StateInner>>,
Unsubscribe: RemoteMessage,
GetSubscriberCount: RemoteMessage,
CheckState: RemoteMessage,
WaitRankStatus: RemoteMessage,
CreateOrUpdate<Spec<()>>: RemoteMessage,
GetState<State<()>>: RemoteMessage,
Stop: RemoteMessage,
State<T::StateInner>: RemoteMessage,
impl<T: Controlled + Named> Binds<ResourceController<T>> for ResourceController<T>where
Subscribe: RemoteMessage,
ResourceController<T>: Handler<Subscribe> + Handler<Unsubscribe> + Handler<GetSubscriberCount> + Handler<CheckState> + Handler<WaitRankStatus> + Handler<CreateOrUpdate<Spec<()>>> + Handler<GetState<State<()>>> + Handler<Stop> + Handler<State<T::StateInner>>,
Unsubscribe: RemoteMessage,
GetSubscriberCount: RemoteMessage,
CheckState: RemoteMessage,
WaitRankStatus: RemoteMessage,
CreateOrUpdate<Spec<()>>: RemoteMessage,
GetState<State<()>>: RemoteMessage,
Stop: RemoteMessage,
State<T::StateInner>: RemoteMessage,
Source§fn bind(ports: &HandlerPorts<Self>)
fn bind(ports: &HandlerPorts<Self>)
Source§impl<T: Controlled> Debug for ResourceController<T>
impl<T: Controlled> Debug for ResourceController<T>
Source§impl<T: Controlled> Handler<CheckState> for ResourceController<T>
impl<T: Controlled> Handler<CheckState> for ResourceController<T>
Source§impl<T: Controlled> Handler<CreateOrUpdate<Spec<()>>> for ResourceController<T>
impl<T: Controlled> Handler<CreateOrUpdate<Spec<()>>> for ResourceController<T>
Source§fn handle<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_cx: &'life1 Context<'_, Self>,
_message: CreateOrUpdate<Spec<()>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_cx: &'life1 Context<'_, Self>,
_message: CreateOrUpdate<Spec<()>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Currently a no-op as there’s nothing to create or update, but allows
ResourceController to implement the resource mesh behavior.
Source§impl<T: Controlled> Handler<GetState<State<()>>> for ResourceController<T>
impl<T: Controlled> Handler<GetState<State<()>>> for ResourceController<T>
Source§impl<T: Controlled> Handler<GetSubscriberCount> for ResourceController<T>
impl<T: Controlled> Handler<GetSubscriberCount> for ResourceController<T>
Source§impl<T: Controlled> Handler<State<<T as Controlled>::StateInner>> for ResourceController<T>
impl<T: Controlled> Handler<State<<T as Controlled>::StateInner>> for ResourceController<T>
Source§impl<T: Controlled> Handler<Stop> for ResourceController<T>
impl<T: Controlled> Handler<Stop> for ResourceController<T>
Source§impl<T: Controlled> Handler<Subscribe> for ResourceController<T>
impl<T: Controlled> Handler<Subscribe> for ResourceController<T>
Source§impl<T: Controlled> Handler<Unsubscribe> for ResourceController<T>
impl<T: Controlled> Handler<Unsubscribe> for ResourceController<T>
Source§impl<T: Controlled> Handler<WaitRankStatus> for ResourceController<T>
impl<T: Controlled> Handler<WaitRankStatus> for ResourceController<T>
Source§fn handle<'life0, 'life1, 'async_trait>(
&'life0 mut self,
cx: &'life1 Context<'_, Self>,
msg: WaitRankStatus,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle<'life0, 'life1, 'async_trait>(
&'life0 mut self,
cx: &'life1 Context<'_, Self>,
msg: WaitRankStatus,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Forward WaitRankStatus to the underlying agents. Each agent replies directly to the caller’s accumulator port when its resource reaches the requested status.
Source§impl<T: Controlled> Mesh for ResourceController<T>
impl<T: Controlled> Mesh for ResourceController<T>
Source§impl<T: Controlled + Named> Named for ResourceController<T>
impl<T: Controlled + Named> Named for ResourceController<T>
Source§fn typename() -> &'static str
fn typename() -> &'static str
Source§fn typehash() -> u64
fn typehash() -> u64
Source§fn typeid() -> TypeId
fn typeid() -> TypeId
Source§fn port() -> u64
fn port() -> u64
impl<T: Controlled + Named> Accepts<CheckState> for ResourceController<T>where
CheckState: RemoteMessage,
impl<T: Controlled + Named> Accepts<CreateOrUpdate<Spec<()>>> for ResourceController<T>
impl<T: Controlled + Named> Accepts<GetState<State<()>>> for ResourceController<T>
impl<T: Controlled + Named> Accepts<GetSubscriberCount> for ResourceController<T>where
GetSubscriberCount: RemoteMessage,
impl<T: Controlled + Named> Accepts<IntrospectMessage> for ResourceController<T>
impl<T: Controlled + Named> Accepts<State<<T as Controlled>::StateInner>> for ResourceController<T>
impl<T: Controlled + Named> Accepts<Stop> for ResourceController<T>where
Stop: RemoteMessage,
impl<T: Controlled + Named> Accepts<Subscribe> for ResourceController<T>where
Subscribe: RemoteMessage,
impl<T: Controlled + Named> Accepts<Unsubscribe> for ResourceController<T>where
Unsubscribe: RemoteMessage,
impl<T: Controlled + Named> Accepts<WaitRankStatus> for ResourceController<T>where
WaitRankStatus: RemoteMessage,
impl<T: Controlled + Named> Referable for ResourceController<T>
impl<T: Controlled + Named> RemoteHandles<CheckState> for ResourceController<T>where
CheckState: RemoteMessage,
impl<T: Controlled + Named> RemoteHandles<CreateOrUpdate<Spec<()>>> for ResourceController<T>
impl<T: Controlled + Named> RemoteHandles<GetState<State<()>>> for ResourceController<T>
impl<T: Controlled + Named> RemoteHandles<GetSubscriberCount> for ResourceController<T>where
GetSubscriberCount: RemoteMessage,
impl<T: Controlled + Named> RemoteHandles<IntrospectMessage> for ResourceController<T>
impl<T: Controlled + Named> RemoteHandles<State<<T as Controlled>::StateInner>> for ResourceController<T>
impl<T: Controlled + Named> RemoteHandles<Stop> for ResourceController<T>where
Stop: RemoteMessage,
impl<T: Controlled + Named> RemoteHandles<Subscribe> for ResourceController<T>where
Subscribe: RemoteMessage,
impl<T: Controlled + Named> RemoteHandles<Unsubscribe> for ResourceController<T>where
Unsubscribe: RemoteMessage,
impl<T: Controlled + Named> RemoteHandles<WaitRankStatus> for ResourceController<T>where
WaitRankStatus: RemoteMessage,
Auto Trait Implementations§
impl<T> !Freeze for ResourceController<T>
impl<T> RefUnwindSafe for ResourceController<T>where
T: RefUnwindSafe,
impl<T> Send for ResourceController<T>
impl<T> Sync for ResourceController<T>
impl<T> Unpin for ResourceController<T>where
T: Unpin,
impl<T> UnsafeUnpin for ResourceController<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ResourceController<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<A, M> Handler<IndexedErasedUnbound<M>> for A
impl<A, M> Handler<IndexedErasedUnbound<M>> for A
Source§impl<A> Handler<IntrospectMessage> for Awhere
A: Actor,
impl<A> Handler<IntrospectMessage> for Awhere
A: Actor,
Source§impl<A> Handler<Undeliverable<MessageEnvelope>> for Awhere
A: Actor,
impl<A> Handler<Undeliverable<MessageEnvelope>> for Awhere
A: Actor,
Source§fn handle<'life0, 'life1, 'async_trait>(
&'life0 mut self,
cx: &'life1 Context<'_, A>,
message: Undeliverable<MessageEnvelope>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
A: 'async_trait,
fn handle<'life0, 'life1, 'async_trait>(
&'life0 mut self,
cx: &'life1 Context<'_, A>,
message: Undeliverable<MessageEnvelope>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
A: 'async_trait,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].