repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
CHANGELOG.md: 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 359cfb948c6334dc507a3d0894149790aef584f9..21e4129eeca6d9e09619647ab7b80abbd299032c 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.
@@
-12,6
+12,10
@@
export const WorkerChoiceStrategies = Object.freeze({
* Less recently used worker selection strategy.
*/
LESS_RECENTLY_USED: 'LESS_RECENTLY_USED',
* Less recently used worker selection strategy.
*/
LESS_RECENTLY_USED: 'LESS_RECENTLY_USED',
+ /**
+ * Fair share worker selection strategy.
+ */
+ FAIR_SHARE: 'FAIR_SHARE',
/**
* Weighted round robin worker selection strategy.
*/
/**
* Weighted round robin worker selection strategy.
*/
@@
-23,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.
*
* @template Worker Type of worker which manages the strategy.
*/
/**
* Worker choice strategy interface.
*
* @template 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
}
}