repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into interleaved-weighted-round-robin-worker-choice-strategy
[poolifier.git]
/
src
/
pools
/
selection-strategies
/
selection-strategies-types.ts
diff --git
a/src/pools/selection-strategies/selection-strategies-types.ts
b/src/pools/selection-strategies/selection-strategies-types.ts
index 0e549cec338b685d36e80ab1ff3d147ef6a3f83f..f2b401d6faf5bfe879225a71ab635fe4e2c625dc 100644
(file)
--- a/
src/pools/selection-strategies/selection-strategies-types.ts
+++ b/
src/pools/selection-strategies/selection-strategies-types.ts
@@
-21,7
+21,11
@@
export const WorkerChoiceStrategies = Object.freeze({
/**
* Weighted round robin worker selection strategy.
*/
/**
* 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.
+ */
+ INTERLEAVED_WEIGHTED_ROUND_ROBIN: 'INTERLEAVED_WEIGHTED_ROUND_ROBIN'
} as const)
/**
} as const)
/**
@@
-77,17
+81,28
@@
export interface IWorkerChoiceStrategy {
*/
readonly requiredStatistics: RequiredStatistics
/**
*/
readonly requiredStatistics: RequiredStatistics
/**
- * Resets strategy internals (counters, statistics, etc.).
+ * Resets strategy internals.
+ *
+ * @returns `true` if the reset is successful, `false` otherwise.
*/
reset: () => boolean
*/
reset: () => boolean
+ /**
+ * Updates the worker node key strategy internals.
+ *
+ * @returns `true` if the update is successful, `false` otherwise.
+ */
+ update: (workerNodeKey: number) => boolean
/**
* Chooses a worker node in the pool and returns its key.
/**
* Chooses a worker node in the pool and returns its key.
+ *
+ * @returns The worker node key.
*/
choose: () => number
/**
*/
choose: () => number
/**
- * Removes
a
worker node key from strategy internals.
+ * Removes
the
worker node key from strategy internals.
*
* @param workerNodeKey - The worker node key.
*
* @param workerNodeKey - The worker node key.
+ * @returns `true` if the worker node key is removed, `false` otherwise.
*/
remove: (workerNodeKey: number) => boolean
/**
*/
remove: (workerNodeKey: number) => boolean
/**