X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futility-types.ts;h=28bf19e256abaef2f619051773ad55456643b842;hb=e677f6c55e0bb599d8e589a937a928229ecd6fea;hp=fa1c0ffefdf27e6996789cc444f44d81de9076fc;hpb=ff128cc9dc9cee365f55b15721d5b90707577a0a;p=poolifier.git diff --git a/src/utility-types.ts b/src/utility-types.ts index fa1c0ffe..28bf19e2 100644 --- a/src/utility-types.ts +++ b/src/utility-types.ts @@ -1,6 +1,6 @@ import type { EventLoopUtilization } from 'node:perf_hooks' import type { KillBehavior } from './worker/worker-options' -import type { IWorker, Task } from './pools/worker' +import type { IWorker } from './pools/worker' /** * Task error. @@ -56,6 +56,35 @@ export interface WorkerStatistics { elu: boolean } +/** + * Message object that is passed as a task between main worker and worker. + * + * @typeParam Data - Type of data sent to the worker. This can only be structured-cloneable data. + * @internal + */ +export interface Task { + /** + * Worker id. + */ + readonly workerId: number + /** + * Task name. + */ + readonly name?: string + /** + * Task input data that will be passed to the worker. + */ + readonly data?: Data + /** + * Timestamp. + */ + readonly timestamp?: number + /** + * Message UUID. + */ + readonly id?: string +} + /** * Message object that is passed between main worker and worker. *