Bump eslint-plugin-jsdoc from 32.0.2 to 32.1.0 (#212)
[poolifier.git] / src / pools / pool.ts
CommitLineData
729c563d
S
1/**
2 * Contract definition for a poolifier pool.
3 *
deb85c12
JB
4 * @template Data Type of data sent to the worker. This can only be serializable data.
5 * @template Response Type of response of execution. This can only be serializable data.
729c563d 6 */
d3c8a1a8 7export interface IPool<Data = unknown, Response = unknown> {
729c563d
S
8 /**
9 * Perform the task specified in the constructor with the data parameter.
10 *
deb85c12 11 * @param data The input for the specified task. This can only be serializable data.
729c563d
S
12 * @returns Promise that will be resolved when the task is successfully completed.
13 */
c97c7edb 14 execute(data: Data): Promise<Response>
280c2a77
S
15 /**
16 * Shut down every current worker in this pool.
17 */
18 destroy(): Promise<void>
c97c7edb 19}