Expand description
Host lifecycle management for procs running on one machine.
A Host owns one Gateway and one ProcManager. The manager makes
procs real, either by spawning them in-process for tests or by launching
separate OS processes. The gateway owns connectivity: it serves the backend
and frontend endpoints, multiplexes inbound traffic to in-process procs,
and routes spawned child proc gateways through peer routes.
Use Host::new or Host::new_with_gateway to construct a host, start
its backend and frontend accept loops, then Host::spawn to create child procs.
Spawned children are returned as ProcAddr values whose location is
advertised through this host’s gateway.
§Gateway topology
A host gateway exposes a frontend endpoint * and serves a backend
endpoint # for child proc gateways. Each spawned child has its own
gateway endpoint (#1, #2, …), uses # as its forwarder, and is
advertised as Via(child_uid, host_location). The host_location is the
host gateway’s advertised location: the newest active frontend serve or
serve_via session.
The host gateway keeps one peer route per child uid. When it receives a
message for Via(child_uid, host_location), it peels the child hop and
forwards the envelope to the child’s gateway. In-process service and local
procs are delivered through the gateway’s local proc table.
inbound to host_location
(*, or Via(...) when attached)
|
v
+---------------+ peer child_uid_1 -> #1 +----------------------+
| Host Gateway |------------------------------->| child gateway/proc 1 |
| local procs: | | addr #1 |
| service/local |<-------------------------------| forwarder -> # |
+---------------+ host backend # +----------------------+
|
| peer child_uid_2 -> #2
v
+----------------------+
| child gateway/proc 2 |
| addr #2 |
| forwarder -> # |
+----------------------+The built-in service and local procs are created during construction and
run in-process on the host gateway. The local proc starts with no actors; a
ProcAgent and root client actor are added lazily when
HostMeshAgent::handle(GetLocalProc) first asks for it.
Modules§
- testing
- Testing support for hosts. This is linked outside of cfg(test) as it is needed by an external binary.
Structs§
- Host
- Lifecycle manager for the procs on one machine.
- Local
Handle - A lightweight
ProcHandlefor procs managed in-process viaLocalProcManager. - Local
Proc Manager - A ProcManager that spawns in-process procs (test-only).
- Process
Handle - A
ProcHandleimplementation for procs managed as separate OS processes viaProcessProcManager. - Process
Proc Manager - A ProcManager that manages each proc as a separate OS process (test-only toy).
- Ready
Proc - Capability proving a proc is ready.
- Terminate
Summary - Summary of results from a bulk termination attempt.
Enums§
- Host
Error - The type of error produced by host operations.
- Local
Proc Status - Lifecycle status for procs managed by
LocalProcManager. - Ready
Error - Error returned by
ProcHandle::ready. - Ready
Proc Error - Error returned by [
ready_proc]. - Terminate
Error - Error returned by
ProcHandle::terminateandProcHandle::kill. - Wait
Error - Error returned by
ProcHandle::wait.
Constants§
- LOCAL_
PROC_ NAME - Name of the local client proc on a host.
- SERVICE_
PROC_ NAME - Name of the system service proc on a host.
Traits§
- Bulk
Terminate - Trait for managers that can terminate many child units in bulk.
- Proc
Handle - Minimal uniform surface for a spawned-proc handle returned by
a
ProcManager. Each manager can return its own concrete handle, as long as it exposes these. A proc is the Hyperactor runtime - Proc
Manager - A trait describing a manager of procs, responsible for bootstrapping
procs on a host, and managing their lifetimes. The manager spawns an
Agent-typed actor on each proc, responsible for managing the proc. - Single
Terminate - Trait for terminating a single proc.
Functions§
- spawn_
proc - Spawn a proc at
proc_idwith anA-typed agent actor, forwarding messages to the providedbackend_addr, and returning the proc’s address and agent actor on the providedcallback_addr.
Type Aliases§
- Manager
Agent - Type alias for the agent actor managed by a given
ProcManager.