X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FDynamicClusterPool.html;h=11573963370f9f7fb7d4d2303f58f6ed154604dd;hb=1825833668c55e5638dc2e8d6ae711f69dba0181;hp=38d935320e71d38c3fbe0e786fa8874dc4ef5a5e;hpb=cd3135e48c6ba3fb7bdfe3da9ac47ad6805e8797;p=poolifier.git diff --git a/docs/classes/DynamicClusterPool.html b/docs/classes/DynamicClusterPool.html index 38d93532..11573963 100644 --- a/docs/classes/DynamicClusterPool.html +++ b/docs/classes/DynamicClusterPool.html @@ -5,7 +5,7 @@ When the maximum number of workers is reached and workers are busy, an event is

Since

2.0.0

Type Parameters

Hierarchy

Constructors

Hierarchy

Constructors

Properties

emitter? filePath max @@ -56,12 +56,12 @@ When the maximum number of workers is reached and workers are busy, an event is setupHook start workerMessageListener -

Constructors

  • Constructs a new poolifier dynamic cluster pool.

    +

Constructors

Properties

emitter?: EventEmitterAsyncResource

Event emitter integrated with async resource on which events can be listened to. +

Returns DynamicClusterPool<Data, Response>

Properties

emitter?: EventEmitterAsyncResource

Event emitter integrated with async resource on which events can be listened to. The async tracking tooling identifier is poolifier:<PoolType>-<WorkerType>-pool.

Events that can currently be listened to:

    @@ -73,109 +73,109 @@ The async tracking tooling identifier is poolifier:<PoolType>-<Wo
  • 'taskError': Emitted when an error occurs while executing a task.
  • 'backPressure': Emitted when all worker nodes have back pressure (i.e. their tasks queue is full: queue size >= maximum queue size).
-
filePath: string

Path to the worker file.

-
max: number

Maximum number of workers that can be created by this pool.

-
numberOfWorkers: number

Number of workers that this pool should manage.

-

Options for this fixed cluster pool.

-
promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...

The task execution response promise map:

+
filePath: string

Path to the worker file.

+
max: number

Maximum number of workers that can be created by this pool.

+
numberOfWorkers: number

Number of workers that this pool should manage.

+

Options for this fixed cluster pool.

+
promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...

The task execution response promise map:

  • key: The message id of each submitted task.
  • value: An object that contains the worker, the execution response promise resolve and reject callbacks.

When we receive a message from the worker, we get a map entry with the promise resolve/reject bound to the message id.

-
workerChoiceStrategyContext: WorkerChoiceStrategyContext<Worker, Data, Response>

Worker choice strategy context referencing a worker choice algorithm implementation.

-
workerNodes: IWorkerNode<Worker, Data>[] = []

Pool worker nodes.

-

Accessors

workerChoiceStrategyContext: WorkerChoiceStrategyContext<Worker, Data, Response>

Worker choice strategy context referencing a worker choice algorithm implementation.

+
workerNodes: IWorkerNode<Worker, Data>[] = []

Pool worker nodes.

+

Accessors

  • get busy(): boolean
  • Whether the pool is busy or not.

    The pool busyness boolean status.

    -

    Returns boolean

  • get full(): boolean
  • Whether the pool is full or not.

    The pool filling boolean status.

    -

    Returns boolean

  • get type(): "fixed" | "dynamic"
  • The pool type.

    If it is 'dynamic', it provides the max property.

    -

    Returns "fixed" | "dynamic"

  • get utilization(): number
  • The approximate pool utilization.

    +

    Returns "fixed" | "dynamic"

  • get utilization(): number
  • The approximate pool utilization.

    Returns number

    The pool utilization.

    -
  • get worker(): "thread" | "cluster"
  • The worker type.

    -

    Returns "thread" | "cluster"

Methods

  • Adds a task function to this pool. +

  • get worker(): "thread" | "cluster"
  • The worker type.

    +

    Returns "thread" | "cluster"

Methods

  • Method hooked up after a worker node has been newly created. +

Returns void

  • Hook executed before the worker task execution. +

Returns void

  • Creates a new, completely set up dynamic worker node.

    +

Returns void

  • Deregisters a listener callback on the worker given its worker node key.

    Type Parameters

    • Message

    Parameters

    • workerNodeKey: number

      The worker node key.

    • listener: ((message) => void)

      The message listener callback.

      -
        • (message): void
        • Parameters

          Returns void

    Returns void

  • Terminates the worker node given its worker node key.

    +
      • (message): void
      • Parameters

        Returns void

Returns void

  • Enables/disables the worker node tasks queue in this pool.

    +

Returns Promise<void>

  • Executes the specified function in the worker constructor with the task data input parameter.

    +

Returns void

  • Executes the specified function in the worker constructor with the task data input parameter.

    Parameters

    • Optional data: Data

      The optional task input data for the specified task function. This can only be structured-cloneable data.

    • Optional name: string

      The optional name of the task function to execute. If not specified, the default task function will be executed.

    • Optional transferList: TransferListItem[]

      An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the chosen pool's worker_threads worker and they should not be used in the main thread afterwards.

    Returns Promise<Response>

    Promise that will be fulfilled when the task is completed.

    -
  • Registers once a listener callback on the worker given its worker node key.

    Type Parameters

    • Message

    Parameters

    • workerNodeKey: number

      The worker node key.

    • listener: ((message) => void)

      The message listener callback.

      -
        • (message): void
        • Parameters

          Returns void

    Returns void

  • Registers a listener callback on the worker given its worker node key.

    +
      • (message): void
      • Parameters

        Returns void

Returns void

  • Registers a listener callback on the worker given its worker node key.

    Type Parameters

    • Message

    Parameters

    • workerNodeKey: number

      The worker node key.

    • listener: ((message) => void)

      The message listener callback.

      -
        • (message): void
        • Parameters

          Returns void

    Returns void

  • Removes a task function from this pool.

    +
      • (message): void
      • Parameters

        Returns void

Returns void

  • Sends a message to worker given its worker node key.

    +

Returns void

  • Sets the default task function in this pool.

    +

Returns void

  • Sets the worker choice strategy in this pool.

    +

Returns void

  • Sets the worker choice strategy in this pool.

    Parameters

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

      The worker choice strategy.

    • Optional workerChoiceStrategyOptions: WorkerChoiceStrategyOptions

      The worker choice strategy options.

      -

    Returns void

  • Sets the worker choice strategy options in this pool.

    +

Returns void

  • Setup hook to execute code before worker nodes are created in the abstract constructor. +

Returns void

Generated using TypeDoc

\ No newline at end of file +

Returns void

Generated using TypeDoc

\ No newline at end of file