Commit | Line | Data |
---|---|---|
729c563d S |
1 | /** |
2 | * Contract definition for a poolifier pool. | |
3 | * | |
4 | * @template Data Type of data sent to the worker. | |
5 | * @template Response Type of response of execution. | |
6 | */ | |
d3c8a1a8 | 7 | export interface IPool<Data = unknown, Response = unknown> { |
729c563d S |
8 | /** |
9 | * Shut down every current worker in this pool. | |
10 | */ | |
c97c7edb | 11 | destroy(): Promise<void> |
729c563d S |
12 | /** |
13 | * Perform the task specified in the constructor with the data parameter. | |
14 | * | |
15 | * @param data The input for the specified task. | |
16 | * @returns Promise that will be resolved when the task is successfully completed. | |
17 | */ | |
c97c7edb S |
18 | execute(data: Data): Promise<Response> |
19 | } |