X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FDynamicThreadPool.html;h=83acc6eb74f7161a5f5c73c93a55ab53475f3c0d;hb=7455be54c58f74c6f0d0dd597aa431a88da0a9d8;hp=fcd381101e5f9fcb0585834eb15909697474e9de;hpb=fddf9cc424b3ace38fd414899c666c76a03c3aff;p=poolifier.git diff --git a/docs/classes/DynamicThreadPool.html b/docs/classes/DynamicThreadPool.html index fcd38110..83acc6eb 100644 --- a/docs/classes/DynamicThreadPool.html +++ b/docs/classes/DynamicThreadPool.html @@ -1,13 +1,13 @@ -DynamicThreadPool | poolifier
+DynamicThreadPool | poolifier - v2.6.42
-
+
  • The search index is not available
  • poolifier - v2.6.42 +
    @@ -30,12 +30,12 @@ When the maximum number of threads is reached and workers are busy, an event is
    • Data = unknown

      -

      Type of data sent to the worker. This can only be serializable data.

      +

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

    • Response = unknown

      -

      Type of execution response. This can only be serializable data.

      +

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

    @@ -45,21 +45,21 @@ When the maximum number of threads is reached and workers are busy, an event is
    • DynamicThreadPool
    +
  • Defined in src/pools/thread/dynamic.ts:15
  • - +

    Constructors

    -

    Properties

    -
    emitter? +
    emitter? filePath -max +max numberOfWorkers opts promiseResponseMap @@ -68,29 +68,38 @@ When the maximum number of threads is reached and workers are busy, an event is

    Accessors

    -

    Methods

    -
    afterTaskExecutionHook -afterWorkerSetup +
    afterTaskExecutionHook +afterWorkerNodeSetup beforeTaskExecutionHook -chooseWorkerNode -createAndSetupWorker +checkDynamicPoolSize +createAndSetupDynamicWorkerNode +createAndSetupWorkerNode createWorker destroy -destroyWorker +destroyWorkerNode enableTasksQueue execute +flushTasksQueue +getWorkerInfo +hasWorkerNodeBackPressure internalBusy isMain +listTaskFunctions registerWorkerMessageListener +sendKillMessageToWorker +sendStartupMessageToWorker sendToWorker setTasksQueueOptions setWorkerChoiceStrategy @@ -101,7 +110,7 @@ When the maximum number of threads is reached and workers are busy, an event is

    Constructors

    - +
    • @@ -133,7 +142,7 @@ When the maximum number of threads is reached and workers are busy, an event is
  • -
    opts: PoolOptions<ThreadWorkerWithMessageChannel> = {}
    +
    opts: ThreadPoolOptions = {}

    Options for this dynamic thread pool.

  • @@ -141,7 +150,7 @@ When the maximum number of threads is reached and workers are busy, an event is
    +
  • Defined in src/pools/thread/dynamic.ts:27
  • Properties

    @@ -150,16 +159,19 @@ When the maximum number of threads 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 full.
    • -
    • 'busy': Emitted when the pool is busy.
    • +
    • '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 concurrently their tasks quota.
    • +
    • '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:68
  • filePath: string
    @@ -168,15 +180,16 @@ When the maximum number of threads is reached and workers are busy, an event is
    -
    +
  • Defined in src/pools/abstract-pool.ts:117
  • +
    max: number

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

    +
  • Defined in src/pools/thread/dynamic.ts:29
  • numberOfWorkers: number
    @@ -185,20 +198,20 @@ When the maximum number of threads is reached and workers are busy, an event is
    +
  • Defined in src/pools/abstract-pool.ts:116
  • - -

    Options for the pool.

    + +

    Options for this fixed thread pool.

    +
  • Defined in src/pools/thread/fixed.ts:49
  • -
    promiseResponseMap: Map<string, PromiseResponseWrapper<ThreadWorkerWithMessageChannel, 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.
    • @@ -208,26 +221,25 @@ When the maximum number of threads is reached and workers are busy, an event is
    +
  • Defined in src/pools/abstract-pool.ts:78
  • -
    workerChoiceStrategyContext: WorkerChoiceStrategyContext<ThreadWorkerWithMessageChannel, Data, Response>
    +
    workerChoiceStrategyContext: WorkerChoiceStrategyContext<Worker, Data, Response>

    Worker choice strategy context referencing a worker choice algorithm implementation.

    -

    Default to a round robin algorithm.

    +
  • Defined in src/pools/abstract-pool.ts:84
  • - -
    workerNodes: WorkerNode<ThreadWorkerWithMessageChannel, Data>[] = []
    + +
    workerNodes: IWorkerNode<Worker, Data>[] = []

    Pool worker nodes.

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

    @@ -242,7 +254,7 @@ When the maximum number of threads is reached and workers are busy, an event is
    +
  • Defined in src/pools/thread/dynamic.ts:43
    • @@ -255,7 +267,7 @@ When the maximum number of threads is reached and workers are busy, an event is
    +
  • Defined in src/pools/abstract-pool.ts:689
    • @@ -267,62 +279,87 @@ When the maximum number of threads is reached and workers are busy, an event is
    -
    +
  • Defined in src/pools/abstract-pool.ts:350
  • +
    -
      +
      • get maxSize(): number
      • -

        Pool maximum size.

        +

        The pool maximum size.

        Returns number

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

      Pool minimum size.

      +

      The pool minimum size.

      Returns number

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

      The pool readiness boolean status.

      +
      +

      Returns boolean

      +
    • 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/thread/dynamic.ts:38
  • +
    + +
      +
    • get utilization(): number
    • +
    • +

      The approximate pool utilization.

      +
      +

      Returns number

      The pool utilization.

      + +
      -
    • 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/thread/fixed.ts:130
  • Methods

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

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

      -

      Can be used to update the maxListeners or binding the main-worker<->worker connection if not bind by default.

      +

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

      Parameters

      Returns void

    +
  • Defined in src/pools/abstract-pool.ts:1162
    • - +
    • Hook executed before the worker task execution. Can be overridden.

      @@ -381,112 +418,133 @@ Can be overridden.

      workerNodeKey: number

      The worker node key.

      +
    • +
    • +
      task: Task<Data>
      +

      The task to execute.

      +

    Returns void

    -
    - +
  • Defined in src/pools/abstract-pool.ts:858
  • +
    + +
    +
    +
    -
    - +
  • Defined in src/pools/abstract-pool.ts:1105
  • +
    +
    +
  • Defined in src/pools/abstract-pool.ts:1061
  • +
  • Defined in src/pools/thread/fixed.ts:117
  • -
    - +
  • Defined in src/pools/abstract-pool.ts:803
  • +
    +
    +
  • Defined in src/pools/thread/fixed.ts:60
    • -

      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:643
    • - +
    • Executes the specified function in the worker constructor with the task data input parameter.

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

      • Optional data: Data
        -

        The task input data for the specified worker function. This can only be serializable 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.

    @@ -508,16 +571,76 @@ Can be overridden.

    +
  • Defined in src/pools/abstract-pool.ts:747
  • +
    + +
    +
    + +
    +
    + +
    +
  • Defined in src/pools/abstract-pool.ts:705
  • +
  • Defined in src/pools/thread/fixed.ts:55
  • +
    + +

    Returns void

    Returns void

    +
  • Defined in src/pools/thread/fixed.ts:107
  • +
    + +
    +
    + +
    +
  • Defined in src/pools/thread/fixed.ts:80
  • +
  • Defined in src/pools/abstract-pool.ts:655
  • +
  • Defined in src/pools/abstract-pool.ts:610
  • +
  • Defined in src/pools/abstract-pool.ts:629
  • +
  • Defined in src/pools/abstract-pool.ts:842
  • +
  • Defined in src/pools/abstract-pool.ts:1321
  • @@ -724,7 +901,7 @@ Can be overridden

  • constructor
  • emitter
  • filePath
  • -
  • max
  • +
  • max
  • numberOfWorkers
  • opts
  • promiseResponseMap
  • @@ -733,23 +910,32 @@ Can be overridden

  • busy
  • full
  • info
  • -
  • maxSize
  • +
  • maxSize
  • minSize
  • +
  • ready
  • type
  • +
  • utilization
  • worker
  • afterTaskExecutionHook
  • -
  • afterWorkerSetup
  • +
  • afterWorkerNodeSetup
  • beforeTaskExecutionHook
  • -
  • chooseWorkerNode
  • -
  • createAndSetupWorker
  • +
  • checkDynamicPoolSize
  • +
  • createAndSetupDynamicWorkerNode
  • +
  • createAndSetupWorkerNode
  • createWorker
  • destroy
  • -
  • destroyWorker
  • +
  • destroyWorkerNode
  • enableTasksQueue
  • execute
  • +
  • flushTasksQueue
  • +
  • getWorkerInfo
  • +
  • hasWorkerNodeBackPressure
  • internalBusy
  • isMain
  • +
  • listTaskFunctions
  • registerWorkerMessageListener
  • +
  • sendKillMessageToWorker
  • +
  • sendStartupMessageToWorker
  • sendToWorker
  • setTasksQueueOptions
  • setWorkerChoiceStrategy
  • @@ -757,55 +943,30 @@ Can be overridden

  • setupHook
  • workerListener
  • +
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Generated using TypeDoc

    +
    \ No newline at end of file