1 import type { AbstractPoolWorker
} from
'../abstract-pool-worker'
2 import type { IPoolInternal
} from
'../pool-internal'
3 import { PoolType
} from
'../pool-internal'
4 import type { IWorkerChoiceStrategy
} from
'./selection-strategies-types'
7 * Abstract worker choice strategy class.
9 * @template Worker Type of worker which manages the strategy.
10 * @template Data Type of data sent to the worker. This can only be serializable data.
11 * @template Response Type of response of execution. This can only be serializable data.
13 export abstract class AbstractWorkerChoiceStrategy
<
14 Worker
extends AbstractPoolWorker
,
17 > implements IWorkerChoiceStrategy
<Worker
> {
19 public isDynamicPool
: boolean = this.pool
.type === PoolType
.DYNAMIC
22 * Constructs a worker choice strategy attached to the pool.
24 * @param pool The pool instance.
27 protected readonly pool
: IPoolInternal
<Worker
, Data
, Response
>
31 public abstract choose (): Worker