Expand description
This module defines Host
, which represents all the procs running on a host.
The procs themselves are managed by an implementation of ProcManager
, which may,
for example, fork new processes for each proc, or spawn them in the same process
for testing purposes.
The primary purpose of a host is to manage the lifecycle of these procs, and to serve as a single front-end for all the procs on a host, multiplexing network channels.
§Channel muxing
A Host
maintains a single frontend address, through which all procs are accessible
through direct addressing: the id of each proc is the ProcId::Direct(frontend_addr, proc_name)
.
In the following, the frontend address is denoted by *
. The host listens on *
and
multiplexes messages based on the proc name. When spawning procs, the host maintains
backend channels with separate addresses. In the diagram #
is the backend address of
the host, while #n
is the backend address for proc n. The host forwards messages
to the appropriate backend channel, while procs forward messages to the host backend
channel at #
.
┌────────────┐
┌───▶ proc *,1 │
│ #1└────────────┘
│
┌──────────┐ │ ┌────────────┐
│ Host │◀───┼───▶ proc *,2 │
*└──────────┘# │ #2└────────────┘
│
│ ┌────────────┐
└───▶ proc *,3 │
#3└────────────┘
Modules§
- testing
- Testing support for hosts. This is linked outside of cfg(test) as it is needed by an external binary.
Structs§
- Host
- A host, managing the lifecycle of several procs, and their backend routing, as described in this module’s documentation.
- Local
Handle - A lightweight
ProcHandle
for procs managed in-process viaLocalProcManager
. - Local
Proc Manager - A ProcManager that spawns in-process procs (test-only).
- Process
Handle - A
ProcHandle
implementation 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).
- Terminate
Summary - Summary of results from a bulk termination attempt.
Enums§
- Host
Error - The type of error produced by host operations.
- Ready
Error - Error returned by
ProcHandle::ready
. - Terminate
Error - Error returned by
ProcHandle::terminate
andProcHandle::kill
. - Wait
Error - Error returned by
ProcHandle::wait
.
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.
Functions§
- spawn_
proc - Spawn a proc at
proc_id
with 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
.