Module proc

Module proc 

Source
Expand description

Proc is an addressable actor-runtime boundary.

It owns actor lifecycle (spawn, run, terminate), routes messages to local actors, forwards messages for remote destinations, and hosts supervision state.

It also stores bounded snapshots of terminated actors for post-mortem introspection.

§Client instance invariants (CI-*)

  • CI-1 (client status): IntrospectMessage::Query on an introspectable instance returns status: "client" and actor_type: "()" in attrs.
  • CI-2 (snapshot on drop): Dropping the returned Instance<()> transitions its status to terminal, causing the introspect task to store a terminated snapshot.

§Actor identity invariants (AI-*)

  • AI-1 (named-child pid): The pid of a named child must remain in the parent’s sibling pid domain. The name is presentation only; the numeric pid is allocated from the parent’s counter, preserving supervision linkage.
  • AI-3 (controller ActorId uniqueness): Callers must ensure the name is unique proc-wide. Two children with the same name under different parents get distinct pids but the same name prefix.

Structs§

ActorInstance
Structured return type for Proc::actor_instance.
Context
Context for a message currently being handled by an Instance.
Instance
An actor instance. This is responsible for managing a running actor, including its full lifecycle, supervision, signal management, etc. Instances can represent a managed actor or a “client” actor that has joined the proc.
InstanceCell
InstanceCell contains all of the type-erased, shareable state of an instance. Specifically, InstanceCells form a supervision tree, and is used by ActorHandle to access the underlying instance.
InstanceReceivers
Receivers created by Instance::new that must be threaded to their respective consumers (actor loop, introspect task, etc.).
Ports
A polymorphic dictionary that stores ports for an actor’s handlers. The interface memoizes the ports so that they are reused. We do not (yet) support stable identifiers across multiple instances of the same actor.
Proc
A proc instance is the runtime managing a single proc in Hyperactor. It is responsible for spawning actors in the proc, multiplexing messages to/within actors in the proc, and providing fallback routing to external procs.
WeakInstanceCell
A weak version of the InstanceCell. This is used to provide cyclical linkage between actors without creating a strong reference cycle.
WeakProc
A weak reference to a Proc that doesn’t prevent it from being dropped.
WorkCell
Represents a single work item used by the instance to dispatch to actor handles. Specifically, this enables handler polymorphism.