X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FFixedClusterPool.html;h=eb5e22d41eda358342853c08d4bb690084cb9b51;hb=aba8d9bd41f1bd46f3cc3863c0c2e74bdfacb7b6;hp=b66a5d35120498c362f7c01bc547e59f82a6cbcd;hpb=8662ea71e523af81c1138618f0e12b89df35ce8a;p=poolifier.git diff --git a/docs/classes/FixedClusterPool.html b/docs/classes/FixedClusterPool.html index b66a5d35..76920c88 100644 --- a/docs/classes/FixedClusterPool.html +++ b/docs/classes/FixedClusterPool.html @@ -1,13 +1,15 @@ -FixedClusterPool | poolifier
+FixedClusterPool | poolifier
-
+
-
+
  • poolifier
  • @@ -16,33 +18,35 @@

    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 serializable data.

        +
        +
      • -

        Response = unknown

    +

    Response = unknown

    +

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

    +
    +

Hierarchy

@@ -50,588 +54,654 @@

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.

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

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

    +
    +
    -
    - -
    workersTasksUsage: Map<Worker, TasksUsage> = ...
    -
    -

    Inherit Doc

    +
    + + +

    Options for this fixed cluster pool.

    +
    +
    +
    + +
    promiseResponseMap: Map<string, PromiseResponseWrapper<Worker, 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 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.

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

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

    Methods

    -
    - -
    +
    + +
    -
    - - +

    Returns void

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

    Returns void

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

    Returns void

    +
    +
    + +
    -
    - -
    -
    - - +

    Returns void

    +
    +
    + +
    -
    - - +

    Returns Promise<Response>

    Promise that will be fulfilled when the task is completed.

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

    Parameters

    Returns void

    -

    Returns void

    -
    - -
    +
    + +
    -
    - - +

    Returns void

    +
    +
    + +
    +
    + +
    -
    - - +

    Returns void

    +
    +
    + +
    -
    - - +

    Returns void

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

    On This Page

    - -
    +
  • constructor
  • +
  • emitter
  • +
  • filePath
  • +
  • numberOfWorkers
  • +
  • opts
  • +
  • promiseResponseMap
  • +
  • workerChoiceStrategyContext
  • +
  • workerNodes
  • +
  • busy
  • +
  • full
  • +
  • info
  • +
  • maxSize
  • +
  • minSize
  • +
  • type
  • +
  • worker
  • +
  • afterTaskExecutionHook
  • +
  • afterWorkerSetup
  • +
  • beforeTaskExecutionHook
  • +
  • createAndSetupDynamicWorker
  • +
  • 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