X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FFixedClusterPool.html;h=a8216268dbd89a65d9cd6d87188091badd0ea9ab;hb=88499cf9c298c12aa8235e60d27657f50d3c38ee;hp=a206c71efbfc60a0aec7c21c6cc31ed391d65a4b;hpb=493f77bdef6d66ad2fcb72b405c805274b24f3db;p=poolifier.git diff --git a/docs/classes/FixedClusterPool.html b/docs/classes/FixedClusterPool.html index a206c71e..a8216268 100644 --- a/docs/classes/FixedClusterPool.html +++ b/docs/classes/FixedClusterPool.html @@ -1,4 +1,4 @@ -FixedClusterPool | poolifier
+FixedClusterPool | poolifier - v2.6.17
  • Preparing search index...
  • -
  • The search index is not available
poolifier
+
  • The search index is not available
  • poolifier - v2.6.17
    @@ -17,24 +17,25 @@

    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.

    - -

    Author

    Christopher Quadflieg

    +
    +
    +

    Author

    Christopher Quadflieg

    -

    Since

    2.0.0

    +

    Since

    2.0.0

    Type Parameters

    • Data = unknown

      -

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

      -
    • +

      Type of data sent to the worker. This can only be structured-cloneable data.

      +
      +
    • Response = unknown

      -

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

      -
    +

    Type of execution response. This can only be structured-cloneable data.

    +
    +

    Hierarchy

    +
  • Defined in src/pools/cluster/fixed.ts:33
  • @@ -52,55 +53,58 @@

    Constructors

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

      @@ -117,60 +121,71 @@
    • numberOfWorkers: number

      Number of workers for this pool.

      -
    • +
    +
  • filePath: string

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

    -
  • + +
  • opts: ClusterPoolOptions = {}

    Options for this fixed cluster pool.

    -
  • -

    Returns FixedClusterPool<Data, Response>

    Properties

    - +
    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.
    • +
    • 'full': Emitted when the pool is dynamic and the number of workers created has reached the maximum size expected.
    • +
    • 'ready': Emitted when the number of workers created in the pool has reached the minimum size expected and are ready.
    • +
    • 'busy': Emitted when the number of workers created in the pool has reached the maximum size expected and are executing at least one task.
    • +
    • 'error': Emitted when an uncaught error occurs.
    • +
    • 'taskError': Emitted when an error occurs while executing a task.
    -
    -
    - +
  • Defined in src/pools/abstract-pool.ts:63
  • +
    +
    filePath: string

    Path to the worker file.

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

    Number of workers that this pool should manage.

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

    Options for this fixed cluster pool.

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

    The execution response promise map.

      @@ -178,104 +193,146 @@
    • 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.

    -
    +
  • Defined in src/pools/abstract-pool.ts:73
  • - +
    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:81
  • - -
    workerNodes: WorkerNode<Worker, Data>[] = []
    + +
    workerNodes: IWorkerNode<Worker, Data>[] = []

    Pool worker nodes.

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

    - +
    • get busy(): boolean
    • Whether the pool is busy or not.

      The pool busyness boolean status.

      -

      Returns boolean

    -
    - -
    +
    + +
    • get full(): boolean
    • Whether the pool is full or not.

      The pool filling boolean status.

      -

      Returns boolean

    -
    - -
    +
    + +
      +
    • get info(): PoolInfo
    • -

      Number of tasks queued in the pool.

      +

      Pool information.

      -

      Returns number

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

      Number of tasks running in the pool.

      +

      Pool maximum size.

      -

      Returns number

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

      Pool maximum size.

      +

      Pool minimum size.

      -

      Returns number

    -
    - -
    +
    + +
    +
    + +
      +
    • get type(): "fixed" | "dynamic"
    • Pool type.

      If it is 'dynamic', it provides the max property.

      -

      Returns PoolType

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

    Methods

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

      @@ -286,22 +343,25 @@ Can be overridden.

    • worker: Worker

      The worker.

      -
    • + +
    • -
      message: MessageValue<Response, Worker | MessagePort>
      +
      message: MessageValue<Response, unknown>

      The received message.

      -
    -

    Returns void

    -
    - -
    +
    + +
      +
    • -

      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.

      +

      Function that can be hooked up when a worker has been newly created and moved to the pool worker nodes. +Can be overridden.

      Parameters

      @@ -309,15 +369,17 @@ Can be overridden.

    • worker: Worker

      The newly created worker.

      -
    -

    Returns void

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

    Returns void

    -
    - +
  • Defined in src/pools/abstract-pool.ts:695
  • +
    + +
    +
    +
    +
  • Defined in src/pools/abstract-pool.ts:976
  • - +
    +
  • Defined in src/pools/abstract-pool.ts:937
  • - +
    +
  • Defined in src/pools/cluster/fixed.ts:77
  • - +
    +
  • Defined in src/pools/abstract-pool.ts:650
  • - + -

    Returns void

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

    Returns void

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

    Returns Promise<Response>

    Promise that will be fulfilled when the task is completed.

    -
    +
  • Defined in src/pools/abstract-pool.ts:615
  • - +
    +
  • Defined in src/pools/abstract-pool.ts:606
  • - +
    -
    - -
    +
  • Defined in src/pools/cluster/fixed.ts:58
  • - + -

    Returns void

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

    Returns void

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

    Returns void

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

    Returns void

    +
  • Defined in src/pools/abstract-pool.ts:544
  • - +
    +
  • Defined in src/pools/cluster/fixed.ts:53
  • - +

    Returns void

    The listener function to execute when a message is received from a worker.

    -
    +
  • Defined in src/pools/abstract-pool.ts:1075
  • +
  • constructor
  • +
  • emitter
  • +
  • filePath
  • +
  • numberOfWorkers
  • +
  • opts
  • +
  • promiseResponseMap
  • +
  • workerChoiceStrategyContext
  • +
  • workerNodes
  • +
  • busy
  • +
  • full
  • +
  • info
  • +
  • maxSize
  • +
  • minSize
  • +
  • ready
  • +
  • type
  • +
  • utilization
  • +
  • worker
  • +
  • afterTaskExecutionHook
  • +
  • afterWorkerSetup
  • +
  • beforeTaskExecutionHook
  • +
  • checkDynamicPoolSize
  • +
  • createAndSetupDynamicWorker
  • +
  • createAndSetupWorker
  • +
  • createWorker
  • +
  • destroy
  • +
  • destroyWorker
  • +
  • enableTasksQueue
  • +
  • execute
  • +
  • internalBusy
  • +
  • isMain
  • +
  • sendToWorker
  • +
  • setTasksQueueOptions
  • +
  • setWorkerChoiceStrategy
  • +
  • setWorkerChoiceStrategyOptions
  • +
  • setupHook
  • +
  • workerListener
  • +
  • AbstractPool
  • +
  • AbstractWorker
  • +
  • CircularArray
  • +
  • ClusterWorker
  • +
  • DynamicClusterPool
  • +
  • DynamicThreadPool
  • +
  • FixedClusterPool
  • +
  • FixedThreadPool
  • +
  • PoolEmitter
  • +
  • Queue
  • +
  • ThreadWorker
  • +
  • WorkerChoiceStrategyContext
  • +
  • ClusterPoolOptions
  • +
  • EventLoopUtilizationMeasurementStatistics
  • +
  • IPool
  • +
  • IWorker
  • +
  • IWorkerChoiceStrategy
  • +
  • IWorkerNode
  • +
  • MeasurementOptions
  • +
  • MeasurementStatistics
  • +
  • MeasurementStatisticsRequirements
  • +
  • MessageValue
  • +
  • PoolInfo
  • +
  • PoolOptions
  • +
  • PromiseResponseWrapper
  • +
  • StrategyPolicy
  • +
  • Task
  • +
  • TaskError
  • +
  • TaskPerformance
  • +
  • TaskStatistics
  • +
  • TaskStatisticsRequirements
  • +
  • TasksQueueOptions
  • +
  • ThreadPoolOptions
  • +
  • WorkerChoiceStrategyOptions
  • +
  • WorkerInfo
  • +
  • WorkerOptions
  • +
  • WorkerStatistics
  • +
  • WorkerUsage
  • +
  • ErrorHandler
  • +
  • ExitHandler
  • +
  • KillBehavior
  • +
  • Measurement
  • +
  • MessageHandler
  • +
  • OnlineHandler
  • +
  • PoolEvent
  • +
  • PoolType
  • +
  • TaskFunctions
  • +
  • WorkerAsyncFunction
  • +
  • WorkerChoiceStrategy
  • +
  • WorkerFunction
  • +
  • WorkerSyncFunction
  • +
  • WorkerType
  • +
  • KillBehaviors
  • +
  • Measurements
  • +
  • PoolEvents
  • +
  • PoolTypes
  • +
  • WorkerChoiceStrategies
  • +
  • WorkerTypes
  • +
  • availableParallelism
  • Generated using TypeDoc

    \ No newline at end of file