-import type { AbstractPoolWorker } from '../abstract-pool-worker'
+import type { IPoolWorker } from '../pool-worker'
/**
* Enumeration of worker choice strategies.
export type WorkerChoiceStrategy = keyof typeof WorkerChoiceStrategies
/**
- * Tasks usage statistics requirements.
+ * Pool tasks usage statistics requirements.
*/
-export type RequiredStatistics = {
+export interface RequiredStatistics {
runTime: boolean
}
*
* @template Worker Type of worker which manages the strategy.
*/
-export interface IWorkerChoiceStrategy<Worker extends AbstractPoolWorker> {
+export interface IWorkerChoiceStrategy<Worker extends IPoolWorker> {
/**
* Is the pool attached to the strategy dynamic?.
*/
- isDynamicPool: boolean
+ readonly isDynamicPool: boolean
/**
- * Required tasks usage statistics.
+ * Required pool tasks usage statistics.
*/
- requiredStatistics: RequiredStatistics
+ readonly requiredStatistics: RequiredStatistics
+ /**
+ * Resets strategy internals (counters, statistics, etc.).
+ */
+ reset: () => boolean
/**
* Chooses a worker in the pool.
*/
- choose(): Worker
+ choose: () => Worker
}