X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FWorkerChoiceStrategiesContext.html;h=606cb15d35b6cedfff9b19c4395be6eb4176324a;hb=c8576e5fe740384f6f61316b7f09a788a14ab0ef;hp=7ee0fe4f2a95231fc4a1e8468824f759cfc42338;hpb=840d17551c284ee8639e18de5c359be5118290bd;p=poolifier.git diff --git a/docs/classes/WorkerChoiceStrategiesContext.html b/docs/classes/WorkerChoiceStrategiesContext.html index 7ee0fe4f..606cb15d 100644 --- a/docs/classes/WorkerChoiceStrategiesContext.html +++ b/docs/classes/WorkerChoiceStrategiesContext.html @@ -1,8 +1,8 @@ -WorkerChoiceStrategiesContext | poolifier - v4.0.0

Class WorkerChoiceStrategiesContext<Worker, Data, Response>

The worker choice strategies context.

+WorkerChoiceStrategiesContext | poolifier - v4.0.1

Class WorkerChoiceStrategiesContext<Worker, Data, Response>

The worker choice strategies context.

Type Parameters

  • Worker extends IWorker

    Type of worker.

  • Data = unknown

    Type of data sent to the worker. This can only be structured-cloneable data.

  • Response = unknown

    Type of execution response. This can only be structured-cloneable data.

    -

Constructors

Constructors

Properties

  • Optional opts: WorkerChoiceStrategyOptions

    The worker choice strategy options.

  • Returns WorkerChoiceStrategiesContext<Worker, Data, Response>

    Default Value

    [WorkerChoiceStrategies.ROUND_ROBIN]
     
    -

    Properties

    defaultWorkerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

    The default worker choice strategy in the context.

    -

    The pool instance.

    -
    retries: number

    The maximum number of worker choice strategies execution retries.

    -
    retriesCount: number

    The number of worker choice strategies execution retries.

    -
    workerChoiceStrategies: Map<"ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN", IWorkerChoiceStrategy>

    The worker choice strategies registered in the context.

    -
    workerChoiceStrategiesPolicy: StrategyPolicy

    The active worker choice strategies in the context policy.

    -
    workerChoiceStrategiesTaskStatisticsRequirements: TaskStatisticsRequirements

    The active worker choice strategies in the context task statistics requirements.

    -

    Methods

    Properties

    defaultWorkerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

    The default worker choice strategy in the context.

    +

    The pool instance.

    +
    retries: number

    The maximum number of worker choice strategies execution retries.

    +
    retriesCount: number

    The number of worker choice strategies execution retries.

    +
    workerChoiceStrategies: Map<"ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN", IWorkerChoiceStrategy>

    The worker choice strategies registered in the context.

    +
    workerChoiceStrategiesPolicy: StrategyPolicy

    The active worker choice strategies in the context policy.

    +
    workerChoiceStrategiesTaskStatisticsRequirements: TaskStatisticsRequirements

    The active worker choice strategies in the context task statistics requirements.

    +

    Methods

    • Adds a worker choice strategy to the context.

      Parameters

      • workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

        The worker choice strategy to add.

      • pool: IPool<Worker, Data, Response>
      • Optional opts: WorkerChoiceStrategyOptions

        The worker choice strategy options.

      Returns Map<"ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN", IWorkerChoiceStrategy>

      The worker choice strategies.

      -
    • Executes the given worker choice strategy in the context algorithm.

      Parameters

      • workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN" = ...

        The worker choice strategy algorithm to execute.

      Returns number

      The key of the worker node.

      Default Value

      this.defaultWorkerChoiceStrategy
       

      Throws

      https://nodejs.org/api/errors.html#class-error If after computed retries the worker node key is null or undefined.

      -
    • Removes a worker choice strategy from the context.

      Parameters

      • workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

        The worker choice strategy to remove.

      Returns boolean

      true if the worker choice strategy is removed, false otherwise.

      -
    • Sets the default worker choice strategy to use in the context.

      Parameters

      • workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

        The default worker choice strategy to set.

      • Optional opts: WorkerChoiceStrategyOptions

        The worker choice strategy options.

        -

      Returns void

    • Sets the active worker choice strategies in the context options.

      +

    Returns void

    • Synchronizes the active worker choice strategies in the context with the given worker choice strategies.

      +

    Returns void

    • Synchronizes the active worker choice strategies in the context with the given worker choice strategies.

      Parameters

      • workerChoiceStrategies: Set<"ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN">

        The worker choice strategies to synchronize.

      • Optional opts: WorkerChoiceStrategyOptions

        The worker choice strategy options.

        -

      Returns void

    • Updates the worker node key in the active worker choice strategies in the context internals.

      +

    Returns void

    \ No newline at end of file +
    \ No newline at end of file