Apply dependencies update
[poolifier.git] / src / pools / selection-strategies / selection-strategies-types.ts
index 5b844cc572756930980c29991ea3af94ae9a6532..21e4129eeca6d9e09619647ab7b80abbd299032c 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,9 +28,9 @@ 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
 }
 
@@ -39,17 +39,21 @@ export type RequiredStatistics = {
  *
  * @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
 }