Interface IWorkerChoiceStrategyInternal

Worker choice strategy interface.

interface IWorkerChoiceStrategy {
    choose: (() => undefined | number);
    remove: ((workerNodeKey: number) => boolean);
    reset: (() => boolean);
    setOptions: ((opts: undefined | WorkerChoiceStrategyOptions) => void);
    strategyPolicy: StrategyPolicy;
    taskStatisticsRequirements: TaskStatisticsRequirements;
    update: ((workerNodeKey: number) => boolean);
}

Properties

choose: (() => undefined | number)

Chooses a worker node in the pool and returns its key. If no worker nodes are not eligible, undefined is returned. If undefined is returned, the caller retry.

Type declaration

    • (): undefined | number
    • Returns undefined | number

      The worker node key or undefined.

remove: ((workerNodeKey: number) => boolean)

Removes the worker node key from strategy internals.

Type declaration

    • (workerNodeKey): boolean
    • Parameters

      • workerNodeKey: number

        The worker node key.

      Returns boolean

      true if the worker node key is removed, false otherwise.

reset: (() => boolean)

Resets strategy internals.

Type declaration

    • (): boolean
    • Returns boolean

      true if the reset is successful, false otherwise.

setOptions: ((opts: undefined | WorkerChoiceStrategyOptions) => void)

Sets the worker choice strategy options.

Type declaration

strategyPolicy: StrategyPolicy

Strategy policy.

taskStatisticsRequirements: TaskStatisticsRequirements

Tasks statistics requirements.

update: ((workerNodeKey: number) => boolean)

Updates the worker node key strategy internals. This is called after a task has been executed on a worker node.

Type declaration

    • (workerNodeKey): boolean
    • Parameters

      • workerNodeKey: number

      Returns boolean

      true if the update is successful, false otherwise.