class AbstractWorkerChoiceStrategy
implements IWorkerChoiceStrategy
Abstract
import { AbstractWorkerChoiceStrategy } from "https://deno.land/x/poolifier@v0.3.14/src/pools/selection-strategies/abstract-worker-choice-strategy.ts";
Worker choice strategy abstract base class.
Constructors
new
AbstractWorkerChoiceStrategy(pool: IPool<Worker, Data, Response>, opts?: WorkerChoiceStrategyOptions)Constructs a worker choice strategy bound to the pool.
Properties
readonly
strategyPolicy: StrategyPolicyreadonly
taskStatisticsRequirements: TaskStatisticsRequirementsMethods
private
toggleMedianMeasurementStatisticsRequirements(measurementStatisticsRequirements: MeasurementStatisticsRequirements, toggleMedian: boolean): voidprotected
checkNextWorkerNodeKey(): voidCheck the next worker node key.
protected
getWorkerNodeTaskRunTime(workerNodeKey: number): numberGets the worker node task runtime. If the task statistics require the average runtime, the average runtime is returned. If the task statistics require the median runtime , the median runtime is returned.
protected
getWorkerNodeTaskWaitTime(workerNodeKey: number): numberGets the worker node task wait time. If the task statistics require the average wait time, the average wait time is returned. If the task statistics require the median wait time, the median wait time is returned.
protected
isWorkerNodeReady(workerNodeKey: number): booleanWhether the worker node is ready or not.
protected
resetWorkerNodeKeyProperties(): voidprotected
setPreviousWorkerNodeKey(workerNodeKey: number | undefined): voidSets safely the previous worker node key.
protected
setTaskStatisticsRequirements(opts: WorkerChoiceStrategyOptions | undefined): voidabstract
choose(): number | undefinedabstract
remove(workerNodeKey: number): booleanabstract
reset(): booleansetOptions(opts: WorkerChoiceStrategyOptions | undefined): void
abstract
update(workerNodeKey: number): boolean