Remove redundant await
[poolifier.git] / src / pools / pool.ts
CommitLineData
a35560ba
S
1import type { WorkerChoiceStrategy } from './selection-strategies'
2
729c563d
S
3/**
4 * Contract definition for a poolifier pool.
5 *
deb85c12
JB
6 * @template Data Type of data sent to the worker. This can only be serializable data.
7 * @template Response Type of response of execution. This can only be serializable data.
729c563d 8 */
d3c8a1a8 9export interface IPool<Data = unknown, Response = unknown> {
729c563d
S
10 /**
11 * Perform the task specified in the constructor with the data parameter.
12 *
deb85c12 13 * @param data The input for the specified task. This can only be serializable data.
729c563d
S
14 * @returns Promise that will be resolved when the task is successfully completed.
15 */
c97c7edb 16 execute(data: Data): Promise<Response>
280c2a77
S
17 /**
18 * Shut down every current worker in this pool.
19 */
20 destroy(): Promise<void>
a35560ba
S
21 /**
22 * Set the worker choice strategy in this pool.
23 *
24 * @param workerChoiceStrategy The worker choice strategy.
25 */
26 setWorkerChoiceStrategy(workerChoiceStrategy: WorkerChoiceStrategy): void
c97c7edb 27}