X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futility-types.ts;h=a418ee885f903d3bb9838c0c34be0e6bbce43524;hb=251d6ac2d29d7361d671a8df17af51b414ea3b83;hp=c4a8bf115174d6d60bb114975dfabc81f4a75c9f;hpb=501aea93c14789538c4e221fbab2f8afb80f4cf9;p=poolifier.git diff --git a/src/utility-types.ts b/src/utility-types.ts index c4a8bf11..a418ee88 100644 --- a/src/utility-types.ts +++ b/src/utility-types.ts @@ -1,5 +1,5 @@ import type { EventLoopUtilization } from 'node:perf_hooks' -import type { MessagePort } from 'node:worker_threads' +import type { MessagePort, TransferListItem } from 'node:worker_threads' import type { KillBehavior } from './worker/worker-options' /** @@ -75,14 +75,18 @@ export interface Task { * Task input data that will be passed to the worker. */ readonly data?: Data + /** + * Array of transferable objects. + */ + readonly transferList?: TransferListItem[] /** * Timestamp. */ readonly timestamp?: number /** - * Message UUID. + * Task UUID. */ - readonly id?: string + readonly taskId?: string } /** @@ -97,7 +101,7 @@ export interface MessageValue /** * Kill code. */ - readonly kill?: KillBehavior | true + readonly kill?: KillBehavior | true | 'success' | 'failure' /** * Task error. */ @@ -106,6 +110,10 @@ export interface MessageValue * Task performance. */ readonly taskPerformance?: TaskPerformance + /** + * Task function names. + */ + readonly taskFunctions?: string[] /** * Whether the worker computes the given statistics or not. */ @@ -125,7 +133,7 @@ export interface MessageValue } /** - * An object holding the execution response promise resolve/reject callbacks. + * An object holding the task execution response promise resolve/reject callbacks. * * @typeParam Response - Type of execution response. This can only be structured-cloneable data. * @internal @@ -140,7 +148,7 @@ export interface PromiseResponseWrapper { */ readonly reject: (reason?: unknown) => void /** - * The worker node key handling the execution. + * The worker node key executing the task. */ readonly workerNodeKey: number }