| /** | |
| * Worker-side primitives for worker-like runtimes. | |
| * | |
| * A `WorkerRunner` receives messages tagged by a numeric port id, sends replies | |
| * back through the same transport, and can expose disconnect notifications. The | |
| * module also defines the small platform message shape and the | |
| * `WorkerRunnerPlatform` service that starts a platform-specific runner. | |
| * | |
| * @since 4.0.0 | |
| */ | |
| import * as Context from "../../Context.ts"; | |
| import type * as Effect from "../../Effect.ts"; | |
| import type * as Queue from "../../Queue.ts"; | |
| import type { WorkerError } from "./WorkerError.ts"; | |
| /** | |
| * Platform-neutral worker runner that receives inbound messages by port ID, | |
| * sends outbound messages, and optionally exposes disconnect notifications. | |
| * | |
| * @category models | |
| * @since 4.0.0 | |
| */ | |
| export interface WorkerRunner<O = unknown, I = unknown> { | |
| readonly run: <A, E, R>(handler: (portId: number, message: I) => Effect.Effect<A, E, R> | void) => Effect.Effect<void, WorkerError, R>; | |
| readonly send: (portId: number, message: O, transfers?: ReadonlyArray<unknown>) => Effect.Effect<void>; | |
| readonly sendUnsafe: (portId: number, message: O, transfers?: ReadonlyArray<unknown>) => void; | |
| readonly disconnects?: Queue.Dequeue<number> | undefined; | |
| } | |
| /** | |
| * Wire protocol message used by worker platforms: a request carrying input or a | |
| * close signal. | |
| * | |
| * @category models | |
| * @since 4.0.0 | |
| */ | |
| export type PlatformMessage<I> = readonly [request: 0, I] | readonly [close: 1]; | |
| declare const WorkerRunnerPlatform_base: Context.ServiceClass<WorkerRunnerPlatform, "effect/workers/WorkerRunner/WorkerRunnerPlatform", { | |
| readonly start: <O = unknown, I = unknown>() => Effect.Effect<WorkerRunner<O, I>, WorkerError>; | |
| }>; | |
| /** | |
| * Context service that starts a platform-specific `WorkerRunner`. | |
| * | |
| * @category models | |
| * @since 4.0.0 | |
| */ | |
| export declare class WorkerRunnerPlatform extends WorkerRunnerPlatform_base { | |
| } | |
| export {}; | |
| //# sourceMappingURL=WorkerRunner.d.ts.map |
Xet Storage Details
- Size:
- 1.96 kB
- Xet hash:
- 208fb5bab879fca954d2c96e8f9eedab2d3485230051d0b95acd8c307e41116c
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.