X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FDynamicThreadPool.html;h=f6495e279a204f5ba19c7dc378617f980e5bffea;hb=2a6631992868d900762f62e4c228dce4e4ee549a;hp=986df6156e33bd2478a2ae0216927dd37ba0f4dc;hpb=301c53e7ae6cf1120298ea10868a9091904c01a2;p=poolifier.git diff --git a/docs/classes/DynamicThreadPool.html b/docs/classes/DynamicThreadPool.html index 986df615..76ccf9cf 100644 --- a/docs/classes/DynamicThreadPool.html +++ b/docs/classes/DynamicThreadPool.html @@ -1,13 +1,15 @@ -DynamicThreadPool | poolifier
+DynamicThreadPool | poolifier
-
+
-
+
  • poolifier
  • @@ -16,31 +18,34 @@

    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, an event is emitted. If you want to listen to this event, use the pool's emitter.

    - -

    Template

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

    - -

    Template

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

    - -

    Author

    Alessandro Pio Ardizio

    +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

    -

    Since

    0.0.1

    +

    Since

    0.0.1

    -
    +

    Type Parameters

    -
      +
      • -

        Data = unknown

      • +

        Data = unknown

        +

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

        +
        +
      • -

        Response = unknown

    +

    Response = unknown

    +

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

    +
    +

Hierarchy

+
  • Defined in src/pools/thread/dynamic.ts:15
  • @@ -48,593 +53,654 @@ When the maximum number of threads is reached, an event is emitted. If you want

    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:27
  • Properties

    -
    - -
    emitter?: PoolEmitter
    -
    -

    Inherit Doc

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

    The execution response promise map.

      -
    • key: This is the message Id of each submitted task.
    • -
    • value: An object that contains the worker, the resolve function and the reject function.
    • +
    • key: The message id of each submitted task.
    • +
    • 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 and resolve/reject the promise based on the message.

    -
    -
    - -
    workerChoiceStrategyContext: WorkerChoiceStrategyContext<ThreadWorkerWithMessageChannel, Data, Response>
    -

    Worker choice strategy instance implementing the worker choice algorithm.

    -

    Default to a strategy implementing a round robin algorithm.

    -
    +
    + +
    workerChoiceStrategyContext: WorkerChoiceStrategyContext<Worker, Data, Response>
    +

    Worker choice strategy context referencing a worker choice algorithm implementation.

    +
    +
    -
    - - -
    -

    Inherit Doc

    -
    - -
    workersTasksUsage: Map<ThreadWorkerWithMessageChannel, TasksUsage> = ...
    -
    -

    Inherit Doc

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

    Pool worker nodes.

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

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

    Methods

    -
    - -
    +
    + + +

    Returns void

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

    Returns void

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

    Returns Promise<void>

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

    Returns void

    +
    +
    + +
    -
    - - +

    Returns Promise<Response>

    Promise that will be fulfilled when the task is completed.

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

    Returns void

    +
    +
    + +
    -
    - - +

    Returns void

    +
    +
    + + +

    Returns void

    +
    -
    - -
    +
    + +
    -
    - - +

    Returns void

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

    On This Page

    - -
    +
  • constructor
  • +
  • emitter
  • +
  • filePath
  • +
  • max
  • +
  • numberOfWorkers
  • +
  • opts
  • +
  • promiseResponseMap
  • +
  • workerChoiceStrategyContext
  • +
  • workerNodes
  • +
  • busy
  • +
  • full
  • +
  • info
  • +
  • maxSize
  • +
  • minSize
  • +
  • runTime
  • +
  • type
  • +
  • utilization
  • +
  • worker
  • +
  • afterTaskExecutionHook
  • +
  • afterWorkerSetup
  • +
  • beforeTaskExecutionHook
  • +
  • createAndSetupDynamicWorker
  • +
  • createAndSetupWorker
  • +
  • createWorker
  • +
  • destroy
  • +
  • destroyWorker
  • +
  • enableTasksQueue
  • +
  • execute
  • +
  • internalBusy
  • +
  • isMain
  • +
  • sendToWorker
  • +
  • setTasksQueueOptions
  • +
  • setWorkerChoiceStrategy
  • +
  • setWorkerChoiceStrategyOptions
  • +
  • setupHook
  • +
  • workerListener
  • + +

    Generated using TypeDoc

    -
    \ No newline at end of file +
    \ No newline at end of file