Aller au contenu
Français

ParallelismExtension

Ce contenu n’est pas encore disponible dans votre langue.

Defined in: src/parallelism/ParallelismExtension.ts:84

Actors on worker threads from configuration alone (#1563).

actor-ts.parallelism.workers above zero makes ActorSystem.create start a WorkerMesh in the background and turns system.spawn into a placement decision: an actor whose path matches offload is created on a worker, every other one where it always was. The application does not change — the same spawn(MyActor, 'x') returns an ActorRef that tells, asks and watches across the thread, and ref.path is the path it would have had at home — and workers = 0, the default, is the untouched code path: no mesh, no import, one null check.

What cannot be hidden is said loudly instead of silently: the factory form of spawn is a closure and cannot cross a thread; a class has to be exported from the actor module for both sides to name it; and /system is never a placement target (see ParallelismOptionsValidator). Children stay with their parent, so the unit of offload is the subtree.

new ParallelismExtension(system, explicitOptions): ParallelismExtension

Defined in: src/parallelism/ParallelismExtension.ts:106

ActorSystem

ParallelismOptionsType | undefined

ParallelismExtension

readonly enabled: boolean

Defined in: src/parallelism/ParallelismExtension.ts:86

false when workers = 0: the extension exists, and does nothing.

get exportedActors(): readonly string[]

Defined in: src/parallelism/ParallelismExtension.ts:149

The export names the main thread will offload, once the modules are loaded.

readonly string[]


get workerMesh(): WorkerMesh | null

Defined in: src/parallelism/ParallelismExtension.ts:146

The mesh, once it is up.

WorkerMesh | null

whenReady(): Promise<void>

Defined in: src/parallelism/ParallelismExtension.ts:141

Resolves once the mesh is up and the actor modules are registered; rejects with what stopped it.

Promise<void>