repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Apply dependencies update
[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 edefcfaac429d8c0d24fa897300650d141ab7f3c..3e7c3427e84f7bedb015e8f6d7ef54215377bd40 100644
(file)
--- a/
src/pools/selection-strategies/selection-strategies-types.ts
+++ b/
src/pools/selection-strategies/selection-strategies-types.ts
@@
-1,4
+1,4
@@
-import type {
AbstractPoolWorker } from '../abstract-
pool-worker'
+import type {
IPoolWorker } from '../
pool-worker'
/**
* Enumeration of worker choice strategies.
/**
* Enumeration of worker choice strategies.
@@
-11,7
+11,15
@@
export const WorkerChoiceStrategies = Object.freeze({
/**
* Less recently used worker selection strategy.
*/
/**
* Less recently used worker selection strategy.
*/
- LESS_RECENTLY_USED: 'LESS_RECENTLY_USED'
+ LESS_RECENTLY_USED: 'LESS_RECENTLY_USED',
+ /**
+ * Fair share worker selection strategy.
+ */
+ FAIR_SHARE: 'FAIR_SHARE',
+ /**
+ * Weighted round robin worker selection strategy.
+ */
+ WEIGHTED_ROUND_ROBIN: 'WEIGHTED_ROUND_ROBIN'
} as const)
/**
} as const)
/**
@@
-19,18
+27,33
@@
export const WorkerChoiceStrategies = Object.freeze({
*/
export type WorkerChoiceStrategy = keyof typeof WorkerChoiceStrategies
*/
export type WorkerChoiceStrategy = keyof typeof WorkerChoiceStrategies
+/**
+ * Pool tasks usage statistics requirements.
+ */
+export interface RequiredStatistics {
+ runTime: boolean
+}
+
/**
* Worker choice strategy interface.
*
/**
* Worker choice strategy interface.
*
- * @t
emplate Worker
Type of worker which manages the strategy.
+ * @t
ypeParam Worker -
Type of worker which manages the strategy.
*/
*/
-export interface IWorkerChoiceStrategy<Worker extends
Abstract
PoolWorker> {
+export interface IWorkerChoiceStrategy<Worker extends
I
PoolWorker> {
/**
* Is the pool attached to the strategy dynamic?.
*/
/**
* Is the pool attached to the strategy dynamic?.
*/
- isDynamicPool: boolean
+ readonly isDynamicPool: boolean
+ /**
+ * Required pool tasks usage statistics.
+ */
+ readonly requiredStatistics: RequiredStatistics
+ /**
+ * Resets strategy internals (counters, statistics, etc.).
+ */
+ reset: () => boolean
/**
/**
- * Choose a worker in the pool.
+ * Choose
s
a worker in the pool.
*/
*/
- choose
():
Worker
+ choose
: () =>
Worker
}
}