X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FFixedClusterPool.html;h=2955f106307ee1d2a91a2a866401ba734088a841;hb=761b0c73be0bf581f50a78123913f933bd405f52;hp=6c8b461351fe597007ae467395a85e0ea1502703;hpb=fe9f25b5ac98c7c7fccd1849a200c5054a77cf03;p=poolifier.git diff --git a/docs/classes/FixedClusterPool.html b/docs/classes/FixedClusterPool.html index 6c8b4613..2955f106 100644 --- a/docs/classes/FixedClusterPool.html +++ b/docs/classes/FixedClusterPool.html @@ -1,13 +1,15 @@ -FixedClusterPool | poolifier
+FixedClusterPool | poolifier
-
+
-
+
  • poolifier
  • @@ -18,10 +20,6 @@

    It is possible to perform tasks in sync or asynchronous mode as you prefer.

    This pool selects the workers in a round robin fashion.

    -

    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

    Christopher Quadflieg

    Since

    2.0.0

    @@ -30,19 +28,23 @@

    Type Parameters

    • -

      Data = unknown

    • +

      Data = unknown

      +

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

      +
    • -

      Response = unknown

    +

    Response = unknown

    +

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

    +

Hierarchy

+
  • Defined in src/pools/cluster/fixed.ts:39
  • @@ -56,42 +58,40 @@

    Properties

    Accessors

    -

    Methods

    -
    @@ -100,7 +100,7 @@
      - +
    • Constructs a new poolifier fixed cluster pool.

      @@ -123,351 +123,356 @@

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

    • -
      Optional opts: ClusterPoolOptions = {}
      +
      opts: ClusterPoolOptions = {}

      Options for this fixed cluster pool.

    -

    Returns FixedClusterPool<Data, Response>

    Properties

    -
    emitter?: PoolEmitter
    -
    -

    Inherit Doc

    +
  • 'full': Emitted when the pool is dynamic and full.
  • +
  • 'busy': Emitted when the pool is busy.
  • + +
    -
    filePath: string
    -
    - -
    max?: number
    -
    -

    Inherit Doc

    -
    - -
    nextMessageId: number = 0
    -

    Id of the next message.

    +
    filePath: string
    +

    Path to the worker file.

    +
  • Defined in src/pools/abstract-pool.ts:77
  • -
    numberOfWorkers: number
    +
  • Defined in src/pools/abstract-pool.ts:76
  • -
    -
    - -
    promiseMap: Map<number, PromiseWorkerResponseWrapper<Worker, Response>> = ...
    -

    The promise map.

    +
  • Defined in src/pools/cluster/fixed.ts:53
  • +
    + +
    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.

    +

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

    -
    - -
    tasks: Map<Worker, number> = ...
    -
    -

    Inherit Doc

    +
  • Defined in src/pools/abstract-pool.ts:52
  • -
    workerChoiceStrategyContext: WorkerChoiceStrategyContext<Worker, 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.

    +

    Default to a round robin algorithm.

    -
    - -
    workers: Worker[] = []
    -
    -

    Inherit Doc

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

    Pool worker nodes.

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

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

      Whether the pool is full or not.

      +

      The pool filling boolean status.

      +
      +

      Returns boolean

    +
    + +
      +
    • get numberOfQueuedTasks(): number
    • +
    • +

      Number of tasks queued in the pool.

      +
      +

      Returns number

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

      Inherit Doc

      +

      Number of tasks running in the pool.

      +

      Returns number

    +
  • Defined in src/pools/abstract-pool.ts:185
  • +
  • Defined in src/pools/cluster/fixed.ts:99
  • 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: Worker
        +

        The newly created worker.

        +
      +

      Returns void

    +
    + +
      + +
    • +

      Hook executed before the worker task execution. +Can be overridden.

      +

      Parameters

      • -
        worker: Worker
      +
      workerNodeKey: number
      +

      The worker node key.

      +

    Returns void

    -
    - +
  • Defined in src/pools/abstract-pool.ts:378
  • +
    +
    +
  • Defined in src/pools/abstract-pool.ts:422
  • +
  • Defined in src/pools/abstract-pool.ts:484
  • -
    - -
    +
  • Defined in src/pools/cluster/fixed.ts:88
  • -
    - -
    +
    + +

    Returns void

    -
    - +
  • Defined in src/pools/cluster/fixed.ts:69
  • +
    +
    -
    - -
    -
    - - +

    Returns void

    -
    - +
  • Defined in src/pools/abstract-pool.ts:254
  • +
    +
    -
    - -
    -
    - -
    +
    + +
    -
    - +
  • Defined in src/pools/abstract-pool.ts:303
  • +
    +
    +
  • Defined in src/pools/abstract-pool.ts:298
  • -
    - -
    +
    + +
    -
    - -
    +
    + +
    -
    - -
    +
    + +

    Returns void

    +
  • Defined in src/pools/abstract-pool.ts:266
  • Returns void

    +
  • Defined in src/pools/abstract-pool.ts:218
  • +
    + +
    +
  • Defined in src/pools/cluster/fixed.ts:59
  • - +
    +
    -
    +
  • constructor
  • +
  • emitter
  • +
  • filePath
  • +
  • numberOfWorkers
  • +
  • opts
  • +
  • promiseResponseMap
  • +
  • workerChoiceStrategyContext
  • +
  • workerNodes
  • +
  • busy
  • +
  • full
  • +
  • numberOfQueuedTasks
  • +
  • numberOfRunningTasks
  • +
  • type
  • +
  • afterTaskExecutionHook
  • +
  • afterWorkerSetup
  • +
  • beforeTaskExecutionHook
  • +
  • chooseWorkerNode
  • +
  • createAndSetupWorker
  • +
  • createWorker
  • +
  • destroy
  • +
  • destroyWorker
  • +
  • enableTasksQueue
  • +
  • execute
  • +
  • findFreeWorkerNodeKey
  • +
  • internalBusy
  • +
  • isMain
  • +
  • registerWorkerMessageListener
  • +
  • sendToWorker
  • +
  • setTasksQueueOptions
  • +
  • setWorkerChoiceStrategy
  • +
  • setWorkerChoiceStrategyOptions
  • +
  • setupHook
  • +
  • workerListener
  • + +

    Generated using TypeDoc

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