X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FFixedThreadPool.html;h=a5610b1077aaed4069aa78e428b9441381c65e1e;hb=184d530faf6acf70e116cb4a3fb831938b73e2c0;hp=0498d0bee1ab114b1f7a2e65b4390afd3d1f9943;hpb=0163b91de7e67e0c3b29b542bd2d47cce655b262;p=poolifier.git diff --git a/docs/classes/FixedThreadPool.html b/docs/classes/FixedThreadPool.html index 0498d0be..c7d211d6 100644 --- a/docs/classes/FixedThreadPool.html +++ b/docs/classes/FixedThreadPool.html @@ -1,4 +1,4 @@ -FixedThreadPool | poolifier
+FixedThreadPool | poolifier
  • Preparing search index...
  • -
  • The search index is not available
poolifier
+
  • The search index is not available
  • 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,561 +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
    -
    -

    Inherit Doc

    -
    - -
    filePath: string
    -
    - -
    nextMessageId: number = 0
    -

    Id of the next message.

    +
    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.
    • +
    +
    +
    + +
    filePath: string
    +

    Path to the worker file.

    +
    +
    + +
    numberOfWorkers: number
    +

    Number of workers that this pool should manage.

    +
    +
    + + +

    Options for the pool.

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

    The promise map.

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

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

    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.

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

    Worker choice strategy context referencing a worker choice algorithm implementation.

    +

    Default to a round robin algorithm.

    -
    - - -
    -

    Inherit Doc

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

    Inherit Doc

    +

    Inherited from AbstractPool.workerChoiceStrategyContext

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

    Pool worker nodes.

    +

    Accessors

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

        Inherit Doc

        +

        Whether the pool is busy or not.

        +

        The pool busyness boolean status.

        +

        Returns boolean

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

      Whether the pool is full or not.

      +

      The pool filling boolean status.

      +
      +

      Returns boolean

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

      Inherit Doc

      +

      Pool minimum size.

      +

      Returns number

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

      Inherit Doc

      -

      Returns PoolType

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

      Gets the worker type.

      +
      +

      Returns "cluster" | "thread"

    Methods

    -
    - -
    +
    -
      - +
        +
      • -
        -

        Inherit Doc

        +

        Function that can be hooked up when a worker has been newly created and moved to the pool worker nodes.

        +

        Can be used to update the maxListeners or binding the main-worker<->worker connection if not bind by default.

        +

        Parameters

        +
        worker: ThreadWorkerWithMessageChannel
        +

        The newly created worker.

        +

    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
  • +
    -
    -
    - -
    -
    - -
    +
    + +
      +
    • -
      -

      Inherit Doc

      +

      Shutdowns the given worker.

      +

      Parameters

      • -
        data: Data
      -

      Returns Promise<Response>

    -
    - -
    -
    - -
    +

    Returns Promise<void>

    +
    + +
      +
    • -
      -

      Inherit Doc

      +

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