X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FFixedClusterPool.html;h=4c7ab507cb1ee06519b3347a8a7c8ed47bfb9fc3;hb=ac2cb9e206b5e67cc52124eb334507f5dce230d5;hp=9a7ec8cb3244fac5aec2ec0a9b7a0fe03cb69ba1;hpb=248bc34b348a7d8d2b90eecff49d60a3b465da9e;p=poolifier.git diff --git a/docs/classes/FixedClusterPool.html b/docs/classes/FixedClusterPool.html index 9a7ec8cb..ac3098f2 100644 --- a/docs/classes/FixedClusterPool.html +++ b/docs/classes/FixedClusterPool.html @@ -1,13 +1,15 @@ -FixedClusterPool | poolifier
+FixedClusterPool | poolifier
-
+
-
+
  • poolifier
  • @@ -15,34 +17,35 @@

    Class FixedClusterPool<Data, Response>

A cluster pool with a fixed number of workers.

-

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

+
+
+

Author

Christopher Quadflieg

-

Since

2.0.0

+

Since

2.0.0

-
+

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

@@ -50,546 +53,640 @@

Constructors

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

      -
      +

      Type Parameters

      -
        +
        • -

          Data = unknown

        • +

          Data = unknown

        • -

          Response = unknown

      +

      Response = unknown

    Parameters

    • -
      numberOfWorkers: number
      +
      numberOfWorkers: number

      Number of workers for this pool.

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

    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>

    +
    +

    Returns FixedClusterPool<Data, Response>

    +
    +
  • Defined in src/pools/cluster/fixed.ts:49
  • Properties

    -
    - -
    emitter?: PoolEmitter
    -
    -

    Inherit Doc

    -
    - -
    filePath: string
    -
    - -
    max?: number
    -
    -

    Inherit Doc

    -
    - -
    nextMessageId: number = 0
    -

    Id of the next message.

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

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

      When we receive a message from the worker we get a map entry and resolve/reject the promise based on the message.

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

      Inherit Doc

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

      Worker choice strategy instance implementing the worker choice algorithm.

      -

      Default to a strategy implementing a round robin algorithm.

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

      Inherit Doc

    +
    +
    + +
    filePath: string
    +

    Path to the worker file.

    +
    +
    +
    + +
    numberOfWorkers: number
    +

    Number of workers that this pool should manage.

    +
    +
    +
    + + +

    Options for this fixed cluster pool.

    +
    +
    +
  • Defined in src/pools/cluster/fixed.ts:52
  • +
    + +
    promiseResponseMap: Map<string, PromiseResponseWrapper<Worker, Response>> = ...
    +

    The execution response promise map.

    + +

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

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

    Worker choice strategy context referencing a worker choice algorithm implementation.

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

    Pool worker nodes.

    +
    +

    Accessors

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

    Methods

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

    Methods

    +
    + +
    -
    - -
    -
    - - +

    Returns void

    +
    +
    + +
    -
    - - +

    Returns void

    +
    +
    + +
    -
    - - +

    Returns void

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

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