X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FDynamicThreadPool.html;h=66d9f45a8f6237d9b94258e27bce62d4bc7e8bd9;hb=edcf27c1c431dee96eb626caadefbafffb8b6897;hp=9fb9a13138f25bdbf311c1dd0aac26050f07a4ca;hpb=fa6436344997918dbda3e94063b4c2e2e4a892c3;p=poolifier.git diff --git a/docs/classes/DynamicThreadPool.html b/docs/classes/DynamicThreadPool.html index 9fb9a131..66d9f45a 100644 --- a/docs/classes/DynamicThreadPool.html +++ b/docs/classes/DynamicThreadPool.html @@ -1,15 +1,15 @@ -DynamicThreadPool | poolifier
+DynamicThreadPool | poolifier - v3.0.0
-
+
  • The search index is not available
  • poolifier - v3.0.0 +
    -
    +
    • poolifier
    • @@ -19,537 +19,1037 @@

      A thread pool with a dynamic number of threads, but a guaranteed minimum number of threads.

      This thread pool creates new threads when the others are busy, up to the maximum number of threads. When the maximum number of threads is reached and workers are busy, an event is emitted. If you want to listen to this event, use the pool's emitter.

      +
      +
      +

      Author

      Alessandro Pio Ardizio

      -

      Author

      Alessandro Pio Ardizio

      - -

      Since

      0.0.1

      +

      Since

      0.0.1

      -
      +

      Type Parameters

      -
        +
        • -

          Data = unknown

          -

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

          -
        • +

          Data = unknown

          +

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

          +
          +
        • -

          Response = unknown

          -

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

          -
      +

      Response = unknown

      +

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

      +
      +

    Hierarchy

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

    Constructors

    -
    - -
      - +
      + +
        +
      • Constructs a new poolifier dynamic thread pool.

        -
        +

        Type Parameters

        -
          +
          • -

            Data = unknown

          • +

            Data = unknown

          • -

            Response = unknown

        +

        Response = unknown

      Parameters

      • -
        min: number
        +
        min: number

        Minimum number of threads which are always active.

        -
      • +
      +
    • -
      max: number
      +
      max: number

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

      -
    • +
    +
  • -
    filePath: string
    +
    filePath: string

    Path to an implementation of a ThreadWorker file, which can be relative or absolute.

    -
  • +
    +
  • -
    opts: PoolOptions<ThreadWorkerWithMessageChannel> = {}
    +
    opts: ThreadPoolOptions = {}

    Options for this dynamic thread pool.

    -
  • -

    Returns DynamicThreadPool<Data, Response>

    +
    +

    Returns DynamicThreadPool<Data, Response>

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

    -
    - -
    emitter?: PoolEmitter
    -
    -

    Inherit Doc

    +
    + +
    max: number

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

    -
    -
    - -
    numberOfWorkers: number
    +
  • Defined in src/pools/thread/dynamic.ts:30
  • +
    + +
    numberOfWorkers: number

    Number of workers that this pool should manage.

    -
    -
    - - -

    Options for the pool.

    -
    +
    + + +

    Options for this fixed thread pool.

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

    The promise response map.

    +
  • Defined in src/pools/thread/fixed.ts:49
  • +
    + +
    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 promise resolve and reject callbacks.
    • +
    • 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.

    -
    -
    - -
    workerChoiceStrategyContext: WorkerChoiceStrategyContext<ThreadWorkerWithMessageChannel, Data, Response>
    +
  • Defined in src/pools/abstract-pool.ts:87
  • +
    + +
    workerChoiceStrategyContext: WorkerChoiceStrategyContext<Worker, Data, Response>

    Worker choice strategy context referencing a worker choice algorithm implementation.

    -

    Default to a round robin algorithm.

    -
    -
    - -
    workers: WorkerType<ThreadWorkerWithMessageChannel>[] = []
    -
    -

    Inherit Doc

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

    Pool worker nodes.

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

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

    Methods

    -
    - -
    -
    - -
    +
    + + +

    Returns void

    +
    -
    - -
    +
    + + +

    Returns void

    +
    -
    - -
    +
    + +
    -
    - -
    +
    + +
    -
    - -
    +
    + +
    -
    - -
    +
    + +
    +
    + +
    -
    - -
    +
    + + +

    Returns Promise<void>

    +
    -
    - -
    +
    + + +

    Returns void

    +
    +
    + +
    -
    - -
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    -
    - -
    +
    + +
    -
    - -
    +
    + +
    -
    - -
    +
    + +
    +
    + +

    Parameters

    Returns void

    -

    Returns void

    +
    + +
    -
    - -
    +
    + + +

    Returns Promise<boolean>

    true if the task function was removed, false otherwise.

    + +
    -
    - -
    +
    + +
    +
    + + +

    Returns void

    +
    +
    + +
    -
    - -
    +
    + + +

    Returns Promise<boolean>

    true if the default task function was set, false otherwise.

    + +
    +
    + +
    +
    + +
    -
    - -
    +
    + +
    +
    + +
    -
    - -
    +
    + +
    +
    + +
    - +
    +
    +
    +

    On This Page

    - -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +
  • constructor
  • +
  • emitter
  • +
  • filePath
  • +
  • max
  • +
  • numberOfWorkers
  • +
  • opts
  • +
  • promiseResponseMap
  • +
  • workerChoiceStrategyContext
  • +
  • workerNodes
  • +
  • busy
  • +
  • full
  • +
  • info
  • +
  • maxSize
  • +
  • minSize
  • +
  • ready
  • +
  • type
  • +
  • utilization
  • +
  • worker
  • +
  • addTaskFunction
  • +
  • afterTaskExecutionHook
  • +
  • afterWorkerNodeSetup
  • +
  • beforeTaskExecutionHook
  • +
  • createAndSetupDynamicWorkerNode
  • +
  • createAndSetupWorkerNode
  • +
  • createWorker
  • +
  • deregisterWorkerMessageListener
  • +
  • destroy
  • +
  • destroyWorkerNode
  • +
  • enableTasksQueue
  • +
  • execute
  • +
  • flushTasksQueue
  • +
  • getWorkerInfo
  • +
  • hasTaskFunction
  • +
  • hasWorkerNodeBackPressure
  • +
  • internalBusy
  • +
  • isMain
  • +
  • listTaskFunctionNames
  • +
  • registerOnceWorkerMessageListener
  • +
  • registerWorkerMessageListener
  • +
  • removeTaskFunction
  • +
  • sendKillMessageToWorker
  • +
  • sendStartupMessageToWorker
  • +
  • sendToWorker
  • +
  • setDefaultTaskFunction
  • +
  • setTasksQueueOptions
  • +
  • setWorkerChoiceStrategy
  • +
  • setWorkerChoiceStrategyOptions
  • +
  • setupHook
  • +
  • start
  • +
  • workerMessageListener
  • + +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file