1 import type { AbstractPoolWorker
} from
'../abstract-pool-worker'
4 * Enumeration of worker choice strategies.
6 export const WorkerChoiceStrategies
= Object.freeze({
8 * Round robin worker selection strategy.
10 ROUND_ROBIN
: 'ROUND_ROBIN',
12 * Less recently used worker selection strategy.
14 LESS_RECENTLY_USED
: 'LESS_RECENTLY_USED',
16 * Fair share worker selection strategy.
18 FAIR_SHARE
: 'FAIR_SHARE',
20 * Weighted round robin worker selection strategy.
22 WEIGHTED_ROUND_ROBIN
: 'WEIGHTED_ROUND_ROBIN'
26 * Worker choice strategy.
28 export type WorkerChoiceStrategy
= keyof
typeof WorkerChoiceStrategies
31 * Worker choice strategy interface.
33 * @template Worker Type of worker which manages the strategy.
35 export interface IWorkerChoiceStrategy
<Worker
extends AbstractPoolWorker
> {
37 * Is the pool attached to the strategy dynamic?.
39 isDynamicPool
: boolean
41 * Choose a worker in the pool.