X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Finterfaces%2FIPool.html;h=d6e44aaa5dbac3bc8406be38c9a3951c5d51c281;hb=7455be54c58f74c6f0d0dd597aa431a88da0a9d8;hp=488af2256da5e6129e0d55a34e7cda2bc7b4bea0;hpb=c0b0686de0f8c5483b20b94fac97d2b8175c0556;p=poolifier.git diff --git a/docs/interfaces/IPool.html b/docs/interfaces/IPool.html index 488af225..d6e44aaa 100644 --- a/docs/interfaces/IPool.html +++ b/docs/interfaces/IPool.html @@ -1,125 +1,361 @@ -IPool | poolifier
+IPool | poolifier - v2.6.42
-
+
  • The search index is not available
  • poolifier - v2.6.42 +
    -
    +
    -

    Interface IPool<Data, Response>

    +

    Interface IPool<Worker, Data, Response>

    Contract definition for a poolifier pool.

    -
    -
    +
    +
    +

    Type Parameters

    -
    +

    Response = unknown

    +

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

    +
    +

    Hierarchy

    - +
    -

    Methods

    -
    - -
      - +

      Properties

      +
      + +
      destroy: (() => Promise<void>)
      +
      +

      Type declaration

      +
        +
      • +
          +
        • (): Promise<void>
        • -

          Shut down every current worker in this pool.

          +

          Terminates all workers in this pool.

          +
          +

          Returns Promise<void>

          +
      +
      + +
      emitter?: PoolEmitter
      +

      Emitter on which events can be listened to.

      +

      Events that can currently be listened to:

      +
        +
      • '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).
      • +
      -

      Returns Promise<void>

    -
    - -
    +
    + +
    enableTasksQueue: ((enable, tasksQueueOptions?) => void)
    +
    +

    Type declaration

    +
      +
    • +
        +
      • (enable, tasksQueueOptions?): void
      • -

        Perform the task specified in the constructor with the data parameter.

        +

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

        +
        +
        +

        Parameters

        +
          +
        • +
          enable: boolean
          +

          Whether to enable or disable the worker node tasks queue.

          +
          +
        • +
        • +
          Optional tasksQueueOptions: TasksQueueOptions
          +

          The worker node tasks queue options.

          +
          +
        +

        Returns void

        +
    +
    + +
    execute: ((data?, name?, transferList?) => Promise<Response>)
    +
    +

    Type declaration

    +
      +
    • +
        +
      • (data?, name?, transferList?): Promise<Response>
      • +
      • +

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

        -

        Returns

        Promise that will be resolved when the task is successfully completed.

        +
    +
    + +
    hasWorkerNodeBackPressure: ((workerNodeKey) => boolean)
    +
    +

    Type declaration

    +
      +
    • +
        +
      • (workerNodeKey): boolean
      • +
      • Internal +

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

        Parameters

        • -
          data: Data
          -

          The input for the specified task. This can only be serializable data.

          -
        -

        Returns Promise<Response>

    +

    Returns boolean

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

    + +
    +
    + +
    info: PoolInfo
    +

    Pool information.

    +
    +
    +
    + +
    listTaskFunctions: (() => string[])
    +
    +

    Type declaration

    +
    +
    + +
    setTasksQueueOptions: ((tasksQueueOptions) => void)
    +
    +

    Type declaration

    +
    -
    - -
    +
    + +
    setWorkerChoiceStrategy: ((workerChoiceStrategy, workerChoiceStrategyOptions?) => void)
    +
    +

    Type declaration

    +
    +

    Returns void

    +
    - +
    + -
    +
    +

    On This Page

    - -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +
  • destroy
  • +
  • emitter
  • +
  • enableTasksQueue
  • +
  • execute
  • +
  • hasWorkerNodeBackPressure
  • +
  • info
  • +
  • listTaskFunctions
  • +
  • setTasksQueueOptions
  • +
  • setWorkerChoiceStrategy
  • +
  • setWorkerChoiceStrategyOptions
  • +
  • workerNodes
  • + +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file