repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor: use simple quote in error string
[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 968d2996e0dfd05f7a21404c656010e2bdfcc92b..c90036fe6f269dd7757482064a3fdba0b7a97e97 100644
(file)
--- a/
src/pools/selection-strategies/selection-strategies-types.ts
+++ b/
src/pools/selection-strategies/selection-strategies-types.ts
@@
-7,13
+7,13
@@
export const WorkerChoiceStrategies = Object.freeze({
*/
ROUND_ROBIN: 'ROUND_ROBIN',
/**
*/
ROUND_ROBIN: 'ROUND_ROBIN',
/**
- * Le
ss
used worker selection strategy.
+ * Le
ast
used worker selection strategy.
*/
*/
- LE
SS_USED: 'LESS
_USED',
+ LE
AST_USED: 'LEAST
_USED',
/**
/**
- * Le
ss
busy worker selection strategy.
+ * Le
ast
busy worker selection strategy.
*/
*/
- LE
SS_BUSY: 'LESS
_BUSY',
+ LE
AST_BUSY: 'LEAST
_BUSY',
/**
* Fair share worker selection strategy.
*/
/**
* Fair share worker selection strategy.
*/
@@
-34,11
+34,17
@@
export type WorkerChoiceStrategy = keyof typeof WorkerChoiceStrategies
*/
export interface WorkerChoiceStrategyOptions {
/**
*/
export interface WorkerChoiceStrategyOptions {
/**
- * Use tasks median run
time instead of average run
time.
+ * Use tasks median run
time instead of average run
time.
*
* @defaultValue false
*/
medRunTime?: boolean
*
* @defaultValue false
*/
medRunTime?: boolean
+ /**
+ * Use tasks median wait time instead of average runtime.
+ *
+ * @defaultValue false
+ */
+ medWaitTime?: boolean
/**
* Worker weights to use for weighted round robin worker selection strategy.
* Weight is the tasks maximum average or median runtime in milliseconds.
/**
* Worker weights to use for weighted round robin worker selection strategy.
* Weight is the tasks maximum average or median runtime in milliseconds.
@@
-55,17
+61,29
@@
export interface WorkerChoiceStrategyOptions {
*/
export interface RequiredStatistics {
/**
*/
export interface RequiredStatistics {
/**
- * Require tasks run
time.
+ * Require tasks runtime.
*/
runTime: boolean
/**
*/
runTime: boolean
/**
- * Require tasks average run
time.
+ * Require tasks average runtime.
*/
avgRunTime: boolean
/**
*/
avgRunTime: boolean
/**
- * Require tasks median run
time.
+ * Require tasks median runtime.
*/
medRunTime: boolean
*/
medRunTime: boolean
+ /**
+ * Require tasks wait time.
+ */
+ waitTime: boolean
+ /**
+ * Require tasks average wait time.
+ */
+ avgWaitTime: boolean
+ /**
+ * Require tasks median wait time.
+ */
+ medWaitTime: boolean
}
/**
}
/**
@@
-78,20
+96,24
@@
export interface IWorkerChoiceStrategy {
readonly requiredStatistics: RequiredStatistics
/**
* Resets strategy internals.
readonly requiredStatistics: RequiredStatistics
/**
* Resets strategy internals.
+ *
+ * @returns `true` if the reset is successful, `false` otherwise.
*/
reset: () => boolean
/**
*/
reset: () => boolean
/**
- * Updates strategy internals.
+ * Updates
the worker node key
strategy internals.
*
* @returns `true` if the update is successful, `false` otherwise.
*/
*
* @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.
/**
* 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.
* @returns `true` if the worker node key is removed, `false` otherwise.
*
* @param workerNodeKey - The worker node key.
* @returns `true` if the worker node key is removed, `false` otherwise.