import type { EventLoopUtilization } from 'node:perf_hooks'
import type { MessagePort, TransferListItem } from 'node:worker_threads'
+import type { WorkerChoiceStrategy } from './pools/selection-strategies/selection-strategies-types.js'
import type { KillBehavior } from './worker/worker-options.js'
/**
readonly elu: boolean
}
+/**
+ * Task function properties.
+ */
+export interface TaskFunctionProperties {
+ /**
+ * Task function name.
+ */
+ readonly name: string
+ /**
+ * Task function priority. Lower values have higher priority.
+ */
+ readonly priority?: number
+ /**
+ * Task function worker choice strategy.
+ */
+ readonly strategy?: WorkerChoiceStrategy
+}
+
/**
* Message object that is passed as a task between main worker and worker.
*
* Task input data that will be passed to the worker.
*/
readonly data?: Data
+ /**
+ * Task priority. Lower values have higher priority.
+ *
+ * @defaultValue 0
+ */
+ readonly priority?: number
+ /**
+ * Task worker choice strategy.
+ */
+ readonly strategy?: WorkerChoiceStrategy
/**
* Array of transferable objects.
*/
- readonly transferList?: TransferListItem[]
+ readonly transferList?: readonly TransferListItem[]
/**
* Timestamp.
*/
/**
* Task UUID.
*/
- readonly taskId?: string
+ readonly taskId?: `${string}-${string}-${string}-${string}-${string}`
}
/**
*/
readonly taskFunctionOperationStatus?: boolean
/**
- * Task function serialized to string.
+ * Task function properties.
*/
- readonly taskFunction?: string
+ readonly taskFunctionProperties?: TaskFunctionProperties
/**
- * Task function name.
+ * Task function serialized to string.
*/
- readonly taskFunctionName?: string
+ readonly taskFunction?: string
/**
- * Task function names.
+ * Task functions properties.
*/
- readonly taskFunctionNames?: string[]
+ readonly taskFunctionsProperties?: TaskFunctionProperties[]
/**
* Whether the worker computes the given statistics or not.
*/