X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FDynamicThreadPool.html;h=5301f5d93bf76eb154dfbb1ac00122cfaac62c6a;hb=4608939f425568da5553db1f5bf883d4cca18e02;hp=e301801f5a15285b3f70cb245ab11503d060be8a;hpb=c065162cbd0458f984708314dcf5e80c7777077a;p=poolifier.git diff --git a/docs/classes/DynamicThreadPool.html b/docs/classes/DynamicThreadPool.html index e301801f..5301f5d9 100644 --- a/docs/classes/DynamicThreadPool.html +++ b/docs/classes/DynamicThreadPool.html @@ -1,13 +1,13 @@ -DynamicThreadPool | poolifier - v2.6.18
+DynamicThreadPool | poolifier - v2.6.45
-
+
  • The search index is not available
  • poolifier - v2.6.45 +
    @@ -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

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

    @@ -152,17 +160,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 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.
    • +
    • '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
    @@ -171,15 +181,16 @@ When the maximum number of threads is reached and workers are busy, an event is
    -
    +
  • Defined in src/pools/abstract-pool.ts:116
  • +
    max: number

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

    +
  • Defined in src/pools/thread/dynamic.ts:29
  • numberOfWorkers: number
    @@ -188,7 +199,7 @@ When the maximum number of threads is reached and workers are busy, an event is
    +
  • Defined in src/pools/abstract-pool.ts:115
  • @@ -197,11 +208,11 @@ When the maximum number of threads is reached and workers are busy, an event is
    +
  • Defined in src/pools/thread/fixed.ts:49
  • -
    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.
    • @@ -211,7 +222,7 @@ When the maximum number of threads is reached and workers are busy, an event is
    +
  • Defined in src/pools/abstract-pool.ts:77
  • workerChoiceStrategyContext: WorkerChoiceStrategyContext<Worker, Data, Response>
    @@ -220,16 +231,16 @@ When the maximum number of threads is reached and workers are busy, an event is
    +
  • Defined in src/pools/abstract-pool.ts:83
  • - +
    workerNodes: IWorkerNode<Worker, Data>[] = []

    Pool worker nodes.

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

    @@ -244,7 +255,7 @@ When the maximum number of threads is reached and workers are busy, an event is
    +
  • Defined in src/pools/thread/dynamic.ts:43
    • @@ -257,7 +268,7 @@ When the maximum number of threads is reached and workers are busy, an event is
    +
  • Defined in src/pools/abstract-pool.ts:676
    • @@ -269,84 +280,87 @@ When the maximum number of threads is reached and workers are busy, an event is
    -
    +
  • Defined in src/pools/abstract-pool.ts:334
  • +
    -
      +
      • get maxSize(): number
      • -

        Pool maximum size.

        +

        The pool maximum size.

        Returns number

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

      Pool minimum size.

      +

      The pool minimum size.

      Returns number

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

      Returns boolean

    +
  • Defined in src/pools/abstract-pool.ts:492
    • 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
    • -

      Gets the approximate pool utilization.

      +

      The approximate pool utilization.

      Returns number

      The pool utilization.

    +
  • Defined in src/pools/abstract-pool.ts:509
    • -
    • 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

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

      @@ -355,8 +369,8 @@ Can be overridden.

      Parameters

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

      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:1163
  • +
  • Defined in src/pools/abstract-pool.ts:859
  • -
    - +
  • Defined in src/pools/abstract-pool.ts:187
  • +
    +
    -
    - +
  • Defined in src/pools/abstract-pool.ts:1106
  • +
    +
    +
  • Defined in src/pools/abstract-pool.ts:1062
  • +
  • Defined in src/pools/thread/fixed.ts:117
  • -
    - +
  • Defined in src/pools/abstract-pool.ts:804
  • +
    +
    +
  • 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:628
    • - +
    • Executes the specified function in the worker constructor with the task data input parameter.

      @@ -540,12 +554,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.

    @@ -553,20 +572,76 @@ Can be overridden.

    +
  • Defined in src/pools/abstract-pool.ts:733
  • +
    + +
    +
    + +
    +
    + +
      + +
    • 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:692
  • +
  • Defined in src/pools/thread/fixed.ts:55
  • +
    + +
    +
    + +
      + +
    • +

      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

      • -
        worker: Worker
        -

        The worker which should receive the message.

        +
        workerNodeKey: number
        +

        The worker node key.

      • message: MessageValue<Data, unknown>

        The message.

        +
      • +
      • +
        Optional transferList: TransferListItem[]
        +

        The optional array of transferable objects.

        +

      Returns void

    +
  • Defined in src/pools/thread/fixed.ts:80
  • +
  • Defined in src/pools/abstract-pool.ts:640
  • +
  • Defined in src/pools/abstract-pool.ts:595
  • +
  • Defined in src/pools/abstract-pool.ts:614
  • +
  • Defined in src/pools/abstract-pool.ts:843
  • +
    + +
    • -

      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.

      @@ -696,7 +878,7 @@ Can be overridden.

    +
  • Defined in src/pools/abstract-pool.ts:1326
  • @@ -732,7 +914,7 @@ Can be overridden.

  • constructor
  • emitter
  • filePath
  • -
  • max
  • +
  • max
  • numberOfWorkers
  • opts
  • promiseResponseMap
  • @@ -741,93 +923,64 @@ Can be overridden.

  • busy
  • full
  • info
  • -
  • maxSize
  • +
  • maxSize
  • minSize
  • ready
  • type
  • utilization
  • worker
  • afterTaskExecutionHook
  • -
  • afterWorkerSetup
  • +
  • afterWorkerNodeSetup
  • beforeTaskExecutionHook
  • checkDynamicPoolSize
  • -
  • createAndSetupDynamicWorker
  • -
  • createAndSetupWorker
  • +
  • createAndSetupDynamicWorkerNode
  • +
  • createAndSetupWorkerNode
  • createWorker
  • destroy
  • -
  • destroyWorker
  • +
  • destroyWorkerNode
  • enableTasksQueue
  • execute
  • +
  • flushTasksQueue
  • +
  • getWorkerInfo
  • +
  • hasWorkerNodeBackPressure
  • internalBusy
  • isMain
  • +
  • listTaskFunctions
  • +
  • registerWorkerMessageListener
  • +
  • sendKillMessageToWorker
  • +
  • sendStartupMessageToWorker
  • sendToWorker
  • setTasksQueueOptions
  • setWorkerChoiceStrategy
  • setWorkerChoiceStrategyOptions
  • setupHook
  • +
  • start
  • workerListener
  • +
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Generated using TypeDoc

    +
    \ No newline at end of file