Merge branch 'master' into interleaved-weighted-round-robin-worker-choice-strategy
[poolifier.git] / src / pools / selection-strategies / selection-strategies-types.ts
index 968d2996e0dfd05f7a21404c656010e2bdfcc92b..6ae695ca6dca6141d48cef31dd46c6be5cb08bbb 100644 (file)
@@ -21,7 +21,13 @@ export const WorkerChoiceStrategies = Object.freeze({
   /**
    * Weighted round robin worker selection strategy.
    */
-  WEIGHTED_ROUND_ROBIN: 'WEIGHTED_ROUND_ROBIN'
+  WEIGHTED_ROUND_ROBIN: 'WEIGHTED_ROUND_ROBIN',
+  /**
+   * Interleaved weighted round robin worker selection strategy.
+   *
+   * @experimental
+   */
+  INTERLEAVED_WEIGHTED_ROUND_ROBIN: 'INTERLEAVED_WEIGHTED_ROUND_ROBIN'
 } as const)
 
 /**
@@ -78,20 +84,24 @@ export interface IWorkerChoiceStrategy {
   readonly requiredStatistics: RequiredStatistics
   /**
    * Resets strategy internals.
+   *
+   * @returns `true` if the reset is successful, `false` otherwise.
    */
   reset: () => boolean
   /**
-   * Updates strategy internals.
+   * Updates the worker node key strategy internals.
    *
    * @returns `true` if the update is successful, `false` otherwise.
    */
-  update: () => boolean
+  update: (workerNodeKey: number) => boolean
   /**
    * Chooses a worker node in the pool and returns its key.
+   *
+   * @returns The worker node key.
    */
   choose: () => number
   /**
-   * Removes a worker node key from strategy internals.
+   * Removes the worker node key from strategy internals.
    *
    * @param workerNodeKey - The worker node key.
    * @returns `true` if the worker node key is removed, `false` otherwise.