X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futility-types.ts;h=e1fb311e45b4eb8ed0e5d33cda3b3806d7526f5b;hb=b4c2a50df77a5f3110d228436ce9f3008cbd8297;hp=123b5d6ea4fa397982c6195de0d9ccd95ba0c1df;hpb=15a8bf08edd98c1f9ef4a4d3f89d2cffbe30852e;p=poolifier.git diff --git a/src/utility-types.ts b/src/utility-types.ts index 123b5d6e..e1fb311e 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' /** @@ -47,13 +47,19 @@ export interface TaskPerformance { } /** - * Performance statistics computation. + * Worker task performance statistics computation settings. * * @internal */ export interface WorkerStatistics { - runTime: boolean - elu: boolean + /** + * Whether the worker computes the task runtime or not. + */ + readonly runTime: boolean + /** + * Whether the worker computes the task event loop utilization (ELU) or not. + */ + readonly elu: boolean } /** @@ -75,6 +81,10 @@ export interface Task { * Task input data that will be passed to the worker. */ readonly data?: Data + /** + * Array of transferable objects. + */ + readonly transferList?: TransferListItem[] /** * Timestamp. */ @@ -97,7 +107,7 @@ export interface MessageValue /** * Kill code. */ - readonly kill?: KillBehavior | true + readonly kill?: KillBehavior | true | 'success' | 'failure' /** * Task error. */ @@ -106,6 +116,10 @@ export interface MessageValue * Task performance. */ readonly taskPerformance?: TaskPerformance + /** + * Task function names. + */ + readonly taskFunctions?: string[] /** * Whether the worker computes the given statistics or not. */ @@ -144,3 +158,5 @@ export interface PromiseResponseWrapper { */ readonly workerNodeKey: number } + +export type Writable = { -readonly [P in keyof T]: T[P] }