pub struct MeshAdminAgent { /* private fields */ }Expand description
Actor that serves a mesh-level admin HTTP endpoint.
MeshAdminAgent is the mesh-wide aggregation point for
introspection: it holds hyperactor_reference::ActorRef<HostAgent> handles for each
host, and answers admin queries by forwarding targeted requests to
the appropriate host agent and assembling a uniform NodePayload
response for the client.
The agent also exposes an HTTP server (spawned from init) and
supports reference-based navigation (GET /v1/{reference}) by
resolving opaque reference strings into typed NodeProperties
plus child references.
Implementations§
Source§impl MeshAdminAgent
impl MeshAdminAgent
Sourcepub fn new(
hosts: Vec<(String, ActorRef<HostAgent>)>,
root_client_actor_id: Option<ActorId>,
admin_addr: Option<SocketAddr>,
) -> Self
pub fn new( hosts: Vec<(String, ActorRef<HostAgent>)>, root_client_actor_id: Option<ActorId>, admin_addr: Option<SocketAddr>, ) -> Self
Construct a MeshAdminAgent from a list of (host_addr, host_agent_ref) pairs and an optional root client ActorId.
Builds both:
hosts: the forward map used to route admin queries to the correctHostAgent, andhost_agents_by_actor_id: a reverse index used during reference resolution to recognize host-agentActorIds and resolve them asNodeProperties::Hostrather than as generic actors.
When root_client_actor_id is Some, the root client appears
as a first-class child of the root node in the introspection
tree.
The HTTP listen address is initialized to None and populated
during init() after the server socket is bound.
Trait Implementations§
Source§impl Actor for MeshAdminAgent
impl Actor for MeshAdminAgent
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,
Initializes the mesh admin agent and its HTTP server.
- Binds well-known message ports (
proc.spawn()does not callbind()— unlikegspawn— so the actor must do it itself before becoming reachable). - Binds a TCP listener (ephemeral or fixed port).
- Builds a TLS acceptor (explicit env vars, then Meta default
paths). At Meta (
fbcode_build), mTLS is mandatory and init fails if no certs are found. In OSS, falls back to plain HTTP. - Creates a dedicated
Instance<()>client mailbox on system_proc for the HTTP bridge’s reply ports, keeping bridge traffic off the actor’s own mailbox. - Spawns the axum server in a background task (HTTPS with mTLS at Meta, HTTPS or HTTP in OSS depending on step 3).
The hostname-based listen address is stored in admin_host so
it can be returned via GetAdminAddr. The scheme (https://
or http://) is included so clients know which protocol to
use.
Source§fn handle_undeliverable_message<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_cx: &'life1 Instance<Self>,
__arg2: 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>,
__arg2: Undeliverable<MessageEnvelope>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Swallow undeliverable message bounces instead of crashing.
The admin agent sends IntrospectMessage to actors that may
not have the introspection port bound (e.g. actors spawned
via cx.spawn() whose #[export] list does not include it).
When the message cannot be delivered, the routing layer
bounces an Undeliverable back to the sender. The default
Actor::handle_undeliverable_message calls bail!(), which
would kill this admin agent and — via supervision cascade —
take down the entire admin process with exit(1).
Since the admin agent is best-effort infrastructure, an undeliverable introspection probe is not a fatal error.
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
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: '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
'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 ActorId.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 Binds<MeshAdminAgent> for MeshAdminAgent
impl Binds<MeshAdminAgent> for MeshAdminAgent
Source§impl Debug for MeshAdminAgent
impl Debug for MeshAdminAgent
Source§impl Handler<MeshAdminMessage> for MeshAdminAgent
Manual Handler impl — swallows reply.send() failures so the
admin agent stays alive when the HTTP caller disconnects.
impl Handler<MeshAdminMessage> for MeshAdminAgent
Manual Handler impl — swallows reply.send() failures so the
admin agent stays alive when the HTTP caller disconnects.
Source§fn handle<'life0, 'life1, 'async_trait>(
&'life0 mut self,
cx: &'life1 Context<'_, Self>,
msg: MeshAdminMessage,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 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: MeshAdminMessage,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Dispatches MeshAdminMessage variants.
Reply-send failures are swallowed because a dropped receiver (e.g. the HTTP bridge timed out) is not an error — the caller simply went away. Propagating the failure would crash the admin agent and take down the entire process.
Source§impl Handler<ResolveReferenceMessage> for MeshAdminAgent
Manual Handler impl — swallows reply.send() failures so the
admin agent stays alive when the HTTP caller disconnects.
impl Handler<ResolveReferenceMessage> for MeshAdminAgent
Manual Handler impl — swallows reply.send() failures so the
admin agent stays alive when the HTTP caller disconnects.
Source§fn handle<'life0, 'life1, 'async_trait>(
&'life0 mut self,
cx: &'life1 Context<'_, Self>,
msg: ResolveReferenceMessage,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 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: ResolveReferenceMessage,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Dispatches ResolveReferenceMessage variants.
The inner resolve_reference call never returns Err to the
handler — failures are captured in the response payload.
Reply-send failures are swallowed for the same reason as
MeshAdminMessage: a dropped receiver means the caller (HTTP
bridge) went away, which must not crash the admin agent.
Source§impl Named for MeshAdminAgent
impl Named for MeshAdminAgent
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 Accepts<IntrospectMessage> for MeshAdminAgent
impl Accepts<MeshAdminMessage> for MeshAdminAgent
impl Accepts<ResolveReferenceMessage> for MeshAdminAgent
impl Accepts<Signal> for MeshAdminAgent
impl Referable for MeshAdminAgent
impl RemoteHandles<IntrospectMessage> for MeshAdminAgent
impl RemoteHandles<MeshAdminMessage> for MeshAdminAgent
impl RemoteHandles<ResolveReferenceMessage> for MeshAdminAgent
impl RemoteHandles<Signal> for MeshAdminAgent
Auto Trait Implementations§
impl Freeze for MeshAdminAgent
impl RefUnwindSafe for MeshAdminAgent
impl Send for MeshAdminAgent
impl Sync for MeshAdminAgent
impl Unpin for MeshAdminAgent
impl UnwindSafe for MeshAdminAgent
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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<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].