/**
* Worker type.
*/
- type: WorkerType
+ readonly type: WorkerType
/**
* Dynamic flag.
*/
/**
* Task function names.
*/
- taskFunctions?: string[]
+ taskFunctionNames?: string[]
}
/**
readonly elu: EventLoopUtilizationMeasurementStatistics
}
+/**
+ * Worker choice strategy data.
+ *
+ * @internal
+ */
+export interface StrategyData {
+ virtualTaskEndTimestamp?: number
+}
+
/**
* Worker interface.
*/
readonly once: (event: 'exit', handler: ExitHandler<this>) => void
}
+/**
+ * Worker node event callback.
+ *
+ * @param workerId - The worker id.
+ * @internal
+ */
+export type WorkerNodeEventCallback = (workerId: number) => void
+
/**
* Worker node interface.
*
*/
readonly info: WorkerInfo
/**
- * Message channel (worker_threads only).
+ * Worker usage statistics.
*/
- readonly messageChannel?: MessageChannel
+ readonly usage: WorkerUsage
/**
- * Worker usage statistics.
+ * Worker choice strategy data.
+ * This is used to store data that is specific to the worker choice strategy.
+ */
+ strategyData?: StrategyData
+ /**
+ * Message channel (worker_threads only).
*/
- usage: WorkerUsage
+ readonly messageChannel?: MessageChannel
/**
* Tasks queue back pressure size.
* This is the number of tasks that can be enqueued before the worker node has back pressure.
tasksQueueBackPressureSize: number
/**
* Callback invoked when worker node tasks queue is back pressured.
- *
- * @param workerId - The worker id.
*/
- onBackPressure?: (workerId: number) => void
+ onBackPressure?: WorkerNodeEventCallback
/**
* Callback invoked when worker node tasks queue is empty.
- *
- * @param workerId - The worker id.
*/
- onEmptyQueue?: (workerId: number) => void
+ onEmptyQueue?: WorkerNodeEventCallback
/**
* Tasks queue size.
*
* @returns The task function worker usage statistics if the task function worker usage statistics are initialized, `undefined` otherwise.
*/
readonly getTaskFunctionWorkerUsage: (name: string) => WorkerUsage | undefined
+ /**
+ * Deletes task function worker usage statistics.
+ *
+ * @param name - The task function name.
+ * @returns `true` if the task function worker usage statistics were deleted, `false` otherwise.
+ */
+ readonly deleteTaskFunctionWorkerUsage: (name: string) => boolean
}