UNPKG

@nazaire/orchestra

Version:

A framework for distributing work over many machines, integrated with Node.js workers to utilise many threads per machine.

43 lines 1.64 kB
/// <reference types="node" resolution-mode="require"/> import { Job, StrictJobOptions } from "./Job/Job.js"; import { Network } from "./Network/Network.js"; import { NetworkClient } from "./Network/NetworkClient.js"; import { Workspace, WorkspaceResult, WorkspaceScript } from "./Workspace.js"; import { Readable } from "node:stream"; export declare class Client<W extends Workspace<any, any>> extends NetworkClient { private readonly workspace; constructor(network: Network, workspace: W); /** * Add a job to the composer's queue * @param options * @returns */ queue<S extends WorkspaceScript<W>>(options: StrictJobOptions<W, S>): Promise<Job>; /** * Add a job and bypass the queue, returns the result once the job is complete * @param options * @returns the result of the job */ play<S extends WorkspaceScript<W>>(options: StrictJobOptions<W, S>, onData?: (data: any) => void): Promise<WorkspaceResult<W, S>>; /** * Return a promise that resolves with the job when it is complete * @param jobId * @returns */ completion(jobId: string): Promise<Job>; /** * Return a promise that resolves with the result when the job is complete */ result<S extends WorkspaceScript<W>>(jobId: string): Promise<WorkspaceResult<W, S>>; stream(jobId: string): Promise<Readable>; /** * Retrieve the current state of a job * @param id * @returns */ getJob(id: string): Promise<Job | null>; private createJob; private getJobCompletedPromise; private getJobResultPromise; } //# sourceMappingURL=Client.d.ts.map