X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FDynamicClusterPool.html;h=0978d5eb30cec731c40f8eb99172a245b9a4ec44;hb=95c333666812f5db34b93c20d8851f2755d1c920;hp=c0ec5c9fe7ce8aeb529270abc81e7d2303327642;hpb=a15339d10554e3130fa1d8957163cb29a8eb2c41;p=poolifier.git diff --git a/docs/classes/DynamicClusterPool.html b/docs/classes/DynamicClusterPool.html index c0ec5c9f..0978d5eb 100644 --- a/docs/classes/DynamicClusterPool.html +++ b/docs/classes/DynamicClusterPool.html @@ -1,4 +1,4 @@ -DynamicClusterPool | poolifier - v2.6.12
+DynamicClusterPool | poolifier - v2.6.34
  • Preparing search index...
  • -
  • The search index is not available
poolifier - v2.6.12
+
  • The search index is not available
  • poolifier - v2.6.34
    @@ -45,7 +45,7 @@ When the maximum number of workers is reached and workers are busy, an event is
    • DynamicClusterPool
    +
  • Defined in src/pools/cluster/dynamic.ts:15
  • @@ -59,7 +59,7 @@ When the maximum number of workers is reached and workers are busy, an event is

    Properties

    +
  • Defined in src/pools/cluster/dynamic.ts:27
  • Properties

    @@ -153,17 +159,19 @@ When the maximum number of workers is reached and workers are busy, an event is

    Emitter on which events can be listened to.

    Events that can currently be listened to:

      -
    • 'full': Emitted when the pool is dynamic and the number of workers created has reached the maximum size expected.
    • 'ready': Emitted when the number of workers created in the pool has reached the minimum size expected and are ready.
    • 'busy': Emitted when the number of workers created in the pool has reached the maximum size expected and are executing at least one task.
    • +
    • 'full': Emitted when the pool is dynamic and the number of workers created has reached the maximum size expected.
    • +
    • 'destroy': Emitted when the pool is destroyed.
    • 'error': Emitted when an uncaught error occurs.
    • '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).
    +
  • Defined in src/pools/abstract-pool.ts:66
  • filePath: string
    @@ -172,15 +180,16 @@ When the maximum number of workers is reached and workers are busy, an event is
    -
    +
  • Defined in src/pools/abstract-pool.ts:115
  • +
    max: number

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

    +
  • Defined in src/pools/cluster/dynamic.ts:29
  • numberOfWorkers: number
    @@ -189,7 +198,7 @@ When the maximum number of workers is reached and workers are busy, an event is
    +
  • Defined in src/pools/abstract-pool.ts:114
  • @@ -198,11 +207,11 @@ When the maximum number of workers is reached and workers are busy, an event is
    +
  • Defined in src/pools/cluster/fixed.ts:47
  • -
    promiseResponseMap: Map<string, PromiseResponseWrapper<Worker, Response>> = ...
    -

    The execution response promise map.

    +
    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.
    • @@ -212,7 +221,7 @@ When the maximum number of workers is reached and workers are busy, an event is
    +
  • Defined in src/pools/abstract-pool.ts:76
  • workerChoiceStrategyContext: WorkerChoiceStrategyContext<Worker, Data, Response>
    @@ -221,16 +230,16 @@ When the maximum number of workers is reached and workers are busy, an event is
    +
  • Defined in src/pools/abstract-pool.ts:82
  • - +
    workerNodes: IWorkerNode<Worker, Data>[] = []

    Pool worker nodes.

    +
  • Defined in src/pools/abstract-pool.ts:63
  • Accessors

    @@ -245,7 +254,7 @@ When the maximum number of workers is reached and workers are busy, an event is
    +
  • Defined in src/pools/cluster/dynamic.ts:43
    • @@ -258,7 +267,7 @@ When the maximum number of workers is reached and workers are busy, an event is
    +
  • Defined in src/pools/abstract-pool.ts:682
    • @@ -270,93 +279,87 @@ When the maximum number of workers is reached and workers are busy, an event is
    -
    +
  • Defined in src/pools/abstract-pool.ts:354
  • +
    -
      +
      • get maxSize(): number
      • -

        Pool maximum size.

        +

        The pool maximum size.

        Returns number

    +
  • Defined in src/pools/abstract-pool.ts:555
    • get minSize(): number
    • -

      Pool minimum size.

      +

      The pool minimum size.

      Returns number

    +
  • Defined in src/pools/abstract-pool.ts:548
    • get ready(): boolean
    • -

      Returns boolean

    -
    - -
    +
  • Defined in src/pools/abstract-pool.ts:500
    • get type(): "fixed" | "dynamic"
    • -

      Pool type.

      +

      The pool type.

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

      Returns "fixed" | "dynamic"

    +
  • Defined in src/pools/cluster/dynamic.ts:38
    • get utilization(): number
    • -

      Gets the approximate pool utilization.

      +

      The approximate pool utilization.

      Returns number

      The pool utilization.

    +
  • Defined in src/pools/abstract-pool.ts:517
    • -
    • get worker(): "cluster" | "thread"
    • +
    • get worker(): "thread" | "cluster"
    • -

      Gets the worker type.

      +

      The worker type.

      -

      Returns "cluster" | "thread"

      +

      Returns "thread" | "cluster"

    +
  • Defined in src/pools/cluster/fixed.ts:115
  • Methods

      - +
    • Hook executed after the worker task execution. Can be overridden.

      @@ -365,8 +368,8 @@ Can be overridden.

      Parameters

    -
    - +
  • Defined in src/pools/abstract-pool.ts:879
  • +
    +
      - +
    • -

      Function that can be hooked up when a worker has been newly created and moved to the pool worker nodes. +

      Method hooked up after a worker node has been newly created. Can be overridden.

      Parameters

      • -
        worker: Worker
        -

        The newly created worker.

        +
        workerNodeKey: number
        +

        The newly created worker node key.

      Returns void

    +
  • Defined in src/pools/abstract-pool.ts:1151
  • +
  • Defined in src/pools/abstract-pool.ts:849
  • -
    - +
  • Defined in src/pools/abstract-pool.ts:185
  • +
    +
    -
    - +
  • Defined in src/pools/abstract-pool.ts:1094
  • +
    +
    +
  • Defined in src/pools/abstract-pool.ts:1050
  • +
  • Defined in src/pools/cluster/fixed.ts:105
  • -
    - +
  • Defined in src/pools/abstract-pool.ts:794
  • +
    +
    +
  • Defined in src/pools/cluster/fixed.ts:63
    • -

      Enables/disables the worker tasks queue in this pool.

      +

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

      Parameters

      • enable: boolean
        -

        Whether to enable or disable the worker tasks queue.

        +

        Whether to enable or disable the worker node tasks queue.

      • Optional tasksQueueOptions: TasksQueueOptions
        -

        The worker tasks queue options.

        +

        The worker node tasks queue options.

      Returns void

    +
  • Defined in src/pools/abstract-pool.ts:636
    • - +
    • Executes the specified function in the worker constructor with the task data input parameter.

      @@ -550,12 +553,17 @@ Can be overridden.

      • Optional data: Data
        -

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

        +

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

      • Optional name: string
        -

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

        +

        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 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.

    @@ -563,20 +571,76 @@ Can be overridden.

    +
  • Defined in src/pools/abstract-pool.ts:732
  • +
    + +
    +
    + +
    +
    + +
      + +
    • Internal +

      Whether the worker node has back pressure (i.e. its tasks queue is full).

      +
      +
      +

      Parameters

      +
        +
      • +
        workerNodeKey: number
        +

        The worker node key.

        +
        +
      +

      Returns boolean

      true if the worker node has back pressure, false otherwise.

      + +
    • -

      Whether worker nodes are executing at least one task.

      +

      Whether worker nodes are executing concurrently their tasks quota or not.

      Returns boolean

      Worker nodes busyness boolean status.

    +
  • Defined in src/pools/abstract-pool.ts:698
  • +
  • Defined in src/pools/cluster/fixed.ts:58
  • +
    + +
    +
    + +
      + +
    • +

      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

      +
    +
    + +
    +
    + +
      - +
    • -

      Sends a message to the given worker.

      +

      Sends a message to worker given its worker node key.

      Parameters

    +
  • Defined in src/pools/cluster/fixed.ts:81
  • +
  • Defined in src/pools/abstract-pool.ts:648
  • +
  • Defined in src/pools/abstract-pool.ts:603
  • +
  • Defined in src/pools/abstract-pool.ts:622
  • +
  • Defined in src/pools/cluster/fixed.ts:53
    • -

      This function is the listener registered for each worker message.

      +

      This method is the listener registered for each worker message.

      Returns ((message) => void)

      The listener function to execute when a message is received from a worker.

      @@ -706,7 +860,7 @@ Can be overridden.

    +
  • Defined in src/pools/abstract-pool.ts:1302