X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futility-types.ts;h=48988c089f6717e1e4108143ce87c20bdc5536d1;hb=5aa31a743fde300612ae89a242b809ae7db083ed;hp=e1fb311e45b4eb8ed0e5d33cda3b3806d7526f5b;hpb=5b49e86408b36f63d5076a086e2feca64a9690d0;p=poolifier.git diff --git a/src/utility-types.ts b/src/utility-types.ts index e1fb311e..48988c08 100644 --- a/src/utility-types.ts +++ b/src/utility-types.ts @@ -3,13 +3,13 @@ import type { MessagePort, TransferListItem } from 'node:worker_threads' import type { KillBehavior } from './worker/worker-options' /** - * Task error. + * Worker error. * * @typeParam Data - Type of data sent to the worker triggering an error. This can only be structured-cloneable data. */ -export interface TaskError { +export interface WorkerError { /** - * Task name triggering the error. + * Task function name triggering the error. */ readonly name: string /** @@ -72,7 +72,7 @@ export interface Task { /** * Worker id. */ - readonly workerId: number + readonly workerId?: number /** * Task name. */ @@ -109,17 +109,36 @@ export interface MessageValue */ readonly kill?: KillBehavior | true | 'success' | 'failure' /** - * Task error. + * Worker error. */ - readonly taskError?: TaskError + readonly workerError?: WorkerError /** * Task performance. */ readonly taskPerformance?: TaskPerformance + /** + * Task function operation: + * - `'add'` - Add a task function. + * - `'remove'` - Remove a task function. + * - `'default'` - Set a task function as default. + */ + readonly taskFunctionOperation?: 'add' | 'remove' | 'default' + /** + * Whether the task function operation is successful or not. + */ + readonly taskFunctionOperationStatus?: boolean + /** + * Task function serialized to string. + */ + readonly taskFunction?: string + /** + * Task function name. + */ + readonly taskFunctionName?: string /** * Task function names. */ - readonly taskFunctions?: string[] + readonly taskFunctionNames?: string[] /** * Whether the worker computes the given statistics or not. */