X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FFixedThreadPool.html;h=c7d211d68f6016a1c3c32768bec4adf1f576cf00;hb=184d530faf6acf70e116cb4a3fb831938b73e2c0;hp=a7ecfda3e67bffacf67e9574cc1dc26366e67807;hpb=797996a92f40d5779cd31314b59462e41d529989;p=poolifier.git diff --git a/docs/classes/FixedThreadPool.html b/docs/classes/FixedThreadPool.html index a7ecfda3..c7d211d6 100644 --- a/docs/classes/FixedThreadPool.html +++ b/docs/classes/FixedThreadPool.html @@ -1,4 +1,4 @@ -FixedThreadPool | poolifier
+FixedThreadPool | poolifier
-
+
-
+

Type Parameters

-
    +
    • -

      Data = unknown

      +

      Data = unknown

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

    • -

      Response = unknown

      -

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

      +

      Response = unknown

      +

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

Hierarchy

+
  • Defined in src/pools/thread/fixed.ts:34
  • @@ -52,550 +52,592 @@

    Constructors

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

        -
        +

        Type Parameters

        -
          +
          • -

            Data = unknown

          • +

            Data = unknown

          • -

            Response = unknown

        +

        Response = unknown

    Parameters

    -

    Returns FixedThreadPool<Data, Response>

    +
  • Defined in src/pools/thread/fixed.ts:45
  • Properties

    -
    +
    -
    emitter?: PoolEmitter
    -

    {@inheritDoc}

    -
    -
    - -
    filePath: string
    -

    Path to the worker-file.

    +
    emitter?: PoolEmitter
    +

    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.
    • +
    • 'error': Emitted when an uncaught error occurs.
    • +
    • 'taskError': Emitted when an error occurs while executing a task.
    • +
    -
    - -
    nextMessageId: number = 0
    -

    Id of the next message.

    +
  • Defined in src/pools/abstract-pool.ts:47
  • +
    + +
    filePath: string
    +

    Path to the worker file.

    -
    - -
    numberOfWorkers: number
    +
  • Defined in src/pools/abstract-pool.ts:82
  • +
    + +
    numberOfWorkers: number

    Number of workers that this pool should manage.

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

    Options for the pool.

    -
    - -
    promiseMap: Map<number, PromiseWorkerResponseWrapper<ThreadWorkerWithMessageChannel, Response>> = ...
    -

    The promise map.

    +
  • Defined in src/pools/abstract-pool.ts:83
  • +
    + +
    promiseResponseMap: Map<string, PromiseResponseWrapper<ThreadWorkerWithMessageChannel, 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.

    +

    When we receive a message from the worker, we get a map entry with the promise resolve/reject bound to the message id.

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

    Worker choice strategy instance implementing the worker choice algorithm.

    -

    Default to a strategy implementing a round robin algorithm.

    -
    -
    - - -

    {@inheritDoc}

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

    Worker choice strategy context referencing a worker choice algorithm implementation.

    +

    Default to a round robin algorithm.

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

    {@inheritDoc}

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

    Pool worker nodes.

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

    -
    - -
      +
      + +
      • get busy(): boolean
      • -

        {@inheritDoc}

        +

        Whether the pool is busy or not.

        +

        The pool busyness boolean status.

        Returns boolean

      -
      - -
    +
    + +
      +
    • get full(): boolean
    • -

      {@inheritDoc}

      +

      Whether the pool is full or not.

      +

      The pool filling boolean status.

      +
      +

      Returns boolean

    +
    + +
    +
    + +
    +
    + +
      +
    • get minSize(): number
    • +
    • +

      Pool minimum size.

      Returns number

    -
    - -
    +
    + +
      +
    • get type(): "fixed" | "dynamic"
    • -

      {@inheritDoc}

      +

      Pool type.

      +

      If it is 'dynamic', it provides the max property.

      -

      Returns PoolType

    +
  • Defined in src/pools/thread/fixed.ts:100
  • +
    + +
      +
    • get worker(): "cluster" | "thread"
    • +
    • +

      Gets the worker type.

      +
      +

      Returns "cluster" | "thread"

    Methods

    -
    - -
    +
    -

    Returns void

    -
    - -
    +
    + +
    -
    - -
    +
    + +
      +
    • -

      Chooses a worker for the next task.

      -

      The default implementation uses a round robin algorithm to distribute the load.

      - -

      Returns

      Worker.

      +

      Chooses a worker node for the next task.

      +

      The default worker choice strategy uses a round robin algorithm to distribute the load.

      -

      Returns ThreadWorkerWithMessageChannel

    -
    +
  • Defined in src/pools/abstract-pool.ts:532
  • +
    -
    -
    +
  • Defined in src/pools/abstract-pool.ts:596
  • +
    -
    -
    +
  • Defined in src/pools/thread/fixed.ts:83
  • +
    -
      - -
    • -

      {@inheritDoc}

      -
      -

      Returns Promise<void>

    -
    - -
    -
    - -
    +
    + +
      +
    • -

      {@inheritDoc}

      +

      Shutdowns the given worker.

      Parameters

      • -
        data: Data
      -

      Returns Promise<Response>

    -
    - -
    -
    - -
    +

    Returns Promise<void>

    +
    + +
      +
    • -

      {@inheritDoc}

      +

      Enables/disables the worker tasks queue in this pool.

      Parameters

      -

      Returns undefined | number

    -
    - -
    +

    Returns void

    -
    - -
    +
    + +
    -
    - - +

    Returns Promise<Response>

    Promise that will be fulfilled when the task is completed.

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

    Parameters

    Returns void

    Returns void

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

    Returns void

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

    Returns void

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

    Returns void

    The listener function to execute when a message is received from a worker.

    + +
    +
    +
    +

    On This Page

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

    Generated using TypeDoc

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