Skip to main content

Module environment

Module environment 

Source
Expand description

The persistent, language-independent environment carried by an actor Instance.

An ActorEnvironment is a small, immutable set of typed attributes fixed when the instance is constructed. It is inherited by local children and serialized to remote children, giving stable actor context a native home that does not depend on the actor’s implementation language.

hyperactor owns how this environment is carried through actor creation, while higher-level crates own the values it contains. Those crates declare typed Key attributes. Putting those values in a fixed struct would move higher-level concepts into hyperactor and require core runtime and wire changes for each new kind of inherited context. This is not an untyped general-purpose map: the API preserves each value’s type, enforces fixed bounds, and requires mutable ownership for construction updates.

§AENV invariant registry

  • AENV-0 (value integrity): every ActorEnvironment is structurally valid, bounded, unique-keyed, and updated atomically.
  • AENV-1 (instance ownership): every Instance stores exactly one immutable environment in its type-erased instance cell, fixed at construction and exposed read-only.
  • AENV-2 (local inheritance): ordinary local child/client construction derives its parent’s exact environment from that cell.
  • AENV-3 (remote inheritance): native remote-spawn adapters transport the caller-shaped environment; nested remote spawn derives and transports its environment independently.
  • AENV-4 (caller shaping): spawn callers put all construction context in one environment. When its create cast carries CAST_POINT, proc-mesh construction replaces the environmental value with the point assigned to the new actor; ordinary local child construction inherits the parent’s exact environment. RemoteSpawn::new reads that environment, and the runtime stores it unchanged.
  • AENV-5 (runtime neutrality): inheritance is implemented by native Instance/spawn plumbing and does not depend on the actor implementation language.

Structs§

ActorEnvironment
The persistent environment owned by an actor instance.

Enums§

ActorEnvironmentError
An error constructing or decoding an ActorEnvironment.