X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FFixedClusterPool.html;h=9e33831153c969707ae03e8558f32410d4b992b6;hb=437d25258782c8801daa58829575d5a51c05dcee;hp=d626a13078bc4e47f2b438e7073fdcc85ca848df;hpb=21402562176f7550bcd9ba620cf551972fca6e98;p=poolifier.git diff --git a/docs/classes/FixedClusterPool.html b/docs/classes/FixedClusterPool.html index d626a130..9e338311 100644 --- a/docs/classes/FixedClusterPool.html +++ b/docs/classes/FixedClusterPool.html @@ -1,4 +1,4 @@ -FixedClusterPool | poolifier
+FixedClusterPool | poolifier
-
+
  • poolifier
  • @@ -28,23 +28,23 @@

    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/cluster/fixed.ts:39
  • @@ -52,52 +52,54 @@

    Constructors

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

        @@ -105,65 +107,70 @@

        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>

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

    -
    +
    -
    emitter?: PoolEmitter
    -
    -

    Inherit Doc

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

    Path to the worker-file.

    +
    filePath: string
    +

    Path to the worker file.

    -
    +
  • Defined in src/pools/abstract-pool.ts:77
  • +
    -
    numberOfWorkers: number
    +
    numberOfWorkers: number

    Number of workers that this pool should manage.

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

    Options for this fixed cluster pool.

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

    The execution response promise map.

    • key: The message id of each submitted task.
    • @@ -171,53 +178,55 @@

    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:52
  • +
    -
    workerChoiceStrategyContext: WorkerChoiceStrategyContext<Worker, Data, Response>
    +
    workerChoiceStrategyContext: WorkerChoiceStrategyContext<Worker, Data, Response>

    Worker choice strategy context referencing a worker choice algorithm implementation.

    Default to a round robin algorithm.

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

    Inherit Doc

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

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

      Inherit Doc

      +

      Whether the pool is full or not.

      +

      The pool filling boolean status.

      +

      Returns boolean

    -
    +
  • Defined in src/pools/cluster/fixed.ts:104
  • +
    -
      +
      • get numberOfQueuedTasks(): number
      • Number of tasks queued in the pool.

        @@ -225,10 +234,10 @@

        Returns number

    -
    +
  • Defined in src/pools/abstract-pool.ts:195
  • +
    -
      +
      • get numberOfRunningTasks(): number
      • Number of tasks running in the pool.

        @@ -236,283 +245,355 @@

        Returns number

    -
    +
  • Defined in src/pools/abstract-pool.ts:185
  • +
    -
      -
    • get type(): PoolType
    • +
    +
  • Defined in src/pools/cluster/fixed.ts:99
  • Methods

    -
    - -
      - +
      + +
        +
      • -

        Hook executed after the worker task promise resolution. +

        Hook executed after the worker task execution. Can be overridden.

        Parameters

        • -
          worker: Worker
          +
          worker: Worker

          The worker.

        • -
          message: MessageValue<Response, unknown>
          +
          message: MessageValue<Response, unknown>

          The received message.

        Returns void

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

        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
        +
        worker: Worker
        +

        The newly created worker.

        +

    Returns void

    -
    - -
    +
    + +
      +
    • -

      Hook executed before the worker task promise resolution. +

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

      Parameters

      • -
        workerNodeKey: number
        +
        workerNodeKey: number

        The worker node key.

      Returns void

    -
    +
  • Defined in src/pools/abstract-pool.ts:375
  • +
    -
      - +
        +
      • Chooses a worker node for the next task.

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

        Returns

        [worker node key, worker node].

        -

        Returns [number, WorkerNode<Worker, Data>]

    -
    +
  • Defined in src/pools/abstract-pool.ts:419
  • +
    -
      - +
        +
      • 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:481
  • +
    -
    -
    +
  • Defined in src/pools/cluster/fixed.ts:88
  • +
    -
      - +
    -
    - -
    +
    + +
      +
    • -
      -

      Inherit Doc

      +

      Shutdowns the given worker.

      +

      Parameters

      • -
        worker: Worker
      +
      worker: Worker
      +

      A worker within workerNodes.

      +

    Returns void

    -
    - -
    +
    + +
      +
    • -
      -

      Inherit Doc

      +

      Enables/disables the worker tasks queue in this pool.

      +

      Parameters

      • -
        data: Data
      -

      Returns Promise<Response>

    -
    - -
      - +
      enable: boolean
      +

      Whether to enable or disable the worker tasks queue.

      +
      +
    • +
      Optional tasksQueueOptions: TasksQueueOptions
      +

      The worker tasks queue options.

      +
    +

    Returns void

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

    Parameters

    Returns void

    Returns void

    -
    +
  • Defined in src/pools/cluster/fixed.ts:80
  • +
    -
    +
    + +
    -
    +
  • Defined in src/pools/abstract-pool.ts:266
  • +
    -
    +
    + +

    Returns void

    -
    +
  • Defined in src/pools/abstract-pool.ts:244
  • +
    -
    -
    +
  • Defined in src/pools/cluster/fixed.ts:59
  • +
    -
    - +
    +
    +
    +

    On This Page

    - -
    +
  • constructor
  • +
  • emitter
  • +
  • filePath
  • +
  • numberOfWorkers
  • +
  • opts
  • +
  • promiseResponseMap
  • +
  • workerChoiceStrategyContext
  • +
  • workerNodes
  • +
  • busy
  • +
  • full
  • +
  • numberOfQueuedTasks
  • +
  • numberOfRunningTasks
  • +
  • type
  • +
  • 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