Bridge
The intermediary between the serial Dispatcher and the parallel Kernel.
It is responsible for:
- Dispatching jobs to actors
- Tracking job completion
- Collecting and merging results
- Invoking completion callbacks
Functions
new
Creates a new Bridge.
This creates an ActorPool, spawns workers, and establishes the BindableEvent internal messaging channel used to receive job results.
Send
Bridge:Send(name: string,--
Job name
threadCount: number,--
Total logical work items
batchSize: number,--
Items per batch
buf: {any},--
Output buffer
callback: function,--
Invoked once all batches complete
...: any--
Extra arguments forwarded to workers
) → ()Dispatches a tracked job to the ActorPool.
The job:
- Is split into batches
- Executed in parallel
- Sends results back to the bridge
- Invokes the callback once all batches complete
This is the tracked dispatch used by
Dispatcher:Dispatch and Dispatcher:DispatchDeferred.
Errors
| Type | Description |
|---|---|
| "reqId collision" | Too much jobs registered |
SendDetached
Bridge:SendDetached(name: string,--
Job name
threadCount: number,--
Total logical work items
batchSize: number,--
Items per batch
...: any--
Extra arguments forwarded to workers
) → ()Dispatches a detached job to the ActorPool.
The job:
- Is split into batches
- Executed in parallel
This is the detached dispatch used by
Dispatcher:DispatchDetached and Dispatcher:DispatchDetachedDeferred.
Destroy
Bridge:Destroy() → ()Destroys the messenger bindable, the ActorPool, and clears the registry