build(deps-dev): apply updates
[poolifier.git] / src / pools / selection-strategies / selection-strategies-types.ts
index 5b844cc572756930980c29991ea3af94ae9a6532..3e7c3427e84f7bedb015e8f6d7ef54215377bd40 100644 (file)
@@ -1,4 +1,4 @@
-import type { AbstractPoolWorker } from '../abstract-pool-worker'
+import type { IPoolWorker } from '../pool-worker'
 
 /**
  * Enumeration of worker choice strategies.
@@ -28,28 +28,32 @@ export const WorkerChoiceStrategies = Object.freeze({
 export type WorkerChoiceStrategy = keyof typeof WorkerChoiceStrategies
 
 /**
- * Tasks usage statistics requirements.
+ * Pool tasks usage statistics requirements.
  */
-export type RequiredStatistics = {
+export interface RequiredStatistics {
   runTime: boolean
 }
 
 /**
  * Worker choice strategy interface.
  *
- * @template Worker Type of worker which manages the strategy.
+ * @typeParam 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
 }