X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FFixedClusterPool.html;h=7c57b50caa25318404d5db0f6af689cc83fd482d;hb=b10bb04924a5918496ff64a62ae71b9f99239b28;hp=b6a1b7225c0567f9c6034f3b8f4fd41ad52511f7;hpb=301c53e7ae6cf1120298ea10868a9091904c01a2;p=poolifier.git diff --git a/docs/classes/FixedClusterPool.html b/docs/classes/FixedClusterPool.html index b6a1b722..7c57b50c 100644 --- a/docs/classes/FixedClusterPool.html +++ b/docs/classes/FixedClusterPool.html @@ -1,11 +1,13 @@ FixedClusterPool | 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,9 +28,13 @@

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 response of execution. This can only be serializable data.

+

Hierarchy

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

    Properties

    Accessors

    Methods

    -
    @@ -131,89 +132,71 @@

    Returns FixedClusterPool<Data, Response>

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

    -
    emitter?: PoolEmitter
    +
    emitter?: PoolEmitter

    Inherit Doc

    +
  • Defined in src/pools/abstract-pool.ts:33
  • -
    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:68
  • -
    numberOfWorkers: number
    +
  • Defined in src/pools/abstract-pool.ts:67
  • -
    -
    - -
    promiseMap: Map<number, PromiseWorkerResponseWrapper<Worker, Response>> = ...
    -

    The promise map.

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

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

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

    Worker choice strategy instance implementing the worker choice algorithm.

    -

    Default to a strategy implementing a round robin algorithm.

    +

    Worker choice strategy context referencing a worker choice algorithm implementation.

    +

    Default to a round robin algorithm.

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

    Inherit Doc

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

    Inherit Doc

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

    @@ -226,18 +209,40 @@

    Returns boolean

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

      Number of tasks queued in the pool.

      +
      +

      Returns number

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

      Number of tasks running in the pool.

      +

      Returns number

    +
  • Defined in src/pools/abstract-pool.ts:156
  • +
  • Defined in src/pools/cluster/fixed.ts:99
  • Methods

    -
    - +
    +
      - +
    • Hook executed after the worker task promise resolution. Can be overridden.

      @@ -263,17 +268,17 @@ Can be overridden.

      Parameters

      • -
        message: MessageValue<Response, unknown>
        -

        The received message.

        +
        worker: Worker
        +

        The worker.

      • -
        promise: PromiseWorkerResponseWrapper<Worker, Response>
        -

        The Promise response.

        +
        message: MessageValue<Response, unknown>
        +

        The received message.

      Returns void

    +
  • Defined in src/pools/abstract-pool.ts:307
  • -
    - +
  • Defined in src/pools/cluster/fixed.ts:93
  • +
    +
      - +
    • Hook executed before the worker task promise resolution. Can be overridden.

      @@ -302,40 +307,40 @@ Can be overridden.

      Parameters

      • -
        worker: Worker
        -

        The worker.

        +
        workerNodeKey: number
        +

        The worker node key.

      Returns void

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

      Chooses a worker for the next task.

      -

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

      +

      Chooses a worker node for the next task.

      +

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

      -

      Returns

      Worker.

      +

      Returns

      [worker node key, worker node].

      -

      Returns Worker

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

      Creates a new worker for this pool and sets it up completely.

      +

      Creates a new worker and sets it up completely in the pool worker nodes.

      Returns

      New, completely set up worker.

      Returns Worker

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

      Parameters

      +
        +
      • +
        workerNodeKey: number
      +

      Returns undefined | Task<Data>

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

      Inherit Doc

      Parameters

      • -
        data: Data
      -

      Returns Promise<Response>

    -
    - -
      - -
    • -
      -

      Inherit Doc

      -

      Returns false | Worker

    -
    - -
      - -
    • -
      -

      Inherit Doc

      -
      -

      Parameters

      -
        +
        workerNodeKey: number
      • -
        worker: Worker
      -

      Returns undefined | number

    +

    Returns void

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

    Returns number

    +
    +
    -
    - -
    +
    + +

    Returns void

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

    Returns void

    -
    - +
  • Defined in src/pools/abstract-pool.ts:572
  • +
    +
    +
  • Defined in src/pools/abstract-pool.ts:221
  • +
  • Defined in src/pools/cluster/fixed.ts:64
  • -
    - +
  • Defined in src/pools/cluster/fixed.ts:80
  • +
    +
    +
  • Defined in src/pools/abstract-pool.ts:545
  • +
  • Defined in src/pools/cluster/fixed.ts:75
  • Returns void

    +
  • Defined in src/pools/abstract-pool.ts:189
  • +
  • Defined in src/pools/cluster/fixed.ts:59
  • +
    + +
    +
  • Defined in src/pools/abstract-pool.ts:429
  • Generated using TypeDoc