From f9fc489a415da7131735b04b0af50b1143dbdf70 Mon Sep 17 00:00:00 2001 From: Documentation Bot Date: Mon, 30 Oct 2023 18:28:02 +0000 Subject: [PATCH] docs: generate documentation --- docs/classes/AbstractPool.html | 1838 ++--------------- docs/classes/AbstractWorker.html | 930 +-------- docs/classes/CircularArray.html | 1645 +-------------- docs/classes/ClusterWorker.html | 782 +------ docs/classes/Deque.html | 323 +-- docs/classes/DynamicClusterPool.html | 1186 +---------- docs/classes/DynamicThreadPool.html | 1192 +---------- docs/classes/FixedClusterPool.html | 1182 +---------- docs/classes/FixedThreadPool.html | 1188 +---------- docs/classes/Node.html | 141 +- docs/classes/ThreadWorker.html | 792 +------ docs/classes/WorkerChoiceStrategyContext.html | 338 +-- docs/functions/availableParallelism.html | 74 +- docs/index.html | 86 +- docs/interfaces/ClusterPoolOptions.html | 261 +-- ...tLoopUtilizationMeasurementStatistics.html | 106 +- docs/interfaces/IPool.html | 515 +---- docs/interfaces/IWorker.html | 211 +- docs/interfaces/IWorkerChoiceStrategy.html | 229 +- docs/interfaces/IWorkerNode.html | 487 +---- docs/interfaces/MeasurementOptions.html | 98 +- docs/interfaces/MeasurementStatistics.html | 148 +- .../MeasurementStatisticsRequirements.html | 118 +- docs/interfaces/MessageValue.html | 291 +-- docs/interfaces/PoolInfo.html | 252 +-- docs/interfaces/PoolOptions.html | 234 +-- docs/interfaces/PromiseResponseWrapper.html | 153 +- docs/interfaces/StrategyData.html | 94 +- docs/interfaces/StrategyPolicy.html | 108 +- docs/interfaces/Task.html | 159 +- .../TaskFunctionOperationResult.html | 100 +- docs/interfaces/TaskPerformance.html | 128 +- docs/interfaces/TaskStatistics.html | 148 +- .../TaskStatisticsRequirements.html | 118 +- docs/interfaces/TasksQueueOptions.html | 140 +- docs/interfaces/ThreadPoolOptions.html | 248 +-- .../WorkerChoiceStrategyOptions.html | 163 +- docs/interfaces/WorkerError.html | 127 +- docs/interfaces/WorkerInfo.html | 138 +- docs/interfaces/WorkerNodeEventDetail.html | 94 +- docs/interfaces/WorkerOptions.html | 127 +- docs/interfaces/WorkerStatistics.html | 108 +- docs/interfaces/WorkerUsage.html | 128 +- docs/types/ErrorHandler.html | 92 +- docs/types/ExitHandler.html | 92 +- docs/types/KillBehavior.html | 68 +- docs/types/KillHandler.html | 76 +- docs/types/Measurement.html | 68 +- docs/types/MessageHandler.html | 92 +- docs/types/OnlineHandler.html | 90 +- docs/types/PoolEvent.html | 68 +- docs/types/PoolType.html | 68 +- docs/types/TaskAsyncFunction.html | 100 +- docs/types/TaskFunction.html | 83 +- docs/types/TaskFunctions.html | 83 +- docs/types/TaskSyncFunction.html | 100 +- docs/types/WorkerChoiceStrategy.html | 68 +- docs/types/WorkerType.html | 68 +- docs/types/Writable.html | 69 +- docs/variables/KillBehaviors.html | 83 +- docs/variables/Measurements.html | 77 +- docs/variables/PoolEvents.html | 85 +- docs/variables/PoolTypes.html | 83 +- docs/variables/WorkerChoiceStrategies.html | 113 +- docs/variables/WorkerTypes.html | 75 +- 65 files changed, 1378 insertions(+), 17351 deletions(-) diff --git a/docs/classes/AbstractPool.html b/docs/classes/AbstractPool.html index 60e3c607..4ffefe2c 100644 --- a/docs/classes/AbstractPool.html +++ b/docs/classes/AbstractPool.html @@ -1,67 +1,9 @@ -AbstractPool | poolifier - v3.0.5
-
- -
-
-
-
- -

Class AbstractPool<Worker, Data, Response>Abstract

-
-

Base class that implements some shared logic for all poolifier pools.

-
-
-
-

Type Parameters

-
    -
  • -

    Worker extends IWorker

    -

    Type of worker which manages this pool.

    -
    -
  • -
  • -

    Data = unknown

    -

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

    -
    -
  • -
  • -

    Response = unknown

    -

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

    -
    -
-
-

Hierarchy

-
-
-

Implements

-
    -
  • IPool<Worker, Data, Response>
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
emitter? +AbstractPool | poolifier - v3.0.5

Class AbstractPool<Worker, Data, Response>Abstract

Base class that implements some shared logic for all poolifier pools.

+

Type Parameters

  • Worker extends IWorker

    Type of worker which manages this pool.

    +
  • Data = unknown

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

    +
  • Response = unknown

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

    +

Hierarchy

Implements

  • IPool<Worker, Data, Response>
-
-

Constructors

-
- -
    - -
  • -

    Constructs a new poolifier pool.

    -
    -
    -

    Type Parameters

    -
      -
    • -

      Worker extends IWorker

    • -
    • -

      Data = unknown

    • -
    • -

      Response = unknown

    -
    -

    Parameters

    -
      -
    • -
      numberOfWorkers: number
      -

      Number of workers that this pool should manage.

      -
      -
    • -
    • -
      filePath: string
      -

      Path to the worker file.

      -
      -
    • -
    • -
      opts: PoolOptions<Worker>
      -

      Options for the pool.

      -
      -
    -

    Returns AbstractPool<Worker, Data, Response>

    -
-
-

Properties

-
- -
emitter?: EventEmitterAsyncResource
-

Event emitter integrated with async resource on which events can be listened to. +

Constructors

  • Constructs a new poolifier pool.

    +

    Type Parameters

    • Worker extends IWorker

    • Data = unknown

    • Response = unknown

    Parameters

    • numberOfWorkers: number

      Number of workers that this pool should manage.

      +
    • filePath: string

      Path to the worker file.

      +
    • opts: PoolOptions<Worker>

      Options for the pool.

      +

    Returns AbstractPool<Worker, Data, Response>

Properties

emitter?: EventEmitterAsyncResource

Event emitter integrated with async resource on which events can be listened to. The async tracking tooling identifier is poolifier:<PoolType>-<WorkerType>-pool.

Events that can currently be listened to:

    @@ -221,1604 +115,146 @@ The async tracking tooling identifier is poolifier:<PoolType>-<Wo
  • 'taskError': Emitted when an error occurs while executing a task.
  • 'backPressure': Emitted when all worker nodes have back pressure (i.e. their tasks queue is full: queue size >= maximum queue size).
-
-
-
- -
filePath: string
-

Path to the worker file.

-
-
-
- -
max?: number
-

Dynamic pool maximum size property placeholder.

-
-
-
- -
numberOfWorkers: number
-

Number of workers that this pool should manage.

-
-
-
- -
opts: PoolOptions<Worker>
-

Options for the pool.

-
-
-
- -
promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...
-

The task execution response promise map:

+
filePath: string

Path to the worker file.

+
max?: number

Dynamic pool maximum size property placeholder.

+
numberOfWorkers: number

Number of workers that this pool should manage.

+
opts: PoolOptions<Worker>

Options for the pool.

+
promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...

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

-
-
-
- -
startTimestamp: number
-

The start timestamp of the pool.

-
-
-
- -
started: boolean
-

Whether the pool is started or not.

-
-
-
- -
starting: boolean
-

Whether the pool is starting or not.

-
-
-
- -
taskFunctions: Map<string, TaskFunction<Data, Response>>
-

The task functions added at runtime map:

+
startTimestamp: number

The start timestamp of the pool.

+
started: boolean

Whether the pool is started or not.

+
starting: boolean

Whether the pool is starting or not.

+
taskFunctions: Map<string, TaskFunction<Data, Response>>

The task functions added at runtime map:

  • key: The task function name.
  • value: The task function itself.
-
-
-
- -
workerChoiceStrategyContext: WorkerChoiceStrategyContext<Worker, Data, Response>
-

Worker choice strategy context referencing a worker choice algorithm implementation.

-
-
-
- -
workerNodes: IWorkerNode<Worker, Data>[] = []
-

Pool worker nodes.

-
-
-
-

Accessors

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

Worker choice strategy context referencing a worker choice algorithm implementation.

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

Pool worker nodes.

+

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 type(): "fixed" | "dynamic"
  • The pool type.

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

    -
    -

    Returns "fixed" | "dynamic"

    -
-
- -
    -
  • get utilization(): number
  • -
  • -

    The approximate pool utilization.

    -
    -

    Returns number

    The pool utilization.

    - -
-
- -
-
-

Methods

-
- -
    - -
  • -

    Adds a task function to this pool. +

    Returns "fixed" | "dynamic"

Methods

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

    -
    -
    -

    Parameters

    -
      -
    • -
      workerNodeKey: number
      -

      The worker node key.

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

      The received message.

      -
      -
    -

    Returns void

    -
-
- -
    - -
  • -

    Method hooked up after a worker node has been newly created. +

    Parameters

    • workerNodeKey: number

      The worker node key.

      +
    • message: MessageValue<Response, unknown>

      The received message.

      +

    Returns void

  • Method hooked up after a worker node has been newly created. Can be overridden.

    -
    -
    -

    Parameters

    -
      -
    • -
      workerNodeKey: number
      -

      The newly created worker node key.

      -
      -
    -

    Returns void

    -
-
- -
    - -
  • -

    Hook executed before the worker task execution. +

    Parameters

    • workerNodeKey: number

      The newly created worker node key.

      +

    Returns void

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

    -
    -
    -

    Parameters

    -
      -
    • -
      workerNodeKey: number
      -

      The worker node key.

      -
      -
    • -
    • -
      task: Task<Data>
      -

      The task to execute.

      -
      -
    -

    Returns void

    -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
    - -
  • -

    Chooses a worker node for the next task.

    +

    Parameters

    • workerNodeKey: number

      The worker node key.

      +
    • task: Task<Data>

      The task to execute.

      +

    Returns void

  • Chooses a worker node for the next task.

    The default worker choice strategy uses a round robin algorithm to distribute the tasks.

    -
    -

    Returns number

    The chosen worker node key

    - -
-
- -
    - -
  • -

    Creates a new, completely set up dynamic worker node.

    -
    -

    Returns number

    New, completely set up dynamic worker node key.

    - -
-
- -
    - -
  • -

    Creates a new, completely set up worker node.

    -
    -

    Returns number

    New, completely set up worker node key.

    - -
-
- -
-
- -
-
- -
-
- -
    - -
  • -

    Deregisters a listener callback on the worker given its worker node key.

    -
    -
    -

    Type Parameters

    -
      -
    • -

      Message

    -
    -

    Parameters

    -
      -
    • -
      workerNodeKey: number
      -

      The worker node key.

      -
      -
    • -
    • -
      listener: ((message) => void)
      -

      The message listener callback.

      -
      -
      -
        -
      • -
          -
        • (message): void
        • -
        • -
          -

          Parameters

          -
          -

          Returns void

    -

    Returns void

    -
-
- -
-
- -
    - -
  • -

    Terminates the worker node given its worker node key.

    -
    -
    -

    Parameters

    -
      -
    • -
      workerNodeKey: number
      -

      The worker node key.

      -
      -
    -

    Returns Promise<void>

    -
-
- -
    - -
  • -

    Enables/disables the worker node tasks queue in this pool.

    -
    -
    -

    Parameters

    -
      -
    • -
      enable: boolean
      -

      Whether to enable or disable the worker node tasks queue.

      -
      -
    • -
    • -
      Optional tasksQueueOptions: TasksQueueOptions
      -

      The worker node tasks queue options.

      -
      -
    -

    Returns void

    -
-
- -
-
- -
    - -
  • -

    Executes the specified function in the worker constructor with the task data input parameter.

    -
    -
    -

    Parameters

    -
      -
    • -
      Optional data: Data
      -

      The optional task input data for the specified task function. This can only be structured-cloneable data.

      -
      -
    • -
    • -
      Optional name: string
      -

      The optional name of the task function to execute. If not specified, the default task function will be executed.

      -
      -
    • -
    • -
      Optional transferList: TransferListItem[]
      -

      An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the pool's worker_threads worker and they should not be used in the main thread afterwards.

      -
      -
    -

    Returns Promise<Response>

    Promise that will be fulfilled when the task is completed.

    - -
-
- -
    - -
  • -

    Executes the given task on the worker given its worker node key.

    -
    -
    -

    Parameters

    -
      -
    • -
      workerNodeKey: number
      -

      The worker node key.

      -
      -
    • -
    • -
      task: Task<Data>
      -

      The task to execute.

      -
      -
    -

    Returns void

    -
-
- -
-
- -
-
- -
-
- -
    - -
  • -

    Gets the worker information given its worker node key.

    -
    -
    -

    Parameters

    -
      -
    • -
      workerNodeKey: number
      -

      The worker node key.

      -
      -
    -

    Returns WorkerInfo

    The worker information.

    - -
-
- -
    - -
  • -

    Gets the given worker its worker node key.

    -
    -
    -

    Parameters

    -
      -
    • -
      worker: Worker
      -

      The worker.

      -
      -
    -

    Returns number

    The worker node key if found in the pool worker nodes, -1 otherwise.

    - -
-
- -
    - -
  • -

    Gets the worker node key given its worker id.

    -
    -
    -

    Parameters

    -
      -
    • -
      workerId: undefined | number
      -

      The worker id.

      -
      -
    -

    Returns number

    The worker node key if the worker id is found in the pool worker nodes, -1 otherwise.

    - -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
    - -
  • -

    Whether the specified task function exists in this pool.

    -
    -
    -

    Parameters

    -
      -
    • -
      name: string
      -

      The name of the task function.

      -
      -
    -

    Returns boolean

    true if the task function exists, false otherwise.

    - -
-
- -
    - -
  • Internal -

    Whether the worker node has back pressure (i.e. its tasks queue is full).

    -
    -
    -

    Parameters

    -
      -
    • -
      workerNodeKey: number
      -

      The worker node key.

      -
      -
    -

    Returns boolean

    true if the worker node has back pressure, false otherwise.

    - -
-
- -
-
- -
    - -
  • -

    Whether worker nodes are executing concurrently their tasks quota or not.

    -
    -

    Returns boolean

    Worker nodes busyness boolean status.

    - -
-
- -
-
- -
-
- -
-
- -
    - -
  • -

    Registers once a listener callback on the worker given its worker node key.

    -
    -
    -

    Type Parameters

    -
      -
    • -

      Message

    -
    -

    Parameters

    -
      -
    • -
      workerNodeKey: number
      -

      The worker node key.

      -
      -
    • -
    • -
      listener: ((message) => void)
      -

      The message listener callback.

      -
      -
      -
        -
      • -
          -
        • (message): void
        • -
        • -
          -

          Parameters

          -
          -

          Returns void

    -

    Returns void

    -
-
- -
    - -
  • -

    Registers a listener callback on the worker given its worker node key.

    -
    -
    -

    Type Parameters

    -
      -
    • -

      Message

    -
    -

    Parameters

    -
      -
    • -
      workerNodeKey: number
      -

      The worker node key.

      -
      -
    • -
    • -
      listener: ((message) => void)
      -

      The message listener callback.

      -
      -
      -
        -
      • -
          -
        • (message): void
        • -
        • -
          -

          Parameters

          -
          -

          Returns void

    -

    Returns void

    -
-
- -
    - -
  • -

    Removes a task function from this pool.

    -
    -
    -

    Parameters

    -
      -
    • -
      name: string
      -

      The name of the task function.

      -
      -
    -

    Returns Promise<boolean>

    true if the task function was removed, false otherwise.

    - -
-
- -
    - -
  • -

    Removes the given worker from the pool worker nodes.

    -
    -
    -

    Parameters

    -
      -
    • -
      worker: Worker
      -

      The worker.

      -
      -
    -

    Returns void

    -
-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      workerNodeKey: number
    -

    Returns Promise<void>

-
- -
    - -
  • -

    Sends the startup message to worker given its worker node key.

    -
    -
    -

    Parameters

    -
      -
    • -
      workerNodeKey: number
      -

      The worker node key.

      -
      -
    -

    Returns void

    -
-
- -
    - -
  • -

    Sends the statistics message to worker given its worker node key.

    -
    -
    -

    Parameters

    -
      -
    • -
      workerNodeKey: number
      -

      The worker node key.

      -
      -
    -

    Returns void

    -
-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      workerNodeKey: number
    • -
    • -
      message: MessageValue<Data, unknown>
    -

    Returns Promise<boolean>

-
- -
-
- -
    - -
  • -

    Sends a message to worker given its worker node key.

    -
    -
    -

    Parameters

    -
      -
    • -
      workerNodeKey: number
      -

      The worker node key.

      -
      -
    • -
    • -
      message: MessageValue<Data, unknown>
      -

      The message.

      -
      -
    • -
    • -
      Optional transferList: TransferListItem[]
      -

      The optional array of transferable objects.

      -
      -
    -

    Returns void

    -
-
- -
    - -
  • -

    Sets the default task function in this pool.

    -
    -
    -

    Parameters

    -
      -
    • -
      name: string
      -

      The name of the task function.

      -
      -
    -

    Returns Promise<boolean>

    true if the default task function was set, false otherwise.

    - -
-
- -
-
- -
-
- -
-
- -
-
- -
    - -
  • -

    Sets the worker choice strategy in this pool.

    -
    -
    -

    Parameters

    -
      -
    • -
      workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
      -

      The worker choice strategy.

      -
      -
    • -
    • -
      Optional workerChoiceStrategyOptions: WorkerChoiceStrategyOptions
      -

      The worker choice strategy options.

      -
      -
    -

    Returns void

    -
-
- -
-
- -
    - -
  • -

    Setup hook to execute code before worker nodes are created in the abstract constructor. +

    Returns number

    The chosen worker node key

    +
  • Creates a new, completely set up dynamic worker node.

    +

    Returns number

    New, completely set up dynamic worker node key.

    +
  • Creates a new, completely set up worker node.

    +

    Returns number

    New, completely set up worker node key.

    +
  • Deregisters a listener callback on the worker given its worker node key.

    +

    Type Parameters

    • Message

    Parameters

    • workerNodeKey: number

      The worker node key.

      +
    • listener: ((message) => void)

      The message listener callback.

      +
        • (message): void
        • Parameters

          Returns void

    Returns void

  • Terminates the worker node given its worker node key.

    +

    Parameters

    • workerNodeKey: number

      The worker node key.

      +

    Returns Promise<void>

  • Enables/disables the worker node tasks queue in this pool.

    +

    Parameters

    • enable: boolean

      Whether to enable or disable the worker node tasks queue.

      +
    • Optional tasksQueueOptions: TasksQueueOptions

      The worker node tasks queue options.

      +

    Returns void

  • Executes the specified function in the worker constructor with the task data input parameter.

    +

    Parameters

    • Optional data: Data

      The optional task input data for the specified task function. This can only be structured-cloneable data.

      +
    • Optional name: string

      The optional name of the task function to execute. If not specified, the default task function will be executed.

      +
    • Optional transferList: TransferListItem[]

      An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the pool's worker_threads worker and they should not be used in the main thread afterwards.

      +

    Returns Promise<Response>

    Promise that will be fulfilled when the task is completed.

    +
  • Executes the given task on the worker given its worker node key.

    +

    Parameters

    • workerNodeKey: number

      The worker node key.

      +
    • task: Task<Data>

      The task to execute.

      +

    Returns void

  • Gets the given worker its worker node key.

    +

    Parameters

    • worker: Worker

      The worker.

      +

    Returns number

    The worker node key if found in the pool worker nodes, -1 otherwise.

    +
  • Gets the worker node key given its worker id.

    +

    Parameters

    • workerId: undefined | number

      The worker id.

      +

    Returns number

    The worker node key if the worker id is found in the pool worker nodes, -1 otherwise.

    +
  • Whether the specified task function exists in this pool.

    +

    Parameters

    • name: string

      The name of the task function.

      +

    Returns boolean

    true if the task function exists, false otherwise.

    +
  • Internal

    Whether the worker node has back pressure (i.e. its tasks queue is full).

    +

    Parameters

    • workerNodeKey: number

      The worker node key.

      +

    Returns boolean

    true if the worker node has back pressure, false otherwise.

    +
  • Whether worker nodes are executing concurrently their tasks quota or not.

    +

    Returns boolean

    Worker nodes busyness boolean status.

    +
  • Registers once a listener callback on the worker given its worker node key.

    +

    Type Parameters

    • Message

    Parameters

    • workerNodeKey: number

      The worker node key.

      +
    • listener: ((message) => void)

      The message listener callback.

      +
        • (message): void
        • Parameters

          Returns void

    Returns void

  • Registers a listener callback on the worker given its worker node key.

    +

    Type Parameters

    • Message

    Parameters

    • workerNodeKey: number

      The worker node key.

      +
    • listener: ((message) => void)

      The message listener callback.

      +
        • (message): void
        • Parameters

          Returns void

    Returns void

  • Removes a task function from this pool.

    +

    Parameters

    • name: string

      The name of the task function.

      +

    Returns Promise<boolean>

    true if the task function was removed, false otherwise.

    +
  • Removes the given worker from the pool worker nodes.

    +

    Parameters

    • worker: Worker

      The worker.

      +

    Returns void

  • Sends the startup message to worker given its worker node key.

    +

    Parameters

    • workerNodeKey: number

      The worker node key.

      +

    Returns void

  • Sends the statistics message to worker given its worker node key.

    +

    Parameters

    • workerNodeKey: number

      The worker node key.

      +

    Returns void

  • Sends a message to worker given its worker node key.

    +

    Parameters

    • workerNodeKey: number

      The worker node key.

      +
    • message: MessageValue<Data, unknown>

      The message.

      +
    • Optional transferList: TransferListItem[]

      The optional array of transferable objects.

      +

    Returns void

  • Sets the default task function in this pool.

    +

    Parameters

    • name: string

      The name of the task function.

      +

    Returns Promise<boolean>

    true if the default task function was set, false otherwise.

    +
  • Sets the worker choice strategy in this pool.

    +

    Parameters

    • workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

      The worker choice strategy.

      +
    • Optional workerChoiceStrategyOptions: WorkerChoiceStrategyOptions

      The worker choice strategy options.

      +

    Returns void

  • Setup hook to execute code before worker nodes are created in the abstract constructor. Can be overridden.

    -
    -

    Returns void

    -
-
- -
    - -
  • -

    Conditions for dynamic worker creation.

    -
    -

    Returns boolean

    Whether to create a dynamic worker or not.

    - -
-
- -
-
- -
    - -
  • -

    Whether the worker node shall update its task function worker usage or not.

    -
    -
    -

    Parameters

    -
      -
    • -
      workerNodeKey: number
      -

      The worker node key.

      -
      -
    -

    Returns boolean

    true if the worker node shall update its task function worker usage, false otherwise.

    - -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      workerNodeKey: number
    • -
    • -
      taskName: string
    -

    Returns void

-
- -
-
- -
    - -
  • -

    This method is the message listener registered on each worker.

    -
    -
    -

    Parameters

    -
    -

    Returns void

    -
-
- -
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Returns void

  • Conditions for dynamic worker creation.

    +

    Returns boolean

    Whether to create a dynamic worker or not.

    +
  • Whether the worker node shall update its task function worker usage or not.

    +

    Parameters

    • workerNodeKey: number

      The worker node key.

      +

    Returns boolean

    true if the worker node shall update its task function worker usage, false otherwise.

    +
  • Parameters

    • workerNodeKey: number
    • taskName: string

    Returns void

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/AbstractWorker.html b/docs/classes/AbstractWorker.html index 3c5b2f57..2d8dfa49 100644 --- a/docs/classes/AbstractWorker.html +++ b/docs/classes/AbstractWorker.html @@ -1,65 +1,9 @@ -AbstractWorker | poolifier - v3.0.5
-
- -
-
-
-
- -

Class AbstractWorker<MainWorker, Data, Response>Abstract

-
-

Base class that implements some shared logic for all poolifier workers.

-
-
-
-

Type Parameters

-
    -
  • -

    MainWorker extends Worker | MessagePort

    -

    Type of main worker.

    -
    -
  • -
  • -

    Data = unknown

    -

    Type of data this worker receives from pool's execution. This can only be structured-cloneable data.

    -
    -
  • -
  • -

    Response = unknown

    -

    Type of response the worker sends back to the main worker. This can only be structured-cloneable data.

    -
    -
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
activeInterval? +AbstractWorker | poolifier - v3.0.5

Class AbstractWorker<MainWorker, Data, Response>Abstract

Base class that implements some shared logic for all poolifier workers.

+

Type Parameters

  • MainWorker extends Worker | MessagePort

    Type of main worker.

    +
  • Data = unknown

    Type of data this worker receives from pool's execution. This can only be structured-cloneable data.

    +
  • Response = unknown

    Type of response the worker sends back to the main worker. This can only be structured-cloneable data.

    +

Hierarchy

-
-

Constructors

-
- -
    - -
  • -

    Constructs a new poolifier worker.

    -
    -
    -

    Type Parameters

    -
      -
    • -

      MainWorker extends MessagePort | Worker

    • -
    • -

      Data = unknown

    • -
    • -

      Response = unknown

    -
    -

    Parameters

    -
      -
    • -
      type: string
      -

      The type of async event.

      -
      -
    • -
    • -
      isMain: boolean
      -

      Whether this is the main worker or not.

      -
      -
    • -
    • -
      mainWorker: MainWorker
      -

      Reference to main worker.

      -
      -
    • -
    • -
      taskFunctions: TaskFunction<Data, Response> | TaskFunctions<Data, Response>
      -

      Task function(s) processed by the worker when the pool's execution function is invoked. The first function is the default function.

      -
      -
    • -
    • -
      opts: WorkerOptions = DEFAULT_WORKER_OPTIONS
      -

      Options for the worker.

      -
      -
    -

    Returns AbstractWorker<MainWorker, Data, Response>

    -
-
-

Properties

-
- -
activeInterval?: Timeout
-

Handler id of the activeInterval worker activity check.

-
-
-
- -
id: number
-

Worker id.

-
-
-
- -
isMain: boolean
-

Whether this is the main worker or not.

-
-
-
- -
lastTaskTimestamp: number
-

Timestamp of the last task processed by this worker.

-
-
-
- -
mainWorker: MainWorker
-

Reference to main worker.

-
-
-
- -
opts: WorkerOptions = DEFAULT_WORKER_OPTIONS
-

Options for the worker.

-
-
-
- -
statistics: WorkerStatistics
-

Performance statistics computation requirements.

-
-
-
- -
taskFunctions: Map<string, TaskFunction<Data, Response>>
-

Task function(s) processed by the worker when the pool's execution function is invoked.

-
-
-
-

Methods

-
- -

Constructors

  • Constructs a new poolifier worker.

    +

    Type Parameters

    • MainWorker extends MessagePort | Worker

    • Data = unknown

    • Response = unknown

    Parameters

    • type: string

      The type of async event.

      +
    • isMain: boolean

      Whether this is the main worker or not.

      +
    • mainWorker: MainWorker

      Reference to main worker.

      +
    • taskFunctions: TaskFunction<Data, Response> | TaskFunctions<Data, Response>

      Task function(s) processed by the worker when the pool's execution function is invoked. The first function is the default function.

      +
    • opts: WorkerOptions = DEFAULT_WORKER_OPTIONS

      Options for the worker.

      +

    Returns AbstractWorker<MainWorker, Data, Response>

Properties

activeInterval?: Timeout

Handler id of the activeInterval worker activity check.

+
id: number

Worker id.

+
isMain: boolean

Whether this is the main worker or not.

+
lastTaskTimestamp: number

Timestamp of the last task processed by this worker.

+
mainWorker: MainWorker

Reference to main worker.

+
opts: WorkerOptions = DEFAULT_WORKER_OPTIONS

Options for the worker.

+
statistics: WorkerStatistics

Performance statistics computation requirements.

+
taskFunctions: Map<string, TaskFunction<Data, Response>>

Task function(s) processed by the worker when the pool's execution function is invoked.

+

Methods

-
- -
    - -
  • -

    Returns number

    The unique asyncId assigned to the resource.

    - -
-
- -
-
- -
    - -
  • -

    Binds the given function to execute to this AsyncResource's scope.

    -
    -
    -

    Type Parameters

    -
      -
    • -

      Func extends ((...args) => any)

    -
    -

    Parameters

    -
      -
    • -
      fn: Func
      -

      The function to bind to the current AsyncResource.

      -
      -
    -

    Returns Func

    -
    -

    Since

    v14.8.0, v12.19.0

    -
-
- -
-
- -
-
- -
-
- -
    - -
  • -

    Checks if the taskFunctions parameter is passed to the constructor and valid.

    -
    -
    -

    Parameters

    -
      -
    • -
      taskFunctions: TaskFunction<Data, Response> | TaskFunctions<Data, Response>
      -

      The task function(s) parameter that should be checked.

      -
      -
    -

    Returns void

    -
-
- -
-
- -
  • Returns number

    The unique asyncId assigned to the resource.

    +
  • Binds the given function to execute to this AsyncResource's scope.

    +

    Type Parameters

    • Func extends ((...args) => any)

    Parameters

    • fn: Func

      The function to bind to the current AsyncResource.

      +

    Returns Func

    Since

    v14.8.0, v12.19.0

    +
  • Checks if the taskFunctions parameter is passed to the constructor and valid.

    +

    Parameters

    • taskFunctions: TaskFunction<Data, Response> | TaskFunctions<Data, Response>

      The task function(s) parameter that should be checked.

      +

    Returns void

  • Call all destroy hooks. This should only ever be called once. An error will be thrown if it is called more than once. This must be manually called. If the resource is left to be collected by the GC then the destroy hooks will never be called.

    -
    -

    Returns AbstractWorker<MainWorker, Data, Response>

    A reference to asyncResource.

    - -
-
- -
-
- -
-
- -
    - -
  • -

    Handles an error and convert it to a string so it can be sent back to the main worker.

    -
    -
    -

    Parameters

    -
      -
    • -
      error: string | Error
      -

      The error raised by the worker.

      -
      -
    -

    Returns string

    The error message.

    - -
-
- -
-
- -
    - -
  • -

    Handles the ready message sent by the main worker.

    -
    -
    -

    Parameters

    -
      -
    • -
      message: MessageValue<Data, unknown>
      -

      The ready message.

      -
      -
    -

    Returns void

    -
-
- -
-
- -
-
- -
    - -
  • -

    Lists the names of the worker's task functions.

    -
    -

    Returns string[]

    The names of the worker's task functions.

    - -
-
- -
-
- -
-
- -
-
- -
    - -
  • -

    Runs the given task function asynchronously.

    -
    -
    -

    Parameters

    -
      -
    • -
      fn: TaskAsyncFunction<Data, Response>
      -

      Task function that will be executed.

      -
      -
    • -
    • -
      task: Task<Data>
      -

      Input data for the task function.

      -
      -
    -

    Returns void

    -
-
- -
    - -
  • -

    Call the provided function with the provided arguments in the execution context +

    Returns AbstractWorker<MainWorker, Data, Response>

    A reference to asyncResource.

    +
  • Handles an error and convert it to a string so it can be sent back to the main worker.

    +

    Parameters

    • error: string | Error

      The error raised by the worker.

      +

    Returns string

    The error message.

    +
  • Lists the names of the worker's task functions.

    +

    Returns string[]

    The names of the worker's task functions.

    +
  • Call the provided function with the provided arguments in the execution context of the async resource. This will establish the context, trigger the AsyncHooks before callbacks, call the function, trigger the AsyncHooks after callbacks, and then restore the original execution context.

    -
    -
    -

    Type Parameters

    -
      -
    • -

      This

    • -
    • -

      Result

    -
    -

    Parameters

    -
      -
    • -
      fn: ((this, ...args) => Result)
      -

      The function to call in the execution context of this async resource.

      -
      -
      -
        -
      • -
          -
        • (this, ...args): Result
        • -
        • -
          -

          Parameters

          -
            -
          • -
            this: This
          • -
          • -
            Rest ...args: any[]
          -

          Returns Result

    • -
    • -
      Optional thisArg: This
      -

      The receiver to be used for the function call.

      -
      -
    • -
    • -
      Rest ...args: any[]
      -

      Optional arguments to pass to the function.

      -
      -
    -

    Returns Result

    -
    -

    Since

    v9.6.0

    -
-
- -
    - -
  • -

    Runs the given task function synchronously.

    -
    -
    -

    Parameters

    -
      -
    • -
      fn: TaskSyncFunction<Data, Response>
      -

      Task function that will be executed.

      -
      -
    • -
    • -
      task: Task<Data>
      -

      Input data for the task function.

      -
      -
    -

    Returns void

    -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
    - -
  • -

    Returns number

    The same triggerAsyncId that is passed to the AsyncResource constructor.

    - -
-
- -
-
- -
    - -
  • -

    Binds the given function to the current execution context.

    -
    -
    -

    Type Parameters

    -
      -
    • -

      Func extends ((this, ...args) => any)

    • -
    • -

      ThisArg

    -
    -

    Parameters

    -
      -
    • -
      fn: Func
      -

      The function to bind to the current execution context.

      -
      -
    • -
    • -
      Optional type: string
      -

      An optional name to associate with the underlying AsyncResource.

      -
      -
    • -
    • -
      Optional thisArg: ThisArg
    -

    Returns Func

    -
    -

    Since

    v14.8.0, v12.19.0

    -
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Type Parameters

  • This

  • Result

Parameters

  • fn: ((this, ...args) => Result)

    The function to call in the execution context of this async resource.

    +
      • (this, ...args): Result
      • Parameters

        • this: This
        • Rest ...args: any[]

        Returns Result

  • Optional thisArg: This

    The receiver to be used for the function call.

    +
  • Rest ...args: any[]

    Optional arguments to pass to the function.

    +

Returns Result

Since

v9.6.0

+
  • Returns number

    The same triggerAsyncId that is passed to the AsyncResource constructor.

    +
  • Binds the given function to the current execution context.

    +

    Type Parameters

    • Func extends ((this, ...args) => any)

    • ThisArg

    Parameters

    • fn: Func

      The function to bind to the current execution context.

      +
    • Optional type: string

      An optional name to associate with the underlying AsyncResource.

      +
    • Optional thisArg: ThisArg

    Returns Func

    Since

    v14.8.0, v12.19.0

    +

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/CircularArray.html b/docs/classes/CircularArray.html index 767eb3b8..76b7af4a 100644 --- a/docs/classes/CircularArray.html +++ b/docs/classes/CircularArray.html @@ -1,56 +1,10 @@ -CircularArray | poolifier - v3.0.5
-
- -
-
-
-
- -

Class CircularArray<T>Internal

-
-

Array with a maximum length and shifting items when full.

-
-
-
-

Type Parameters

-
    -
  • -

    T

-
-

Hierarchy

-
    -
  • Array<T> -
      -
    • CircularArray
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
[unscopables] +CircularArray | poolifier - v3.0.5

Class CircularArray<T>Internal

Array with a maximum length and shifting items when full.

+

Type Parameters

  • T

Hierarchy

  • Array<T>
    • CircularArray

Constructors

Properties

-
-

Methods

-

Methods

[iterator] at checkSize concat @@ -90,1539 +44,140 @@ from isArray of -
-
-

Constructors

-
- -
    - -
  • -
    -

    Type Parameters

    -
      -
    • -

      T

    -
    -

    Parameters

    -
      -
    • -
      size: number = DEFAULT_CIRCULAR_ARRAY_SIZE
    • -
    • -
      Rest ...items: T[]
    -

    Returns CircularArray<T>

-
-

Properties

-
- -
[unscopables]: {
    [unscopables]?: boolean;
    length?: boolean;
    [iterator]?: any;
    at?: any;
    concat?: any;
    copyWithin?: any;
    entries?: any;
    every?: any;
    fill?: any;
    filter?: any;
    find?: any;
    findIndex?: any;
    flat?: any;
    flatMap?: any;
    forEach?: any;
    includes?: any;
    indexOf?: any;
    join?: any;
    keys?: any;
    lastIndexOf?: any;
    map?: any;
    pop?: any;
    push?: any;
    reduce?: any;
    reduceRight?: any;
    reverse?: any;
    shift?: any;
    slice?: any;
    some?: any;
    sort?: any;
    splice?: any;
    toLocaleString?: any;
    toString?: any;
    unshift?: any;
    values?: any;
}
-

Is an object whose properties have the value 'true' +

Constructors

Properties

[unscopables]: {
    [unscopables]?: boolean;
    length?: boolean;
    [iterator]?: any;
    at?: any;
    concat?: any;
    copyWithin?: any;
    entries?: any;
    every?: any;
    fill?: any;
    filter?: any;
    find?: any;
    findIndex?: any;
    flat?: any;
    flatMap?: any;
    forEach?: any;
    includes?: any;
    indexOf?: any;
    join?: any;
    keys?: any;
    lastIndexOf?: any;
    map?: any;
    pop?: any;
    push?: any;
    reduce?: any;
    reduceRight?: any;
    reverse?: any;
    shift?: any;
    slice?: any;
    some?: any;
    sort?: any;
    splice?: any;
    toLocaleString?: any;
    toString?: any;
    unshift?: any;
    values?: any;
}

Is an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.

-
-
-

Type declaration

-
    -
  • -
    Optional Readonly [unscopables]?: boolean
    -

    Is an object whose properties have the value 'true' +

    Type declaration

    • Optional Readonly [unscopables]?: boolean

      Is an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.

      -
      -
    • -
    • -
      Optional length?: boolean
      -

      Gets or sets the length of the array. This is a number one higher than the highest index in the array.

      -
      -
    -
-
- -
length: number
-

Gets or sets the length of the array. This is a number one higher than the highest index in the array.

-
-
-
- -
size: number
-
- -
[species]: ArrayConstructor
-
-

Methods

-
- -
    - -
  • -

    Iterator

    -
    -

    Returns IterableIterator<T>

    -
-
- -
    - -
  • -

    Returns the item located at the specified index.

    -
    -
    -

    Parameters

    -
      -
    • -
      index: number
      -

      The zero-based index of the desired code unit. A negative index will count back from the last item.

      -
      -
    -

    Returns undefined | T

    -
-
- -
-
- -
-
- -
    - -
  • -

    Returns the this object after copying a section of the array identified by start and end +

  • Optional length?: boolean

    Gets or sets the length of the array. This is a number one higher than the highest index in the array.

    +
length: number

Gets or sets the length of the array. This is a number one higher than the highest index in the array.

+
size: number
[species]: ArrayConstructor

Methods

  • Iterator

    +

    Returns IterableIterator<T>

  • Returns the item located at the specified index.

    +

    Parameters

    • index: number

      The zero-based index of the desired code unit. A negative index will count back from the last item.

      +

    Returns undefined | T

  • Returns the this object after copying a section of the array identified by start and end to the same array starting at position target

    -
    -
    -

    Parameters

    -
      -
    • -
      target: number
      -

      If target is negative, it is treated as length+target where length is the +

      Parameters

      • target: number

        If target is negative, it is treated as length+target where length is the length of the array.

        -
        -
      • -
      • -
        start: number
        -

        If start is negative, it is treated as length+start. If end is negative, it +

      • start: number

        If start is negative, it is treated as length+start. If end is negative, it is treated as length+end.

        -
        -
      • -
      • -
        Optional end: number
        -

        If not specified, length of the this object is used as its default value.

        -
        -
      -

      Returns CircularArray<T>

      -
-
- -
-
- -
    - -
  • -

    Returns an iterable of key, value pairs for every entry in the array

    -
    -

    Returns IterableIterator<[number, T]>

    -
-
- -
    - -
  • -

    Determines whether all the members of an array satisfy the specified test.

    -
    -
    -

    Type Parameters

    -
      -
    • -

      S

    -
    -

    Parameters

    -
      -
    • -
      predicate: ((value, index, array) => value is S)
      -

      A function that accepts up to three arguments. The every method calls +

    • Optional end: number

      If not specified, length of the this object is used as its default value.

      +

    Returns CircularArray<T>

  • Returns an iterable of key, value pairs for every entry in the array

    +

    Returns IterableIterator<[number, T]>

  • Determines whether all the members of an array satisfy the specified test.

    +

    Type Parameters

    • S

    Parameters

    • predicate: ((value, index, array) => value is S)

      A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

      -
      -
      -
        -
      • -
          -
        • (value, index, array): value is S
        • -
        • -
          -

          Parameters

          -
            -
          • -
            value: T
          • -
          • -
            index: number
          • -
          • -
            array: T[]
          -

          Returns value is S

    • -
    • -
      Optional thisArg: any
      -

      An object to which the this keyword can refer in the predicate function. +

        • (value, index, array): value is S
        • Parameters

          • value: T
          • index: number
          • array: T[]

          Returns value is S

    • Optional thisArg: any

      An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

      -
      -
    -

    Returns this is S[]

    -
  • - -
  • -

    Determines whether all the members of an array satisfy the specified test.

    -
    -
    -

    Parameters

    -
      -
    • -
      predicate: ((value, index, array) => unknown)
      -

      A function that accepts up to three arguments. The every method calls +

    Returns this is S[]

  • Determines whether all the members of an array satisfy the specified test.

    +

    Parameters

    • predicate: ((value, index, array) => unknown)

      A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

      -
      -
      -
        -
      • -
          -
        • (value, index, array): unknown
        • -
        • -
          -

          Parameters

          -
            -
          • -
            value: T
          • -
          • -
            index: number
          • -
          • -
            array: T[]
          -

          Returns unknown

    • -
    • -
      Optional thisArg: any
      -

      An object to which the this keyword can refer in the predicate function. +

        • (value, index, array): unknown
        • Parameters

          • value: T
          • index: number
          • array: T[]

          Returns unknown

    • Optional thisArg: any

      An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

      -
      -
    -

    Returns boolean

    -
-
- -
    - -
  • -

    Changes all array elements from start to end index to a static value and returns the modified array

    -
    -
    -

    Parameters

    -
      -
    • -
      value: T
      -

      value to fill array section with

      -
      -
    • -
    • -
      Optional start: number
      -

      index to start filling the array at. If start is negative, it is treated as +

    Returns boolean

  • Changes all array elements from start to end index to a static value and returns the modified array

    +

    Parameters

    • value: T

      value to fill array section with

      +
    • Optional start: number

      index to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array.

      -
      -
    • -
    • -
      Optional end: number
      -

      index to stop filling the array at. If end is negative, it is treated as +

    • Optional end: number

      index to stop filling the array at. If end is negative, it is treated as length+end.

      -
      -
    -

    Returns CircularArray<T>

    -
-
- -
    - -
  • -

    Returns the elements of an array that meet the condition specified in a callback function.

    -
    -
    -

    Type Parameters

    -
      -
    • -

      S

    -
    -

    Parameters

    -
      -
    • -
      predicate: ((value, index, array) => value is S)
      -

      A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

      -
      -
      -
        -
      • -
          -
        • (value, index, array): value is S
        • -
        • -
          -

          Parameters

          -
            -
          • -
            value: T
          • -
          • -
            index: number
          • -
          • -
            array: T[]
          -

          Returns value is S

    • -
    • -
      Optional thisArg: any
      -

      An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

      -
      -
    -

    Returns S[]

    -
  • - -
  • -

    Returns the elements of an array that meet the condition specified in a callback function.

    -
    -
    -

    Parameters

    -
      -
    • -
      predicate: ((value, index, array) => unknown)
      -

      A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

      -
      -
      -
        -
      • -
          -
        • (value, index, array): unknown
        • -
        • -
          -

          Parameters

          -
            -
          • -
            value: T
          • -
          • -
            index: number
          • -
          • -
            array: T[]
          -

          Returns unknown

    • -
    • -
      Optional thisArg: any
      -

      An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

      -
      -
    -

    Returns T[]

    -
-
- -
    - -
  • -

    Returns the value of the first element in the array where predicate is true, and undefined +

Returns CircularArray<T>

  • Returns the elements of an array that meet the condition specified in a callback function.

    +

    Type Parameters

    • S

    Parameters

    • predicate: ((value, index, array) => value is S)

      A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

      +
        • (value, index, array): value is S
        • Parameters

          • value: T
          • index: number
          • array: T[]

          Returns value is S

    • Optional thisArg: any

      An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

      +

    Returns S[]

  • Returns the elements of an array that meet the condition specified in a callback function.

    +

    Parameters

    • predicate: ((value, index, array) => unknown)

      A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

      +
        • (value, index, array): unknown
        • Parameters

          • value: T
          • index: number
          • array: T[]

          Returns unknown

    • Optional thisArg: any

      An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

      +

    Returns T[]

  • Returns the value of the first element in the array where predicate is true, and undefined otherwise.

    -
    -
    -

    Type Parameters

    -
      -
    • -

      S

    -
    -

    Parameters

    -
      -
    • -
      predicate: ((value, index, obj) => value is S)
      -

      find calls predicate once for each element of the array, in ascending +

      Type Parameters

      • S

      Parameters

      • predicate: ((value, index, obj) => value is S)

        find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

        -
        -
        -
          -
        • -
            -
          • (value, index, obj): value is S
          • -
          • -
            -

            Parameters

            -
              -
            • -
              value: T
            • -
            • -
              index: number
            • -
            • -
              obj: T[]
            -

            Returns value is S

      • -
      • -
        Optional thisArg: any
        -

        If provided, it will be used as the this value for each invocation of +

          • (value, index, obj): value is S
          • Parameters

            • value: T
            • index: number
            • obj: T[]

            Returns value is S

      • Optional thisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

        -
        -
      -

      Returns undefined | S

      -
    • - -
    • -
      -

      Parameters

      -
        -
      • -
        predicate: ((value, index, obj) => unknown)
        -
          -
        • -
            -
          • (value, index, obj): unknown
          • -
          • -
            -

            Parameters

            -
              -
            • -
              value: T
            • -
            • -
              index: number
            • -
            • -
              obj: T[]
            -

            Returns unknown

      • -
      • -
        Optional thisArg: any
      -

      Returns undefined | T

-
- -
    - -
  • -

    Returns the index of the first element in the array where predicate is true, and -1 +

Returns undefined | S

  • Parameters

    • predicate: ((value, index, obj) => unknown)
        • (value, index, obj): unknown
        • Parameters

          • value: T
          • index: number
          • obj: T[]

          Returns unknown

    • Optional thisArg: any

    Returns undefined | T

    • Returns the index of the first element in the array where predicate is true, and -1 otherwise.

      -
      -
      -

      Parameters

      -
        -
      • -
        predicate: ((value, index, obj) => unknown)
        -

        find calls predicate once for each element of the array, in ascending +

        Parameters

        • predicate: ((value, index, obj) => unknown)

          find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.

          -
          -
          -
            -
          • -
              -
            • (value, index, obj): unknown
            • -
            • -
              -

              Parameters

              -
                -
              • -
                value: T
              • -
              • -
                index: number
              • -
              • -
                obj: T[]
              -

              Returns unknown

        • -
        • -
          Optional thisArg: any
          -

          If provided, it will be used as the this value for each invocation of +

            • (value, index, obj): unknown
            • Parameters

              • value: T
              • index: number
              • obj: T[]

              Returns unknown

        • Optional thisArg: any

          If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

          -
          -
        -

        Returns number

        -
    -
    - -
      - -
    • -

      Returns a new array with all sub-array elements concatenated into it recursively up to the +

    Returns number

    • Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        A

      • -
      • -

        D extends number = 1

      -
      -

      Parameters

      -
        -
      • -
        this: A
      • -
      • -
        Optional depth: D
        -

        The maximum recursion depth

        -
        -
      -

      Returns FlatArray<A, D>[]

      -
    -
    - -
      - -
    • -

      Calls a defined callback function on each element of an array. Then, flattens the result into +

      Type Parameters

      • A

      • D extends number = 1

      Parameters

      • this: A
      • Optional depth: D

        The maximum recursion depth

        +

      Returns FlatArray<A, D>[]

    • Calls a defined callback function on each element of an array. Then, flattens the result into a new array. This is identical to a map followed by flat with depth 1.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        U

      • -
      • -

        This = undefined

      -
      -

      Parameters

      -
        -
      • -
        callback: ((this, value, index, array) => U | readonly U[])
        -

        A function that accepts up to three arguments. The flatMap method calls the +

        Type Parameters

        • U

        • This = undefined

        Parameters

        • callback: ((this, value, index, array) => U | readonly U[])

          A function that accepts up to three arguments. The flatMap method calls the callback function one time for each element in the array.

          -
          -
          -
            -
          • -
              -
            • (this, value, index, array): U | readonly U[]
            • -
            • -
              -

              Parameters

              -
                -
              • -
                this: This
              • -
              • -
                value: T
              • -
              • -
                index: number
              • -
              • -
                array: T[]
              -

              Returns U | readonly U[]

        • -
        • -
          Optional thisArg: This
          -

          An object to which the this keyword can refer in the callback function. If +

            • (this, value, index, array): U | readonly U[]
            • Parameters

              • this: This
              • value: T
              • index: number
              • array: T[]

              Returns U | readonly U[]

        • Optional thisArg: This

          An object to which the this keyword can refer in the callback function. If thisArg is omitted, undefined is used as the this value.

          -
          -
        -

        Returns U[]

        -
    -
    - -
      - -
    • -

      Performs the specified action for each element in an array.

      -
      -
      -

      Parameters

      -
        -
      • -
        callbackfn: ((value, index, array) => void)
        -

        A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

        -
        -
        -
          -
        • -
            -
          • (value, index, array): void
          • -
          • -
            -

            Parameters

            -
              -
            • -
              value: T
            • -
            • -
              index: number
            • -
            • -
              array: T[]
            -

            Returns void

      • -
      • -
        Optional thisArg: any
        -

        An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

        -
        -
      -

      Returns void

      -
    -
    - -
    -
    - -
      - -
    • -

      Determines whether an array includes a certain element, returning true or false as appropriate.

      -
      -
      -

      Parameters

      -
        -
      • -
        searchElement: T
        -

        The element to search for.

        -
        -
      • -
      • -
        Optional fromIndex: number
        -

        The position in this array at which to begin searching for searchElement.

        -
        -
      -

      Returns boolean

      -
    -
    - -
      - -
    • -

      Returns the index of the first occurrence of a value in an array, or -1 if it is not present.

      -
      -
      -

      Parameters

      -
        -
      • -
        searchElement: T
        -

        The value to locate in the array.

        -
        -
      • -
      • -
        Optional fromIndex: number
        -

        The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.

        -
        -
      -

      Returns number

      -
    -
    - -
      - -
    • -

      Adds all the elements of an array into a string, separated by the specified separator string.

      -
      -
      -

      Parameters

      -
        -
      • -
        Optional separator: string
        -

        A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

        -
        -
      -

      Returns string

      -
    -
    - -
      - -
    • -

      Returns an iterable of keys in the array

      -
      -

      Returns IterableIterator<number>

      -
    -
    - -
      - -
    • -

      Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present.

      -
      -
      -

      Parameters

      -
        -
      • -
        searchElement: T
        -

        The value to locate in the array.

        -
        -
      • -
      • -
        Optional fromIndex: number
        -

        The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array.

        -
        -
      -

      Returns number

      -
    -
    - -
      - -
    • -

      Calls a defined callback function on each element of an array, and returns an array that contains the results.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        U

      -
      -

      Parameters

      -
        -
      • -
        callbackfn: ((value, index, array) => U)
        -

        A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

        -
        -
        -
          -
        • -
            -
          • (value, index, array): U
          • -
          • -
            -

            Parameters

            -
              -
            • -
              value: T
            • -
            • -
              index: number
            • -
            • -
              array: T[]
            -

            Returns U

      • -
      • -
        Optional thisArg: any
        -

        An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

        -
        -
      -

      Returns U[]

      -
    -
    - -
      - -
    • -

      Removes the last element from an array and returns it. +

    Returns U[]

    • Performs the specified action for each element in an array.

      +

      Parameters

      • callbackfn: ((value, index, array) => void)

        A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

        +
          • (value, index, array): void
          • Parameters

            • value: T
            • index: number
            • array: T[]

            Returns void

      • Optional thisArg: any

        An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

        +

      Returns void

    • Determines whether an array includes a certain element, returning true or false as appropriate.

      +

      Parameters

      • searchElement: T

        The element to search for.

        +
      • Optional fromIndex: number

        The position in this array at which to begin searching for searchElement.

        +

      Returns boolean

    • Returns the index of the first occurrence of a value in an array, or -1 if it is not present.

      +

      Parameters

      • searchElement: T

        The value to locate in the array.

        +
      • Optional fromIndex: number

        The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.

        +

      Returns number

    • Adds all the elements of an array into a string, separated by the specified separator string.

      +

      Parameters

      • Optional separator: string

        A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

        +

      Returns string

    • Returns an iterable of keys in the array

      +

      Returns IterableIterator<number>

    • Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present.

      +

      Parameters

      • searchElement: T

        The value to locate in the array.

        +
      • Optional fromIndex: number

        The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array.

        +

      Returns number

    • Calls a defined callback function on each element of an array, and returns an array that contains the results.

      +

      Type Parameters

      • U

      Parameters

      • callbackfn: ((value, index, array) => U)

        A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

        +
          • (value, index, array): U
          • Parameters

            • value: T
            • index: number
            • array: T[]

            Returns U

      • Optional thisArg: any

        An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

        +

      Returns U[]

    • Removes the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

      -
      -

      Returns undefined | T

      -
    -
    - -
      - -
    • -
      -

      Parameters

      -
        -
      • -
        Rest ...items: T[]
      -

      Returns number

      -
      -

      Inherit Doc

    -
    - -
      - -
    • -

      Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      -
      -
      -

      Parameters

      -
        -
      • -
        callbackfn: ((previousValue, currentValue, currentIndex, array) => T)
        -

        A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

        -
        -
        -
          -
        • -
            -
          • (previousValue, currentValue, currentIndex, array): T
          • -
          • -
            -

            Parameters

            -
              -
            • -
              previousValue: T
            • -
            • -
              currentValue: T
            • -
            • -
              currentIndex: number
            • -
            • -
              array: T[]
            -

            Returns T

      -

      Returns T

      -
    • - -
    • -
      -

      Parameters

      -
        -
      • -
        callbackfn: ((previousValue, currentValue, currentIndex, array) => T)
        -
          -
        • -
            -
          • (previousValue, currentValue, currentIndex, array): T
          • -
          • -
            -

            Parameters

            -
              -
            • -
              previousValue: T
            • -
            • -
              currentValue: T
            • -
            • -
              currentIndex: number
            • -
            • -
              array: T[]
            -

            Returns T

      • -
      • -
        initialValue: T
      -

      Returns T

    • - -
    • -

      Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        U

      -
      -

      Parameters

      -
        -
      • -
        callbackfn: ((previousValue, currentValue, currentIndex, array) => U)
        -

        A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

        -
        -
        -
          -
        • -
            -
          • (previousValue, currentValue, currentIndex, array): U
          • -
          • -
            -

            Parameters

            -
              -
            • -
              previousValue: U
            • -
            • -
              currentValue: T
            • -
            • -
              currentIndex: number
            • -
            • -
              array: T[]
            -

            Returns U

      • -
      • -
        initialValue: U
        -

        If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

        -
        -
      -

      Returns U

      -
    -
    - -
      - -
    • -

      Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      -
      -
      -

      Parameters

      -
        -
      • -
        callbackfn: ((previousValue, currentValue, currentIndex, array) => T)
        -

        A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

        -
        -
        -
          -
        • -
            -
          • (previousValue, currentValue, currentIndex, array): T
          • -
          • -
            -

            Parameters

            -
              -
            • -
              previousValue: T
            • -
            • -
              currentValue: T
            • -
            • -
              currentIndex: number
            • -
            • -
              array: T[]
            -

            Returns T

      -

      Returns T

      -
    • - -
    • -
      -

      Parameters

      -
        -
      • -
        callbackfn: ((previousValue, currentValue, currentIndex, array) => T)
        -
          -
        • -
            -
          • (previousValue, currentValue, currentIndex, array): T
          • -
          • -
            -

            Parameters

            -
              -
            • -
              previousValue: T
            • -
            • -
              currentValue: T
            • -
            • -
              currentIndex: number
            • -
            • -
              array: T[]
            -

            Returns T

      • -
      • -
        initialValue: T
      -

      Returns T

    • - -
    • -

      Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        U

      -
      -

      Parameters

      -
        -
      • -
        callbackfn: ((previousValue, currentValue, currentIndex, array) => U)
        -

        A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

        -
        -
        -
          -
        • -
            -
          • (previousValue, currentValue, currentIndex, array): U
          • -
          • -
            -

            Parameters

            -
              -
            • -
              previousValue: U
            • -
            • -
              currentValue: T
            • -
            • -
              currentIndex: number
            • -
            • -
              array: T[]
            -

            Returns U

      • -
      • -
        initialValue: U
        -

        If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

        -
        -
      -

      Returns U

      -
    -
    - -
    -
    - -
      - -
    • -

      Reverses the elements in an array in place. +

      Returns undefined | T

    • Parameters

      • Rest ...items: T[]

      Returns number

      Inherit Doc

    • Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      +

      Parameters

      • callbackfn: ((previousValue, currentValue, currentIndex, array) => T)

        A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

        +
          • (previousValue, currentValue, currentIndex, array): T
          • Parameters

            • previousValue: T
            • currentValue: T
            • currentIndex: number
            • array: T[]

            Returns T

      Returns T

    • Parameters

      • callbackfn: ((previousValue, currentValue, currentIndex, array) => T)
          • (previousValue, currentValue, currentIndex, array): T
          • Parameters

            • previousValue: T
            • currentValue: T
            • currentIndex: number
            • array: T[]

            Returns T

      • initialValue: T

      Returns T

    • Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      +

      Type Parameters

      • U

      Parameters

      • callbackfn: ((previousValue, currentValue, currentIndex, array) => U)

        A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

        +
          • (previousValue, currentValue, currentIndex, array): U
          • Parameters

            • previousValue: U
            • currentValue: T
            • currentIndex: number
            • array: T[]

            Returns U

      • initialValue: U

        If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

        +

      Returns U

    • Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      +

      Parameters

      • callbackfn: ((previousValue, currentValue, currentIndex, array) => T)

        A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

        +
          • (previousValue, currentValue, currentIndex, array): T
          • Parameters

            • previousValue: T
            • currentValue: T
            • currentIndex: number
            • array: T[]

            Returns T

      Returns T

    • Parameters

      • callbackfn: ((previousValue, currentValue, currentIndex, array) => T)
          • (previousValue, currentValue, currentIndex, array): T
          • Parameters

            • previousValue: T
            • currentValue: T
            • currentIndex: number
            • array: T[]

            Returns T

      • initialValue: T

      Returns T

    • Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

      +

      Type Parameters

      • U

      Parameters

      • callbackfn: ((previousValue, currentValue, currentIndex, array) => U)

        A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

        +
          • (previousValue, currentValue, currentIndex, array): U
          • Parameters

            • previousValue: U
            • currentValue: T
            • currentIndex: number
            • array: T[]

            Returns U

      • initialValue: U

        If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

        +

      Returns U

    • Reverses the elements in an array in place. This method mutates the array and returns a reference to the same array.

      -
      -

      Returns T[]

      -
    -
    - -
      - -
    • -

      Removes the first element from an array and returns it. +

      Returns T[]

    • Removes the first element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

      -
      -

      Returns undefined | T

      -
    -
    - -
      - -
    • -

      Returns a copy of a section of an array. +

      Returns undefined | T

    • Returns a copy of a section of an array. For both start and end, a negative index can be used to indicate an offset from the end of the array. For example, -2 refers to the second to last element of the array.

      -
      -
      -

      Parameters

      -
        -
      • -
        Optional start: number
        -

        The beginning index of the specified portion of the array. +

        Parameters

        • Optional start: number

          The beginning index of the specified portion of the array. If start is undefined, then the slice begins at index 0.

          -
          -
        • -
        • -
          Optional end: number
          -

          The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. +

        • Optional end: number

          The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. If end is undefined, then the slice extends to the end of the array.

          -
          -
        -

        Returns T[]

        -
    -
    - -
      - -
    • -

      Determines whether the specified callback function returns true for any element of an array.

      -
      -
      -

      Parameters

      -
        -
      • -
        predicate: ((value, index, array) => unknown)
        -

        A function that accepts up to three arguments. The some method calls +

      Returns T[]

    • Determines whether the specified callback function returns true for any element of an array.

      +

      Parameters

      • predicate: ((value, index, array) => unknown)

        A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.

        -
        -
        -
          -
        • -
            -
          • (value, index, array): unknown
          • -
          • -
            -

            Parameters

            -
              -
            • -
              value: T
            • -
            • -
              index: number
            • -
            • -
              array: T[]
            -

            Returns unknown

      • -
      • -
        Optional thisArg: any
        -

        An object to which the this keyword can refer in the predicate function. +

          • (value, index, array): unknown
          • Parameters

            • value: T
            • index: number
            • array: T[]

            Returns unknown

      • Optional thisArg: any

        An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

        -
        -
      -

      Returns boolean

      -
    -
    - -
      - -
    • -

      Sorts an array in place. +

    Returns boolean

    • Sorts an array in place. This method mutates the array and returns a reference to the same array.

      -
      -
      -

      Parameters

      -
        -
      • -
        Optional compareFn: ((a, b) => number)
        -

        Function used to determine the order of the elements. It is expected to return +

        Parameters

        • Optional compareFn: ((a, b) => number)

          Function used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they're equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.

          [11,2,22,1].sort((a, b) => a - b)
           
          -
          -
          -
            -
          • -
              -
            • (a, b): number
            • -
            • -
              -

              Parameters

              -
                -
              • -
                a: T
              • -
              • -
                b: T
              -

              Returns number

        -

        Returns CircularArray<T>

        -
    -
    - -
      - -
    • -
      -

      Parameters

      -
        -
      • -
        start: number
      • -
      • -
        Optional deleteCount: number
      • -
      • -
        Rest ...items: T[]
      -

      Returns CircularArray<T>

      -
      -

      Inherit Doc

    -
    - -
      - -
    • -

      Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.

      -
      -

      Returns string

      -
    -
    - -
      - -
    • -

      Returns a string representation of an array.

      -
      -

      Returns string

      -
    -
    - -
      - -
    • -
      -

      Parameters

      -
        -
      • -
        Rest ...items: T[]
      -

      Returns number

      -
      -

      Inherit Doc

    -
    - -
      - -
    • -

      Returns an iterable of values in the array

      -
      -

      Returns IterableIterator<T>

      -
    -
    - -
      - -
    • -

      Creates an array from an array-like object.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        T

      -
      -

      Parameters

      -
        -
      • -
        arrayLike: ArrayLike<T>
        -

        An array-like object to convert to an array.

        -
        -
      -

      Returns T[]

      -
    • - -
    • -

      Creates an array from an iterable object.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        T

      • -
      • -

        U

      -
      -

      Parameters

      -
        -
      • -
        arrayLike: ArrayLike<T>
        -

        An array-like object to convert to an array.

        -
        -
      • -
      • -
        mapfn: ((v, k) => U)
        -

        A mapping function to call on every element of the array.

        -
        -
        -
          -
        • -
            -
          • (v, k): U
          • -
          • -
            -

            Parameters

            -
              -
            • -
              v: T
            • -
            • -
              k: number
            -

            Returns U

      • -
      • -
        Optional thisArg: any
        -

        Value of 'this' used to invoke the mapfn.

        -
        -
      -

      Returns U[]

      -
    • - -
    • -

      Creates an array from an iterable object.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        T

      -
      -

      Parameters

      -
        -
      • -
        iterable: Iterable<T> | ArrayLike<T>
        -

        An iterable object to convert to an array.

        -
        -
      -

      Returns T[]

      -
    • - -
    • -

      Creates an array from an iterable object.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        T

      • -
      • -

        U

      -
      -

      Parameters

      -
        -
      • -
        iterable: Iterable<T> | ArrayLike<T>
        -

        An iterable object to convert to an array.

        -
        -
      • -
      • -
        mapfn: ((v, k) => U)
        -

        A mapping function to call on every element of the array.

        -
        -
        -
          -
        • -
            -
          • (v, k): U
          • -
          • -
            -

            Parameters

            -
              -
            • -
              v: T
            • -
            • -
              k: number
            -

            Returns U

      • -
      • -
        Optional thisArg: any
        -

        Value of 'this' used to invoke the mapfn.

        -
        -
      -

      Returns U[]

      -
    -
    - -
      - -
    • -
      -

      Parameters

      -
        -
      • -
        arg: any
      -

      Returns arg is any[]

    -
    - -
      - -
    • -

      Returns a new array from a set of elements.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        T

      -
      -

      Parameters

      -
        -
      • -
        Rest ...items: T[]
        -

        A set of elements to include in the new array object.

        -
        -
      -

      Returns T[]

      -
    - -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Returns CircularArray<T>

    • Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.

      +

      Returns string

    • Returns a string representation of an array.

      +

      Returns string

    • Parameters

      • Rest ...items: T[]

      Returns number

      Inherit Doc

    • Returns an iterable of values in the array

      +

      Returns IterableIterator<T>

    • Creates an array from an array-like object.

      +

      Type Parameters

      • T

      Parameters

      • arrayLike: ArrayLike<T>

        An array-like object to convert to an array.

        +

      Returns T[]

    • Creates an array from an iterable object.

      +

      Type Parameters

      • T

      • U

      Parameters

      • arrayLike: ArrayLike<T>

        An array-like object to convert to an array.

        +
      • mapfn: ((v, k) => U)

        A mapping function to call on every element of the array.

        +
          • (v, k): U
          • Parameters

            • v: T
            • k: number

            Returns U

      • Optional thisArg: any

        Value of 'this' used to invoke the mapfn.

        +

      Returns U[]

    • Creates an array from an iterable object.

      +

      Type Parameters

      • T

      Parameters

      • iterable: Iterable<T> | ArrayLike<T>

        An iterable object to convert to an array.

        +

      Returns T[]

    • Creates an array from an iterable object.

      +

      Type Parameters

      • T

      • U

      Parameters

      • iterable: Iterable<T> | ArrayLike<T>

        An iterable object to convert to an array.

        +
      • mapfn: ((v, k) => U)

        A mapping function to call on every element of the array.

        +
          • (v, k): U
          • Parameters

            • v: T
            • k: number

            Returns U

      • Optional thisArg: any

        Value of 'this' used to invoke the mapfn.

        +

      Returns U[]

    • Parameters

      • arg: any

      Returns arg is any[]

    • Returns a new array from a set of elements.

      +

      Type Parameters

      • T

      Parameters

      • Rest ...items: T[]

        A set of elements to include in the new array object.

        +

      Returns T[]

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/ClusterWorker.html b/docs/classes/ClusterWorker.html index 7c3ace75..93ab4720 100644 --- a/docs/classes/ClusterWorker.html +++ b/docs/classes/ClusterWorker.html @@ -1,78 +1,21 @@ -ClusterWorker | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Class ClusterWorker<Data, Response>

    -
    -

    A cluster worker used by a poolifier ClusterPool.

    +ClusterWorker | poolifier - v3.0.5

    Class ClusterWorker<Data, Response>

    A cluster worker used by a poolifier ClusterPool.

    When this worker is inactive for more than the given maxInactiveTime, it will send a termination request to its main worker.

    If you use a DynamicClusterPool the extra workers that were created will be terminated, but the minimum number of workers will be guaranteed.

    -
    -

    Author

    Christopher Quadflieg

    Since

    2.0.0

    -
    -
    -

    Type Parameters

    -
      -
    • -

      Data = unknown

      -

      Type of data this worker receives from pool's execution. This can only be structured-cloneable data.

      -
      -
    • -
    • -

      Response = unknown

      -

      Type of response the worker sends back to the main worker. This can only be structured-cloneable data.

      -
      -
    -
    -

    Hierarchy

    -
    -
    -
    -
    - -
    -
    -

    Constructors

    -
    -
    -

    Properties

    -

    Type Parameters

    • Data = unknown

      Type of data this worker receives from pool's execution. This can only be structured-cloneable data.

      +
    • Response = unknown

      Type of response the worker sends back to the main worker. This can only be structured-cloneable data.

      +

    Hierarchy

    Constructors

    Properties

    -
    -

    Accessors

    -
    id -
    -
    -

    Methods

    -

    Accessors

    id +

    Methods

    addTaskFunction asyncId bind emitDestroy @@ -94,655 +37,74 @@ but the minimum number of workers will be guaranteed.

    setDefaultTaskFunction triggerAsyncId bind -
    -
    -

    Constructors

    -
    - -
    -
    -

    Properties

    -
    - -
    activeInterval?: Timeout
    -

    Handler id of the activeInterval worker activity check.

    -
    -
    -
    - -
    isMain: boolean
    -

    Whether this is the main worker or not.

    -
    -
    -
    - -
    lastTaskTimestamp: number
    -

    Timestamp of the last task processed by this worker.

    -
    -
    -
    - -
    opts: WorkerOptions = DEFAULT_WORKER_OPTIONS
    -

    Options for the worker.

    -
    -
    -
    - -
    statistics: WorkerStatistics
    -

    Performance statistics computation requirements.

    -
    -
    -
    - -
    taskFunctions: Map<string, TaskFunction<Data, Response>>
    -

    Task function(s) processed by the worker when the pool's execution function is invoked.

    -
    -
    -
    -

    Accessors

    -
    - -
    -
    -

    Methods

    -
    - -

    Constructors

    Properties

    activeInterval?: Timeout

    Handler id of the activeInterval worker activity check.

    +
    isMain: boolean

    Whether this is the main worker or not.

    +
    lastTaskTimestamp: number

    Timestamp of the last task processed by this worker.

    +
    opts: WorkerOptions = DEFAULT_WORKER_OPTIONS

    Options for the worker.

    +
    statistics: WorkerStatistics

    Performance statistics computation requirements.

    +
    taskFunctions: Map<string, TaskFunction<Data, Response>>

    Task function(s) processed by the worker when the pool's execution function is invoked.

    +

    Accessors

    Methods

    -
    - -
      - -
    • -

      Returns number

      The unique asyncId assigned to the resource.

      - -
    -
    - -
      - -
    • -

      Binds the given function to execute to this AsyncResource's scope.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        Func extends ((...args) => any)

      -
      -

      Parameters

      -
        -
      • -
        fn: Func
        -

        The function to bind to the current AsyncResource.

        -
        -
      -

      Returns Func

      -
      -

      Since

      v14.8.0, v12.19.0

      -
    -
    - -
    • Returns number

      The unique asyncId assigned to the resource.

      +
    • Binds the given function to execute to this AsyncResource's scope.

      +

      Type Parameters

      • Func extends ((...args) => any)

      Parameters

      • fn: Func

        The function to bind to the current AsyncResource.

        +

      Returns Func

      Since

      v14.8.0, v12.19.0

      +
    • Call all destroy hooks. This should only ever be called once. An error will be thrown if it is called more than once. This must be manually called. If the resource is left to be collected by the GC then the destroy hooks will never be called.

      -
      -

      Returns ClusterWorker<Data, Response>

      A reference to asyncResource.

      - -
    -
    - -
    -
    - -
      - -
    • -

      Handles an error and convert it to a string so it can be sent back to the main worker.

      -
      -
      -

      Parameters

      -
        -
      • -
        error: string | Error
        -

        The error raised by the worker.

        -
        -
      -

      Returns string

      The error message.

      - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Call the provided function with the provided arguments in the execution context +

      Returns ClusterWorker<Data, Response>

      A reference to asyncResource.

      +
    • Handles an error and convert it to a string so it can be sent back to the main worker.

      +

      Parameters

      • error: string | Error

        The error raised by the worker.

        +

      Returns string

      The error message.

      +
    • Call the provided function with the provided arguments in the execution context of the async resource. This will establish the context, trigger the AsyncHooks before callbacks, call the function, trigger the AsyncHooks after callbacks, and then restore the original execution context.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        This

      • -
      • -

        Result

      -
      -

      Parameters

      -
        -
      • -
        fn: ((this, ...args) => Result)
        -

        The function to call in the execution context of this async resource.

        -
        -
        -
          -
        • -
            -
          • (this, ...args): Result
          • -
          • -
            -

            Parameters

            -
              -
            • -
              this: This
            • -
            • -
              Rest ...args: any[]
            -

            Returns Result

      • -
      • -
        Optional thisArg: This
        -

        The receiver to be used for the function call.

        -
        -
      • -
      • -
        Rest ...args: any[]
        -

        Optional arguments to pass to the function.

        -
        -
      -

      Returns Result

      -
      -

      Since

      v9.6.0

      -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Returns number

      The same triggerAsyncId that is passed to the AsyncResource constructor.

      - -
    -
    - -
      - -
    • -

      Binds the given function to the current execution context.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        Func extends ((this, ...args) => any)

      • -
      • -

        ThisArg

      -
      -

      Parameters

      -
        -
      • -
        fn: Func
        -

        The function to bind to the current execution context.

        -
        -
      • -
      • -
        Optional type: string
        -

        An optional name to associate with the underlying AsyncResource.

        -
        -
      • -
      • -
        Optional thisArg: ThisArg
      -

      Returns Func

      -
      -

      Since

      v14.8.0, v12.19.0

      -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Type Parameters

    • This

    • Result

    Parameters

    • fn: ((this, ...args) => Result)

      The function to call in the execution context of this async resource.

      +
        • (this, ...args): Result
        • Parameters

          • this: This
          • Rest ...args: any[]

          Returns Result

    • Optional thisArg: This

      The receiver to be used for the function call.

      +
    • Rest ...args: any[]

      Optional arguments to pass to the function.

      +

    Returns Result

    Since

    v9.6.0

    +
    • Returns number

      The same triggerAsyncId that is passed to the AsyncResource constructor.

      +
    • Binds the given function to the current execution context.

      +

      Type Parameters

      • Func extends ((this, ...args) => any)

      • ThisArg

      Parameters

      • fn: Func

        The function to bind to the current execution context.

        +
      • Optional type: string

        An optional name to associate with the underlying AsyncResource.

        +
      • Optional thisArg: ThisArg

      Returns Func

      Since

      v14.8.0, v12.19.0

      +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/Deque.html b/docs/classes/Deque.html index 4d96f357..6e4909c6 100644 --- a/docs/classes/Deque.html +++ b/docs/classes/Deque.html @@ -1,58 +1,12 @@ -Deque | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Class Deque<T>Internal

    -
    -

    Deque. +Deque | poolifier - v3.0.5

    Class Deque<T>Internal

    Deque. Implemented with a doubly linked list.

    -
    -
    -
    -

    Type Parameters

    -
      -
    • -

      T

      -

      Type of deque data.

      -
      -
    -
    -

    Hierarchy

    -
      -
    • Deque
    -
    -
    -
    - -
    -
    -

    Constructors

    -
    -
    -

    Properties

    -

    Type Parameters

    • T

      Type of deque data.

      +

    Hierarchy

    • Deque

    Constructors

    Properties

    -
    -

    Methods

    -

    Methods

    [iterator] backward clear incrementSize @@ -62,246 +16,27 @@ Implemented with a doubly linked list.

    push shift unshift -
    -
    -

    Constructors

    -
    - -
    -
    -

    Properties

    -
    - -
    head?: Node<T>
    -
    - -
    maxSize: number
    -

    The maximum size of the deque.

    -
    -
    -
    - -
    size: number
    -

    The size of the deque.

    -
    -
    -
    - -
    tail?: Node<T>
    -
    -

    Methods

    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Clears the deque.

      -
      -

      Returns void

      -
    -
    - -
    -
    - -
      - -
    • -

      Peeks at the first data.

      -
      -

      Returns undefined | T

      The first data or undefined if the deque is empty.

      - -
    -
    - -
      - -
    • -

      Peeks at the last data.

      -
      -

      Returns undefined | T

      The last data or undefined if the deque is empty.

      - -
    -
    - -
      - -
    • -

      Pops data from the deque.

      -
      -

      Returns undefined | T

      The popped data or undefined if the deque is empty.

      - -
    -
    - -
      - -
    • -

      Appends data to the deque.

      -
      -
      -

      Parameters

      -
        -
      • -
        data: T
        -

        Data to append.

        -
        -
      -

      Returns number

      The new size of the queue.

      - -
    -
    - -
      - -
    • -

      Shifts data from the deque.

      -
      -

      Returns undefined | T

      The shifted data or undefined if the deque is empty.

      - -
    -
    - -
      - -
    • -

      Prepends data to the deque.

      -
      -
      -

      Parameters

      -
        -
      • -
        data: T
        -

        Data to prepend.

        -
        -
      -

      Returns number

      The new size of the queue.

      - -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Constructors

    Properties

    head?: Node<T>
    maxSize: number

    The maximum size of the deque.

    +
    size: number

    The size of the deque.

    +
    tail?: Node<T>

    Methods

    • Peeks at the first data.

      +

      Returns undefined | T

      The first data or undefined if the deque is empty.

      +
    • Peeks at the last data.

      +

      Returns undefined | T

      The last data or undefined if the deque is empty.

      +
    • Pops data from the deque.

      +

      Returns undefined | T

      The popped data or undefined if the deque is empty.

      +
    • Appends data to the deque.

      +

      Parameters

      • data: T

        Data to append.

        +

      Returns number

      The new size of the queue.

      +
    • Shifts data from the deque.

      +

      Returns undefined | T

      The shifted data or undefined if the deque is empty.

      +
    • Prepends data to the deque.

      +

      Parameters

      • data: T

        Data to prepend.

        +

      Returns number

      The new size of the queue.

      +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/DynamicClusterPool.html b/docs/classes/DynamicClusterPool.html index ae97fc9c..69332326 100644 --- a/docs/classes/DynamicClusterPool.html +++ b/docs/classes/DynamicClusterPool.html @@ -1,63 +1,12 @@ -DynamicClusterPool | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Class DynamicClusterPool<Data, Response>

    -
    -

    A cluster pool with a dynamic number of workers, but a guaranteed minimum number of workers.

    +DynamicClusterPool | poolifier - v3.0.5

    Class DynamicClusterPool<Data, Response>

    A cluster pool with a dynamic number of workers, but a guaranteed minimum number of workers.

    This cluster pool creates new workers when the others are busy, up to the maximum number of workers. When the maximum number of workers is reached and workers are busy, an event is emitted. If you want to listen to this event, use the pool's emitter.

    -
    -

    Author

    Christopher Quadflieg

    Since

    2.0.0

    -
    -
    -

    Type Parameters

    -
      -
    • -

      Data = unknown

      -

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

      -
      -
    • -
    • -

      Response = unknown

      -

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

      -
      -
    -
    -

    Hierarchy

    -
    -
    -
    -
    - -
    -
    -

    Constructors

    -
    -
    -

    Properties

    -

    Type Parameters

    • Data = unknown

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

      +
    • Response = unknown

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

      +

    Hierarchy

    Constructors

    Properties

    emitter? filePath max numberOfWorkers @@ -65,10 +14,7 @@ When the maximum number of workers is reached and workers are busy, an event is promiseResponseMap workerChoiceStrategyContext workerNodes -
    -
    -

    Accessors

    -

    Accessors

    busy full info maxSize @@ -77,10 +23,7 @@ When the maximum number of workers is reached and workers are busy, an event is type utilization worker -
    -
    -

    Methods

    -

    Methods

    addTaskFunction afterTaskExecutionHook afterWorkerNodeSetup beforeTaskExecutionHook @@ -113,57 +56,12 @@ When the maximum number of workers is reached and workers are busy, an event is setupHook start workerMessageListener -
    -
    -

    Constructors

    -
    - -
      - -
    • -

      Constructs a new poolifier dynamic cluster pool.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        Data = unknown

      • -
      • -

        Response = unknown

      -
      -

      Parameters

      -
        -
      • -
        min: number
        -

        Minimum number of workers which are always active.

        -
        -
      • -
      • -
        max: number
        -

        Maximum number of workers that can be created by this pool.

        -
        -
      • -
      • -
        filePath: string
        -

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

        -
        -
      • -
      • -
        opts: ClusterPoolOptions = {}
        -

        Options for this dynamic cluster pool.

        -
        -
      -

      Returns DynamicClusterPool<Data, Response>

      -
    -
    -

    Properties

    -
    - -
    emitter?: EventEmitterAsyncResource
    -

    Event emitter integrated with async resource on which events can be listened to. +

    Constructors

    • Constructs a new poolifier dynamic cluster pool.

      +

      Type Parameters

      • Data = unknown

      • Response = unknown

      Parameters

      • min: number

        Minimum number of workers which are always active.

        +
      • max: number

        Maximum number of workers that can be created by this pool.

        +
      • filePath: string

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

        +
      • opts: ClusterPoolOptions = {}

        Options for this dynamic cluster pool.

        +

      Returns DynamicClusterPool<Data, Response>

    Properties

    emitter?: EventEmitterAsyncResource

    Event emitter integrated with async resource on which events can be listened to. The async tracking tooling identifier is poolifier:<PoolType>-<WorkerType>-pool.

    Events that can currently be listened to:

      @@ -175,981 +73,109 @@ The async tracking tooling identifier is poolifier:<PoolType>-<Wo
    • 'taskError': Emitted when an error occurs while executing a task.
    • 'backPressure': Emitted when all worker nodes have back pressure (i.e. their tasks queue is full: queue size >= maximum queue size).
    -
    -
    -
    - -
    filePath: string
    -

    Path to the worker file.

    -
    -
    -
    - -
    max: number
    -

    Maximum number of workers that can be created by this pool.

    -
    -
    -
    - -
    numberOfWorkers: number
    -

    Number of workers that this pool should manage.

    -
    -
    -
    - - -

    Options for this fixed cluster pool.

    -
    -
    -
    - -
    promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...
    -

    The task execution response promise map:

    +
    filePath: string

    Path to the worker file.

    +
    max: number

    Maximum number of workers that can be created by this pool.

    +
    numberOfWorkers: number

    Number of workers that this pool should manage.

    +

    Options for this fixed cluster pool.

    +
    promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...

    The task 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: IWorkerNode<Worker, Data>[] = []
    -

    Pool worker nodes.

    -
    -
    -
    -

    Accessors

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

    Worker choice strategy context referencing a worker choice algorithm implementation.

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

    Pool worker nodes.

    +

    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 maxSize(): number
    • -
    • -

      The pool maximum size.

      -
      -

      Returns number

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

      The pool minimum size.

      -
      -

      Returns number

      -
    -
    - -
      -
    • get ready(): boolean
    • -
    • -

      The pool readiness boolean status.

      -
      -

      Returns boolean

      -
    -
    - -
    • get type(): "fixed" | "dynamic"
    • The pool type.

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

      -
      -

      Returns "fixed" | "dynamic"

      -
    -
    - -
      -
    • get utilization(): number
    • -
    • -

      The approximate pool utilization.

      -
      -

      Returns number

      The pool utilization.

      - -
    -
    - -
      -
    • get worker(): "thread" | "cluster"
    • -
    • -

      The worker type.

      -
      -

      Returns "thread" | "cluster"

      -
    -
    -

    Methods

    -
    - -
      - -
    • -

      Adds a task function to this pool. +

      Returns "fixed" | "dynamic"

    • get utilization(): number
    • The approximate pool utilization.

      +

      Returns number

      The pool utilization.

      +
    • get worker(): "thread" | "cluster"
    • The worker type.

      +

      Returns "thread" | "cluster"

    Methods

    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Deregisters a listener callback on the worker given its worker node key.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        Message

      -
      -

      Parameters

      -
        -
      • -
        workerNodeKey: number
        -

        The worker node key.

        -
        -
      • -
      • -
        listener: ((message) => void)
        -

        The message listener callback.

        -
        -
        -
          -
        • -
            -
          • (message): void
          • -
          • -
            -

            Parameters

            -
            -

            Returns void

      -

      Returns void

      -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Enables/disables the worker node tasks queue in this pool.

      -
      -
      -

      Parameters

      -
        -
      • -
        enable: boolean
        -

        Whether to enable or disable the worker node tasks queue.

        -
        -
      • -
      • -
        Optional tasksQueueOptions: TasksQueueOptions
        -

        The worker node tasks queue options.

        -
        -
      -

      Returns void

      -
    -
    - -
      - -
    • -

      Executes the specified function in the worker constructor with the task data input parameter.

      -
      -
      -

      Parameters

      -
        -
      • -
        Optional data: Data
        -

        The optional task input data for the specified task function. This can only be structured-cloneable data.

        -
        -
      • -
      • -
        Optional name: string
        -

        The optional name of the task function to execute. If not specified, the default task function will be executed.

        -
        -
      • -
      • -
        Optional transferList: TransferListItem[]
        -

        An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the pool's worker_threads worker and they should not be used in the main thread afterwards.

        -
        -
      -

      Returns Promise<Response>

      Promise that will be fulfilled when the task is completed.

      - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Whether the specified task function exists in this pool.

      -
      -
      -

      Parameters

      -
        -
      • -
        name: string
        -

        The name of the task function.

        -
        -
      -

      Returns boolean

      true if the task function exists, false otherwise.

      - -
    -
    - -
      - -
    • Internal -

      Whether the worker node has back pressure (i.e. its tasks queue is full).

      -
      -
      -

      Parameters

      -
        -
      • -
        workerNodeKey: number
        -

        The worker node key.

        -
        -
      -

      Returns boolean

      true if the worker node has back pressure, false otherwise.

      - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Registers once a listener callback on the worker given its worker node key.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        Message

      -
      -

      Parameters

      -
        -
      • -
        workerNodeKey: number
        -

        The worker node key.

        -
        -
      • -
      • -
        listener: ((message) => void)
        -

        The message listener callback.

        -
        -
        -
          -
        • -
            -
          • (message): void
          • -
          • -
            -

            Parameters

            -
            -

            Returns void

      -

      Returns void

      -
    -
    - -
      - -
    • -

      Registers a listener callback on the worker given its worker node key.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        Message

      -
      -

      Parameters

      -
        -
      • -
        workerNodeKey: number
        -

        The worker node key.

        -
        -
      • -
      • -
        listener: ((message) => void)
        -

        The message listener callback.

        -
        -
        -
          -
        • -
            -
          • (message): void
          • -
          • -
            -

            Parameters

            -
            -

            Returns void

      -

      Returns void

      -
    -
    - -
      - -
    • -

      Removes a task function from this pool.

      -
      -
      -

      Parameters

      -
        -
      • -
        name: string
        -

        The name of the task function.

        -
        -
      -

      Returns Promise<boolean>

      true if the task function was removed, false otherwise.

      - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Sets the default task function in this pool.

      -
      -
      -

      Parameters

      -
        -
      • -
        name: string
        -

        The name of the task function.

        -
        -
      -

      Returns Promise<boolean>

      true if the default task function was set, false otherwise.

      - -
    -
    - -
    -
    - -
      - -
    • -

      Sets the worker choice strategy in this pool.

      -
      -
      -

      Parameters

      -
        -
      • -
        workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
        -

        The worker choice strategy.

        -
        -
      • -
      • -
        Optional workerChoiceStrategyOptions: WorkerChoiceStrategyOptions
        -

        The worker choice strategy options.

        -
        -
      -

      Returns void

      -
    -
    - -
    -
    - -
    • Deregisters a listener callback on the worker given its worker node key.

      +

      Type Parameters

      • Message

      Parameters

      • workerNodeKey: number

        The worker node key.

        +
      • listener: ((message) => void)

        The message listener callback.

        +
          • (message): void
          • Parameters

            Returns void

      Returns void

    • Executes the specified function in the worker constructor with the task data input parameter.

      +

      Parameters

      • Optional data: Data

        The optional task input data for the specified task function. This can only be structured-cloneable data.

        +
      • Optional name: string

        The optional name of the task function to execute. If not specified, the default task function will be executed.

        +
      • Optional transferList: TransferListItem[]

        An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the pool's worker_threads worker and they should not be used in the main thread afterwards.

        +

      Returns Promise<Response>

      Promise that will be fulfilled when the task is completed.

      +
    • Internal

      Whether the worker node has back pressure (i.e. its tasks queue is full).

      +

      Parameters

      • workerNodeKey: number

        The worker node key.

        +

      Returns boolean

      true if the worker node has back pressure, false otherwise.

      +
    • Registers once a listener callback on the worker given its worker node key.

      +

      Type Parameters

      • Message

      Parameters

      • workerNodeKey: number

        The worker node key.

        +
      • listener: ((message) => void)

        The message listener callback.

        +
          • (message): void
          • Parameters

            Returns void

      Returns void

    • Registers a listener callback on the worker given its worker node key.

      +

      Type Parameters

      • Message

      Parameters

      • workerNodeKey: number

        The worker node key.

        +
      • listener: ((message) => void)

        The message listener callback.

        +
          • (message): void
          • Parameters

            Returns void

      Returns void

    • Sets the worker choice strategy in this pool.

      +

      Parameters

      • workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

        The worker choice strategy.

        +
      • Optional workerChoiceStrategyOptions: WorkerChoiceStrategyOptions

        The worker choice strategy options.

        +

      Returns void

    -
    - -
    -
    - -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Returns void

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/DynamicThreadPool.html b/docs/classes/DynamicThreadPool.html index f08d1a64..b0ef4dd4 100644 --- a/docs/classes/DynamicThreadPool.html +++ b/docs/classes/DynamicThreadPool.html @@ -1,63 +1,12 @@ -DynamicThreadPool | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Class DynamicThreadPool<Data, Response>

    -
    -

    A thread pool with a dynamic number of threads, but a guaranteed minimum number of threads.

    +DynamicThreadPool | poolifier - v3.0.5

    Class DynamicThreadPool<Data, Response>

    A thread pool with a dynamic number of threads, but a guaranteed minimum number of threads.

    This thread pool creates new threads when the others are busy, up to the maximum number of threads. When the maximum number of threads is reached and workers are busy, an event is emitted. If you want to listen to this event, use the pool's emitter.

    -
    -

    Author

    Alessandro Pio Ardizio

    Since

    0.0.1

    -
    -
    -

    Type Parameters

    -
      -
    • -

      Data = unknown

      -

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

      -
      -
    • -
    • -

      Response = unknown

      -

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

      -
      -
    -
    -

    Hierarchy

    -
    -
    -
    -
    - -
    -
    -

    Constructors

    -
    -
    -

    Properties

    -

    Type Parameters

    • Data = unknown

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

      +
    • Response = unknown

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

      +

    Hierarchy

    Constructors

    Properties

    emitter? filePath max numberOfWorkers @@ -65,10 +14,7 @@ When the maximum number of threads is reached and workers are busy, an event is promiseResponseMap workerChoiceStrategyContext workerNodes -
    -
    -

    Accessors

    -

    Accessors

    busy full info maxSize @@ -77,10 +23,7 @@ When the maximum number of threads is reached and workers are busy, an event is type utilization worker -
    -
    -

    Methods

    -

    Methods

    addTaskFunction afterTaskExecutionHook afterWorkerNodeSetup beforeTaskExecutionHook @@ -113,57 +56,12 @@ When the maximum number of threads is reached and workers are busy, an event is setupHook start workerMessageListener -
    -
    -

    Constructors

    -
    - -
      - -
    • -

      Constructs a new poolifier dynamic thread pool.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        Data = unknown

      • -
      • -

        Response = unknown

      -
      -

      Parameters

      -
        -
      • -
        min: number
        -

        Minimum number of threads which are always active.

        -
        -
      • -
      • -
        max: number
        -

        Maximum number of threads that can be created by this pool.

        -
        -
      • -
      • -
        filePath: string
        -

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

        -
        -
      • -
      • -
        opts: ThreadPoolOptions = {}
        -

        Options for this dynamic thread pool.

        -
        -
      -

      Returns DynamicThreadPool<Data, Response>

      -
    -
    -

    Properties

    -
    - -
    emitter?: EventEmitterAsyncResource
    -

    Event emitter integrated with async resource on which events can be listened to. +

    Constructors

    • Constructs a new poolifier dynamic thread pool.

      +

      Type Parameters

      • Data = unknown

      • Response = unknown

      Parameters

      • min: number

        Minimum number of threads which are always active.

        +
      • max: number

        Maximum number of threads that can be created by this pool.

        +
      • filePath: string

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

        +
      • opts: ThreadPoolOptions = {}

        Options for this dynamic thread pool.

        +

      Returns DynamicThreadPool<Data, Response>

    Properties

    emitter?: EventEmitterAsyncResource

    Event emitter integrated with async resource on which events can be listened to. The async tracking tooling identifier is poolifier:<PoolType>-<WorkerType>-pool.

    Events that can currently be listened to:

      @@ -175,986 +73,110 @@ The async tracking tooling identifier is poolifier:<PoolType>-<Wo
    • 'taskError': Emitted when an error occurs while executing a task.
    • 'backPressure': Emitted when all worker nodes have back pressure (i.e. their tasks queue is full: queue size >= maximum queue size).
    -
    -
    -
    - -
    filePath: string
    -

    Path to the worker file.

    -
    -
    -
    - -
    max: number
    -

    Maximum number of threads that can be created by this pool.

    -
    -
    -
    - -
    numberOfWorkers: number
    -

    Number of workers that this pool should manage.

    -
    -
    -
    - - -

    Options for this fixed thread pool.

    -
    -
    -
    - -
    promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...
    -

    The task execution response promise map:

    +
    filePath: string

    Path to the worker file.

    +
    max: number

    Maximum number of threads that can be created by this pool.

    +
    numberOfWorkers: number

    Number of workers that this pool should manage.

    +

    Options for this fixed thread pool.

    +
    promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...

    The task 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: IWorkerNode<Worker, Data>[] = []
    -

    Pool worker nodes.

    -
    -
    -
    -

    Accessors

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

    Worker choice strategy context referencing a worker choice algorithm implementation.

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

    Pool worker nodes.

    +

    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 maxSize(): number
    • -
    • -

      The pool maximum size.

      -
      -

      Returns number

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

      The pool minimum size.

      -
      -

      Returns number

      -
    -
    - -
      -
    • get ready(): boolean
    • -
    • -

      The pool readiness boolean status.

      -
      -

      Returns boolean

      -
    -
    - -
    • get type(): "fixed" | "dynamic"
    • The pool type.

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

      -
      -

      Returns "fixed" | "dynamic"

      -
    -
    - -
      -
    • get utilization(): number
    • -
    • -

      The approximate pool utilization.

      -
      -

      Returns number

      The pool utilization.

      - -
    -
    - -
      -
    • get worker(): "thread" | "cluster"
    • -
    • -

      The worker type.

      -
      -

      Returns "thread" | "cluster"

      -
    -
    -

    Methods

    -
    - -
      - -
    • -

      Adds a task function to this pool. +

      Returns "fixed" | "dynamic"

    • get utilization(): number
    • The approximate pool utilization.

      +

      Returns number

      The pool utilization.

      +
    • get worker(): "thread" | "cluster"
    • The worker type.

      +

      Returns "thread" | "cluster"

    Methods

    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Deregisters a listener callback on the worker given its worker node key.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        Message

      -
      -

      Parameters

      -
        -
      • -
        workerNodeKey: number
        -

        The worker node key.

        -
        -
      • -
      • -
        listener: ((message) => void)
        -

        The message listener callback.

        -
        -
        -
          -
        • -
            -
          • (message): void
          • -
          • -
            -

            Parameters

            -
            -

            Returns void

      -

      Returns void

      -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Enables/disables the worker node tasks queue in this pool.

      -
      -
      -

      Parameters

      -
        -
      • -
        enable: boolean
        -

        Whether to enable or disable the worker node tasks queue.

        -
        -
      • -
      • -
        Optional tasksQueueOptions: TasksQueueOptions
        -

        The worker node tasks queue options.

        -
        -
      -

      Returns void

      -
    -
    - -
      - -
    • -

      Executes the specified function in the worker constructor with the task data input parameter.

      -
      -
      -

      Parameters

      -
        -
      • -
        Optional data: Data
        -

        The optional task input data for the specified task function. This can only be structured-cloneable data.

        -
        -
      • -
      • -
        Optional name: string
        -

        The optional name of the task function to execute. If not specified, the default task function will be executed.

        -
        -
      • -
      • -
        Optional transferList: TransferListItem[]
        -

        An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the pool's worker_threads worker and they should not be used in the main thread afterwards.

        -
        -
      -

      Returns Promise<Response>

      Promise that will be fulfilled when the task is completed.

      - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Whether the specified task function exists in this pool.

      -
      -
      -

      Parameters

      -
        -
      • -
        name: string
        -

        The name of the task function.

        -
        -
      -

      Returns boolean

      true if the task function exists, false otherwise.

      - -
    -
    - -
      - -
    • Internal -

      Whether the worker node has back pressure (i.e. its tasks queue is full).

      -
      -
      -

      Parameters

      -
        -
      • -
        workerNodeKey: number
        -

        The worker node key.

        -
        -
      -

      Returns boolean

      true if the worker node has back pressure, false otherwise.

      - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Registers once a listener callback on the worker given its worker node key.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        Message

      -
      -

      Parameters

      -
        -
      • -
        workerNodeKey: number
        -

        The worker node key.

        -
        -
      • -
      • -
        listener: ((message) => void)
        -

        The message listener callback.

        -
        -
        -
          -
        • -
            -
          • (message): void
          • -
          • -
            -

            Parameters

            -
            -

            Returns void

      -

      Returns void

      -
    -
    - -
      - -
    • -

      Registers a listener callback on the worker given its worker node key.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        Message

      -
      -

      Parameters

      -
        -
      • -
        workerNodeKey: number
        -

        The worker node key.

        -
        -
      • -
      • -
        listener: ((message) => void)
        -

        The message listener callback.

        -
        -
        -
          -
        • -
            -
          • (message): void
          • -
          • -
            -

            Parameters

            -
            -

            Returns void

      -

      Returns void

      -
    -
    - -
      - -
    • -

      Removes a task function from this pool.

      -
      -
      -

      Parameters

      -
        -
      • -
        name: string
        -

        The name of the task function.

        -
        -
      -

      Returns Promise<boolean>

      true if the task function was removed, false otherwise.

      - -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Sends a message to worker given its worker node key.

      -
      -
      -

      Parameters

      -
        -
      • -
        workerNodeKey: number
        -

        The worker node key.

        -
        -
      • -
      • -
        message: MessageValue<Data, unknown>
        -

        The message.

        -
        -
      • -
      • -
        Optional transferList: TransferListItem[]
        -

        The optional array of transferable objects.

        -
        -
      -

      Returns void

      -
    -
    - -
      - -
    • -

      Sets the default task function in this pool.

      -
      -
      -

      Parameters

      -
        -
      • -
        name: string
        -

        The name of the task function.

        -
        -
      -

      Returns Promise<boolean>

      true if the default task function was set, false otherwise.

      - -
    -
    - -
    -
    - -
      - -
    • -

      Sets the worker choice strategy in this pool.

      -
      -
      -

      Parameters

      -
        -
      • -
        workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
        -

        The worker choice strategy.

        -
        -
      • -
      • -
        Optional workerChoiceStrategyOptions: WorkerChoiceStrategyOptions
        -

        The worker choice strategy options.

        -
        -
      -

      Returns void

      -
    -
    - -
    -
    - -
    • Deregisters a listener callback on the worker given its worker node key.

      +

      Type Parameters

      • Message

      Parameters

      • workerNodeKey: number

        The worker node key.

        +
      • listener: ((message) => void)

        The message listener callback.

        +
          • (message): void
          • Parameters

            Returns void

      Returns void

    • Executes the specified function in the worker constructor with the task data input parameter.

      +

      Parameters

      • Optional data: Data

        The optional task input data for the specified task function. This can only be structured-cloneable data.

        +
      • Optional name: string

        The optional name of the task function to execute. If not specified, the default task function will be executed.

        +
      • Optional transferList: TransferListItem[]

        An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the pool's worker_threads worker and they should not be used in the main thread afterwards.

        +

      Returns Promise<Response>

      Promise that will be fulfilled when the task is completed.

      +
    • Internal

      Whether the worker node has back pressure (i.e. its tasks queue is full).

      +

      Parameters

      • workerNodeKey: number

        The worker node key.

        +

      Returns boolean

      true if the worker node has back pressure, false otherwise.

      +
    • Registers once a listener callback on the worker given its worker node key.

      +

      Type Parameters

      • Message

      Parameters

      • workerNodeKey: number

        The worker node key.

        +
      • listener: ((message) => void)

        The message listener callback.

        +
          • (message): void
          • Parameters

            Returns void

      Returns void

    • Registers a listener callback on the worker given its worker node key.

      +

      Type Parameters

      • Message

      Parameters

      • workerNodeKey: number

        The worker node key.

        +
      • listener: ((message) => void)

        The message listener callback.

        +
          • (message): void
          • Parameters

            Returns void

      Returns void

    • Sends a message to worker given its worker node key.

      +

      Parameters

      • workerNodeKey: number

        The worker node key.

        +
      • message: MessageValue<Data, unknown>

        The message.

        +
      • Optional transferList: TransferListItem[]

        The optional array of transferable objects.

        +

      Returns void

    • Sets the worker choice strategy in this pool.

      +

      Parameters

      • workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

        The worker choice strategy.

        +
      • Optional workerChoiceStrategyOptions: WorkerChoiceStrategyOptions

        The worker choice strategy options.

        +

      Returns void

    -
    - -
    -
    - -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Returns void

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/FixedClusterPool.html b/docs/classes/FixedClusterPool.html index f9dfcb39..94cd7c40 100644 --- a/docs/classes/FixedClusterPool.html +++ b/docs/classes/FixedClusterPool.html @@ -1,63 +1,10 @@ -FixedClusterPool | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Class FixedClusterPool<Data, Response>

    -
    -

    A cluster pool with a fixed number of workers.

    -
    -
    -

    Author

    Christopher Quadflieg

    - +FixedClusterPool | poolifier - v3.0.5

    Class FixedClusterPool<Data, Response>

    A cluster pool with a fixed number of workers.

    +

    Author

    Christopher Quadflieg

    Since

    2.0.0

    -
    -
    -

    Type Parameters

    -
      -
    • -

      Data = unknown

      -

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

      -
      -
    • -
    • -

      Response = unknown

      -

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

      -
      -
    -
    -

    Hierarchy

    -
    -
    -
    -
    - -
    -
    -

    Constructors

    -
    -
    -

    Properties

    -

    Type Parameters

    • Data = unknown

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

      +
    • Response = unknown

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

      +

    Hierarchy

    -
    -

    Constructors

    -
    - -
      - -
    • -

      Constructs a new poolifier fixed cluster pool.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        Data = unknown

      • -
      • -

        Response = unknown

      -
      -

      Parameters

      -
        -
      • -
        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?: EventEmitterAsyncResource
    -

    Event emitter integrated with async resource on which events can be listened to. +

    Constructors

    • Constructs a new poolifier fixed cluster pool.

      +

      Type Parameters

      • Data = unknown

      • Response = unknown

      Parameters

      • 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?: EventEmitterAsyncResource

    Event emitter integrated with async resource on which events can be listened to. The async tracking tooling identifier is poolifier:<PoolType>-<WorkerType>-pool.

    Events that can currently be listened to:

      @@ -170,981 +70,109 @@ The async tracking tooling identifier is poolifier:<PoolType>-<Wo
    • 'taskError': Emitted when an error occurs while executing a task.
    • 'backPressure': Emitted when all worker nodes have back pressure (i.e. their tasks queue is full: queue size >= maximum queue size).
    -
    -
    -
    - -
    filePath: string
    -

    Path to the worker file.

    -
    -
    -
    - -
    max?: number
    -

    Dynamic pool maximum size property placeholder.

    -
    -
    -
    - -
    numberOfWorkers: number
    -

    Number of workers that this pool should manage.

    -
    -
    -
    - - -

    Options for this fixed cluster pool.

    -
    -
    -
    - -
    promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...
    -

    The task execution response promise map:

    +
    filePath: string

    Path to the worker file.

    +
    max?: number

    Dynamic pool maximum size property placeholder.

    +
    numberOfWorkers: number

    Number of workers that this pool should manage.

    +

    Options for this fixed cluster pool.

    +
    promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...

    The task 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: IWorkerNode<Worker, Data>[] = []
    -

    Pool worker nodes.

    -
    -
    -
    -

    Accessors

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

    Worker choice strategy context referencing a worker choice algorithm implementation.

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

    Pool worker nodes.

    +

    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 maxSize(): number
    • -
    • -

      The pool maximum size.

      -
      -

      Returns number

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

      The pool minimum size.

      -
      -

      Returns number

      -
    -
    - -
      -
    • get ready(): boolean
    • -
    • -

      The pool readiness boolean status.

      -
      -

      Returns boolean

      -
    -
    - -
    • get type(): "fixed" | "dynamic"
    • The pool type.

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

      -
      -

      Returns "fixed" | "dynamic"

      -
    -
    - -
      -
    • get utilization(): number
    • -
    • -

      The approximate pool utilization.

      -
      -

      Returns number

      The pool utilization.

      - -
    -
    - -
      -
    • get worker(): "thread" | "cluster"
    • -
    • -

      The worker type.

      -
      -

      Returns "thread" | "cluster"

      -
    -
    -

    Methods

    -
    - -
      - -
    • -

      Adds a task function to this pool. +

      Returns "fixed" | "dynamic"

    • get utilization(): number
    • The approximate pool utilization.

      +

      Returns number

      The pool utilization.

      +
    • get worker(): "thread" | "cluster"
    • The worker type.

      +

      Returns "thread" | "cluster"

    Methods

    -
    - -
    -
    - -
    • Method hooked up after a worker node has been newly created. Can be overridden.

      -
      -
      -

      Parameters

      -
        -
      • -
        workerNodeKey: number
        -

        The newly created worker node key.

        -
        -
      -

      Returns void

      -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Deregisters a listener callback on the worker given its worker node key.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        Message

      -
      -

      Parameters

      -
        -
      • -
        workerNodeKey: number
        -

        The worker node key.

        -
        -
      • -
      • -
        listener: ((message) => void)
        -

        The message listener callback.

        -
        -
        -
          -
        • -
            -
          • (message): void
          • -
          • -
            -

            Parameters

            -
            -

            Returns void

      -

      Returns void

      -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Enables/disables the worker node tasks queue in this pool.

      -
      -
      -

      Parameters

      -
        -
      • -
        enable: boolean
        -

        Whether to enable or disable the worker node tasks queue.

        -
        -
      • -
      • -
        Optional tasksQueueOptions: TasksQueueOptions
        -

        The worker node tasks queue options.

        -
        -
      -

      Returns void

      -
    -
    - -
      - -
    • -

      Executes the specified function in the worker constructor with the task data input parameter.

      -
      -
      -

      Parameters

      -
        -
      • -
        Optional data: Data
        -

        The optional task input data for the specified task function. This can only be structured-cloneable data.

        -
        -
      • -
      • -
        Optional name: string
        -

        The optional name of the task function to execute. If not specified, the default task function will be executed.

        -
        -
      • -
      • -
        Optional transferList: TransferListItem[]
        -

        An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the pool's worker_threads worker and they should not be used in the main thread afterwards.

        -
        -
      -

      Returns Promise<Response>

      Promise that will be fulfilled when the task is completed.

      - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Whether the specified task function exists in this pool.

      -
      -
      -

      Parameters

      -
        -
      • -
        name: string
        -

        The name of the task function.

        -
        -
      -

      Returns boolean

      true if the task function exists, false otherwise.

      - -
    -
    - -
      - -
    • Internal -

      Whether the worker node has back pressure (i.e. its tasks queue is full).

      -
      -
      -

      Parameters

      -
        -
      • -
        workerNodeKey: number
        -

        The worker node key.

        -
        -
      -

      Returns boolean

      true if the worker node has back pressure, false otherwise.

      - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Registers once a listener callback on the worker given its worker node key.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        Message

      -
      -

      Parameters

      -
        -
      • -
        workerNodeKey: number
        -

        The worker node key.

        -
        -
      • -
      • -
        listener: ((message) => void)
        -

        The message listener callback.

        -
        -
        -
          -
        • -
            -
          • (message): void
          • -
          • -
            -

            Parameters

            -
            -

            Returns void

      -

      Returns void

      -
    -
    - -
      - -
    • -

      Registers a listener callback on the worker given its worker node key.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        Message

      -
      -

      Parameters

      -
        -
      • -
        workerNodeKey: number
        -

        The worker node key.

        -
        -
      • -
      • -
        listener: ((message) => void)
        -

        The message listener callback.

        -
        -
        -
          -
        • -
            -
          • (message): void
          • -
          • -
            -

            Parameters

            -
            -

            Returns void

      -

      Returns void

      -
    -
    - -
      - -
    • -

      Removes a task function from this pool.

      -
      -
      -

      Parameters

      -
        -
      • -
        name: string
        -

        The name of the task function.

        -
        -
      -

      Returns Promise<boolean>

      true if the task function was removed, false otherwise.

      - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Sets the default task function in this pool.

      -
      -
      -

      Parameters

      -
        -
      • -
        name: string
        -

        The name of the task function.

        -
        -
      -

      Returns Promise<boolean>

      true if the default task function was set, false otherwise.

      - -
    -
    - -
    -
    - -
      - -
    • -

      Sets the worker choice strategy in this pool.

      -
      -
      -

      Parameters

      -
        -
      • -
        workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
        -

        The worker choice strategy.

        -
        -
      • -
      • -
        Optional workerChoiceStrategyOptions: WorkerChoiceStrategyOptions
        -

        The worker choice strategy options.

        -
        -
      -

      Returns void

      -
    -
    - -
    -
    - -
    • Deregisters a listener callback on the worker given its worker node key.

      +

      Type Parameters

      • Message

      Parameters

      • workerNodeKey: number

        The worker node key.

        +
      • listener: ((message) => void)

        The message listener callback.

        +
          • (message): void
          • Parameters

            Returns void

      Returns void

    • Executes the specified function in the worker constructor with the task data input parameter.

      +

      Parameters

      • Optional data: Data

        The optional task input data for the specified task function. This can only be structured-cloneable data.

        +
      • Optional name: string

        The optional name of the task function to execute. If not specified, the default task function will be executed.

        +
      • Optional transferList: TransferListItem[]

        An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the pool's worker_threads worker and they should not be used in the main thread afterwards.

        +

      Returns Promise<Response>

      Promise that will be fulfilled when the task is completed.

      +
    • Whether the specified task function exists in this pool.

      +

      Parameters

      • name: string

        The name of the task function.

        +

      Returns boolean

      true if the task function exists, false otherwise.

      +
    • Internal

      Whether the worker node has back pressure (i.e. its tasks queue is full).

      +

      Parameters

      • workerNodeKey: number

        The worker node key.

        +

      Returns boolean

      true if the worker node has back pressure, false otherwise.

      +
    • Registers once a listener callback on the worker given its worker node key.

      +

      Type Parameters

      • Message

      Parameters

      • workerNodeKey: number

        The worker node key.

        +
      • listener: ((message) => void)

        The message listener callback.

        +
          • (message): void
          • Parameters

            Returns void

      Returns void

    • Registers a listener callback on the worker given its worker node key.

      +

      Type Parameters

      • Message

      Parameters

      • workerNodeKey: number

        The worker node key.

        +
      • listener: ((message) => void)

        The message listener callback.

        +
          • (message): void
          • Parameters

            Returns void

      Returns void

    • Removes a task function from this pool.

      +

      Parameters

      • name: string

        The name of the task function.

        +

      Returns Promise<boolean>

      true if the task function was removed, false otherwise.

      +
    • Sets the default task function in this pool.

      +

      Parameters

      • name: string

        The name of the task function.

        +

      Returns Promise<boolean>

      true if the default task function was set, false otherwise.

      +
    • Sets the worker choice strategy in this pool.

      +

      Parameters

      • workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

        The worker choice strategy.

        +
      • Optional workerChoiceStrategyOptions: WorkerChoiceStrategyOptions

        The worker choice strategy options.

        +

      Returns void

    -
    - -
    -
    - -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Returns void

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/FixedThreadPool.html b/docs/classes/FixedThreadPool.html index ced5f58c..00b5e713 100644 --- a/docs/classes/FixedThreadPool.html +++ b/docs/classes/FixedThreadPool.html @@ -1,63 +1,10 @@ -FixedThreadPool | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Class FixedThreadPool<Data, Response>

    -
    -

    A thread pool with a fixed number of threads.

    -
    -
    -

    Author

    Alessandro Pio Ardizio

    - +FixedThreadPool | poolifier - v3.0.5

    Class FixedThreadPool<Data, Response>

    A thread pool with a fixed number of threads.

    +

    Author

    Alessandro Pio Ardizio

    Since

    0.0.1

    -
    -
    -

    Type Parameters

    -
      -
    • -

      Data = unknown

      -

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

      -
      -
    • -
    • -

      Response = unknown

      -

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

      -
      -
    -
    -

    Hierarchy

    -
    -
    -
    -
    - -
    -
    -

    Constructors

    -
    -
    -

    Properties

    -

    Type Parameters

    • Data = unknown

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

      +
    • Response = unknown

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

      +

    Hierarchy

    -
    -

    Constructors

    -
    - -
      - -
    • -

      Constructs a new poolifier fixed thread pool.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        Data = unknown

      • -
      • -

        Response = unknown

      -
      -

      Parameters

      -
        -
      • -
        numberOfThreads: number
        -

        Number of threads for this pool.

        -
        -
      • -
      • -
        filePath: string
        -

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

        -
        -
      • -
      • -
        opts: ThreadPoolOptions = {}
        -

        Options for this fixed thread pool.

        -
        -
      -

      Returns FixedThreadPool<Data, Response>

      -
    -
    -

    Properties

    -
    - -
    emitter?: EventEmitterAsyncResource
    -

    Event emitter integrated with async resource on which events can be listened to. +

    Constructors

    • Constructs a new poolifier fixed thread pool.

      +

      Type Parameters

      • Data = unknown

      • Response = unknown

      Parameters

      • numberOfThreads: number

        Number of threads for this pool.

        +
      • filePath: string

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

        +
      • opts: ThreadPoolOptions = {}

        Options for this fixed thread pool.

        +

      Returns FixedThreadPool<Data, Response>

    Properties

    emitter?: EventEmitterAsyncResource

    Event emitter integrated with async resource on which events can be listened to. The async tracking tooling identifier is poolifier:<PoolType>-<WorkerType>-pool.

    Events that can currently be listened to:

      @@ -170,986 +70,110 @@ The async tracking tooling identifier is poolifier:<PoolType>-<Wo
    • 'taskError': Emitted when an error occurs while executing a task.
    • 'backPressure': Emitted when all worker nodes have back pressure (i.e. their tasks queue is full: queue size >= maximum queue size).
    -
    -
    -
    - -
    filePath: string
    -

    Path to the worker file.

    -
    -
    -
    - -
    max?: number
    -

    Dynamic pool maximum size property placeholder.

    -
    -
    -
    - -
    numberOfWorkers: number
    -

    Number of workers that this pool should manage.

    -
    -
    -
    - - -

    Options for this fixed thread pool.

    -
    -
    -
    - -
    promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...
    -

    The task execution response promise map:

    +
    filePath: string

    Path to the worker file.

    +
    max?: number

    Dynamic pool maximum size property placeholder.

    +
    numberOfWorkers: number

    Number of workers that this pool should manage.

    +

    Options for this fixed thread pool.

    +
    promiseResponseMap: Map<string, PromiseResponseWrapper<Response>> = ...

    The task 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: IWorkerNode<Worker, Data>[] = []
    -

    Pool worker nodes.

    -
    -
    -
    -

    Accessors

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

    Worker choice strategy context referencing a worker choice algorithm implementation.

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

    Pool worker nodes.

    +

    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 maxSize(): number
    • -
    • -

      The pool maximum size.

      -
      -

      Returns number

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

      The pool minimum size.

      -
      -

      Returns number

      -
    -
    - -
      -
    • get ready(): boolean
    • -
    • -

      The pool readiness boolean status.

      -
      -

      Returns boolean

      -
    -
    - -
    • get type(): "fixed" | "dynamic"
    • The pool type.

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

      -
      -

      Returns "fixed" | "dynamic"

      -
    -
    - -
      -
    • get utilization(): number
    • -
    • -

      The approximate pool utilization.

      -
      -

      Returns number

      The pool utilization.

      - -
    -
    - -
      -
    • get worker(): "thread" | "cluster"
    • -
    • -

      The worker type.

      -
      -

      Returns "thread" | "cluster"

      -
    -
    -

    Methods

    -
    - -
      - -
    • -

      Adds a task function to this pool. +

      Returns "fixed" | "dynamic"

    • get utilization(): number
    • The approximate pool utilization.

      +

      Returns number

      The pool utilization.

      +
    • get worker(): "thread" | "cluster"
    • The worker type.

      +

      Returns "thread" | "cluster"

    Methods

    -
    - -
    -
    - -
    • Method hooked up after a worker node has been newly created. Can be overridden.

      -
      -
      -

      Parameters

      -
        -
      • -
        workerNodeKey: number
        -

        The newly created worker node key.

        -
        -
      -

      Returns void

      -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Deregisters a listener callback on the worker given its worker node key.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        Message

      -
      -

      Parameters

      -
        -
      • -
        workerNodeKey: number
        -

        The worker node key.

        -
        -
      • -
      • -
        listener: ((message) => void)
        -

        The message listener callback.

        -
        -
        -
          -
        • -
            -
          • (message): void
          • -
          • -
            -

            Parameters

            -
            -

            Returns void

      -

      Returns void

      -
    -
    - -
    -
    - -
      - -
    • -

      Terminates the worker node given its worker node key.

      -
      -
      -

      Parameters

      -
        -
      • -
        workerNodeKey: number
        -

        The worker node key.

        -
        -
      -

      Returns Promise<void>

      -
    -
    - -
      - -
    • -

      Enables/disables the worker node tasks queue in this pool.

      -
      -
      -

      Parameters

      -
        -
      • -
        enable: boolean
        -

        Whether to enable or disable the worker node tasks queue.

        -
        -
      • -
      • -
        Optional tasksQueueOptions: TasksQueueOptions
        -

        The worker node tasks queue options.

        -
        -
      -

      Returns void

      -
    -
    - -
      - -
    • -

      Executes the specified function in the worker constructor with the task data input parameter.

      -
      -
      -

      Parameters

      -
        -
      • -
        Optional data: Data
        -

        The optional task input data for the specified task function. This can only be structured-cloneable data.

        -
        -
      • -
      • -
        Optional name: string
        -

        The optional name of the task function to execute. If not specified, the default task function will be executed.

        -
        -
      • -
      • -
        Optional transferList: TransferListItem[]
        -

        An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the pool's worker_threads worker and they should not be used in the main thread afterwards.

        -
        -
      -

      Returns Promise<Response>

      Promise that will be fulfilled when the task is completed.

      - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Whether the specified task function exists in this pool.

      -
      -
      -

      Parameters

      -
        -
      • -
        name: string
        -

        The name of the task function.

        -
        -
      -

      Returns boolean

      true if the task function exists, false otherwise.

      - -
    -
    - -
      - -
    • Internal -

      Whether the worker node has back pressure (i.e. its tasks queue is full).

      -
      -
      -

      Parameters

      -
        -
      • -
        workerNodeKey: number
        -

        The worker node key.

        -
        -
      -

      Returns boolean

      true if the worker node has back pressure, false otherwise.

      - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Registers once a listener callback on the worker given its worker node key.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        Message

      -
      -

      Parameters

      -
        -
      • -
        workerNodeKey: number
        -

        The worker node key.

        -
        -
      • -
      • -
        listener: ((message) => void)
        -

        The message listener callback.

        -
        -
        -
          -
        • -
            -
          • (message): void
          • -
          • -
            -

            Parameters

            -
            -

            Returns void

      -

      Returns void

      -
    -
    - -
      - -
    • -

      Registers a listener callback on the worker given its worker node key.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        Message

      -
      -

      Parameters

      -
        -
      • -
        workerNodeKey: number
        -

        The worker node key.

        -
        -
      • -
      • -
        listener: ((message) => void)
        -

        The message listener callback.

        -
        -
        -
          -
        • -
            -
          • (message): void
          • -
          • -
            -

            Parameters

            -
            -

            Returns void

      -

      Returns void

      -
    -
    - -
      - -
    • -

      Removes a task function from this pool.

      -
      -
      -

      Parameters

      -
        -
      • -
        name: string
        -

        The name of the task function.

        -
        -
      -

      Returns Promise<boolean>

      true if the task function was removed, false otherwise.

      - -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Sends a message to worker given its worker node key.

      -
      -
      -

      Parameters

      -
        -
      • -
        workerNodeKey: number
        -

        The worker node key.

        -
        -
      • -
      • -
        message: MessageValue<Data, unknown>
        -

        The message.

        -
        -
      • -
      • -
        Optional transferList: TransferListItem[]
        -

        The optional array of transferable objects.

        -
        -
      -

      Returns void

      -
    -
    - -
      - -
    • -

      Sets the default task function in this pool.

      -
      -
      -

      Parameters

      -
        -
      • -
        name: string
        -

        The name of the task function.

        -
        -
      -

      Returns Promise<boolean>

      true if the default task function was set, false otherwise.

      - -
    -
    - -
    -
    - -
      - -
    • -

      Sets the worker choice strategy in this pool.

      -
      -
      -

      Parameters

      -
        -
      • -
        workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
        -

        The worker choice strategy.

        -
        -
      • -
      • -
        Optional workerChoiceStrategyOptions: WorkerChoiceStrategyOptions
        -

        The worker choice strategy options.

        -
        -
      -

      Returns void

      -
    -
    - -
    -
    - -
    • Deregisters a listener callback on the worker given its worker node key.

      +

      Type Parameters

      • Message

      Parameters

      • workerNodeKey: number

        The worker node key.

        +
      • listener: ((message) => void)

        The message listener callback.

        +
          • (message): void
          • Parameters

            Returns void

      Returns void

    • Executes the specified function in the worker constructor with the task data input parameter.

      +

      Parameters

      • Optional data: Data

        The optional task input data for the specified task function. This can only be structured-cloneable data.

        +
      • Optional name: string

        The optional name of the task function to execute. If not specified, the default task function will be executed.

        +
      • Optional transferList: TransferListItem[]

        An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the pool's worker_threads worker and they should not be used in the main thread afterwards.

        +

      Returns Promise<Response>

      Promise that will be fulfilled when the task is completed.

      +
    • Whether the specified task function exists in this pool.

      +

      Parameters

      • name: string

        The name of the task function.

        +

      Returns boolean

      true if the task function exists, false otherwise.

      +
    • Internal

      Whether the worker node has back pressure (i.e. its tasks queue is full).

      +

      Parameters

      • workerNodeKey: number

        The worker node key.

        +

      Returns boolean

      true if the worker node has back pressure, false otherwise.

      +
    • Registers once a listener callback on the worker given its worker node key.

      +

      Type Parameters

      • Message

      Parameters

      • workerNodeKey: number

        The worker node key.

        +
      • listener: ((message) => void)

        The message listener callback.

        +
          • (message): void
          • Parameters

            Returns void

      Returns void

    • Registers a listener callback on the worker given its worker node key.

      +

      Type Parameters

      • Message

      Parameters

      • workerNodeKey: number

        The worker node key.

        +
      • listener: ((message) => void)

        The message listener callback.

        +
          • (message): void
          • Parameters

            Returns void

      Returns void

    • Removes a task function from this pool.

      +

      Parameters

      • name: string

        The name of the task function.

        +

      Returns Promise<boolean>

      true if the task function was removed, false otherwise.

      +
    • Sends a message to worker given its worker node key.

      +

      Parameters

      • workerNodeKey: number

        The worker node key.

        +
      • message: MessageValue<Data, unknown>

        The message.

        +
      • Optional transferList: TransferListItem[]

        The optional array of transferable objects.

        +

      Returns void

    • Sets the default task function in this pool.

      +

      Parameters

      • name: string

        The name of the task function.

        +

      Returns Promise<boolean>

      true if the default task function was set, false otherwise.

      +
    • Sets the worker choice strategy in this pool.

      +

      Parameters

      • workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

        The worker choice strategy.

        +
      • Optional workerChoiceStrategyOptions: WorkerChoiceStrategyOptions

        The worker choice strategy options.

        +

      Returns void

    -
    - -
    -
    - -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Returns void

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/Node.html b/docs/classes/Node.html index a29aec77..ef9ba4aa 100644 --- a/docs/classes/Node.html +++ b/docs/classes/Node.html @@ -1,138 +1,7 @@ -Node | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Class Node<T>Internal

    -
    -

    Node.

    -
    -
    -
    -

    Type Parameters

    -
      -
    • -

      T

      -

      Type of node data.

      -
      -
    -
    -

    Hierarchy

    -
      -
    • Node
    -
    -
    -
    - -
    -
    -

    Constructors

    -
    -
    -

    Properties

    -
    data +Node | poolifier - v3.0.5

    Class Node<T>Internal

    Node.

    +

    Type Parameters

    • T

      Type of node data.

      +

    Hierarchy

    • Node

    Constructors

    Properties

    -
    -

    Constructors

    -
    - -
      - -
    • -
      -

      Type Parameters

      -
        -
      • -

        T

      -
      -

      Parameters

      -
        -
      • -
        data: T
      -

      Returns Node<T>

    -
    -

    Properties

    -
    - -
    data: T
    -
    - -
    next?: Node<T>
    -
    - -
    prev?: Node<T>
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Constructors

    Properties

    data: T
    next?: Node<T>
    prev?: Node<T>

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/ThreadWorker.html b/docs/classes/ThreadWorker.html index 8c17923e..767e8744 100644 --- a/docs/classes/ThreadWorker.html +++ b/docs/classes/ThreadWorker.html @@ -1,79 +1,22 @@ -ThreadWorker | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Class ThreadWorker<Data, Response>

    -
    -

    A thread worker used by a poolifier ThreadPool.

    +ThreadWorker | poolifier - v3.0.5

    Class ThreadWorker<Data, Response>

    A thread worker used by a poolifier ThreadPool.

    When this worker is inactive for more than the given maxInactiveTime, it will send a termination request to its main thread.

    If you use a DynamicThreadPool the extra workers that were created will be terminated, but the minimum number of workers will be guaranteed.

    -
    -

    Author

    Alessandro Pio Ardizio

    Since

    0.0.1

    -
    -
    -

    Type Parameters

    -
      -
    • -

      Data = unknown

      -

      Type of data this worker receives from pool's execution. This can only be structured-cloneable data.

      -
      -
    • -
    • -

      Response = unknown

      -

      Type of response the worker sends back to the main thread. This can only be structured-cloneable data.

      -
      -
    -
    -

    Hierarchy

    -
    -
    -
    -
    - -
    -
    -

    Constructors

    -
    -
    -

    Properties

    -

    Type Parameters

    • Data = unknown

      Type of data this worker receives from pool's execution. This can only be structured-cloneable data.

      +
    • Response = unknown

      Type of response the worker sends back to the main thread. This can only be structured-cloneable data.

      +

    Hierarchy

    Constructors

    Properties

    -
    -

    Accessors

    -
    id -
    -
    -

    Methods

    -

    Accessors

    id +

    Methods

    addTaskFunction asyncId bind emitDestroy @@ -95,664 +38,75 @@ but the minimum number of workers will be guaranteed.

    setDefaultTaskFunction triggerAsyncId bind -
    -
    -

    Constructors

    -
    - -
    -
    -

    Properties

    -
    - -
    activeInterval?: Timeout
    -

    Handler id of the activeInterval worker activity check.

    -
    -
    -
    - -
    isMain: boolean
    -

    Whether this is the main worker or not.

    -
    -
    -
    - -
    lastTaskTimestamp: number
    -

    Timestamp of the last task processed by this worker.

    -
    -
    -
    - -
    opts: WorkerOptions = DEFAULT_WORKER_OPTIONS
    -

    Options for the worker.

    -
    -
    -
    - -
    port: MessagePort
    -

    Message port used to communicate with the main worker.

    -
    -
    -
    - -
    statistics: WorkerStatistics
    -

    Performance statistics computation requirements.

    -
    -
    -
    - -
    taskFunctions: Map<string, TaskFunction<Data, Response>>
    -

    Task function(s) processed by the worker when the pool's execution function is invoked.

    -
    -
    -
    -

    Accessors

    -
    - -
    -
    -

    Methods

    -
    - -

    Constructors

    Properties

    activeInterval?: Timeout

    Handler id of the activeInterval worker activity check.

    +
    isMain: boolean

    Whether this is the main worker or not.

    +
    lastTaskTimestamp: number

    Timestamp of the last task processed by this worker.

    +
    opts: WorkerOptions = DEFAULT_WORKER_OPTIONS

    Options for the worker.

    +
    port: MessagePort

    Message port used to communicate with the main worker.

    +
    statistics: WorkerStatistics

    Performance statistics computation requirements.

    +
    taskFunctions: Map<string, TaskFunction<Data, Response>>

    Task function(s) processed by the worker when the pool's execution function is invoked.

    +

    Accessors

    Methods

    -
    - -
      - -
    • -

      Returns number

      The unique asyncId assigned to the resource.

      - -
    -
    - -
      - -
    • -

      Binds the given function to execute to this AsyncResource's scope.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        Func extends ((...args) => any)

      -
      -

      Parameters

      -
        -
      • -
        fn: Func
        -

        The function to bind to the current AsyncResource.

        -
        -
      -

      Returns Func

      -
      -

      Since

      v14.8.0, v12.19.0

      -
    -
    - -
    • Returns number

      The unique asyncId assigned to the resource.

      +
    • Binds the given function to execute to this AsyncResource's scope.

      +

      Type Parameters

      • Func extends ((...args) => any)

      Parameters

      • fn: Func

        The function to bind to the current AsyncResource.

        +

      Returns Func

      Since

      v14.8.0, v12.19.0

      +
    • Call all destroy hooks. This should only ever be called once. An error will be thrown if it is called more than once. This must be manually called. If the resource is left to be collected by the GC then the destroy hooks will never be called.

      -
      -

      Returns ThreadWorker<Data, Response>

      A reference to asyncResource.

      - -
    -
    - -
    -
    - -
      - -
    • -

      Handles an error and convert it to a string so it can be sent back to the main worker.

      -
      -
      -

      Parameters

      -
        -
      • -
        error: string | Error
        -

        The error raised by the worker.

        -
        -
      -

      Returns string

      The error message.

      - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Call the provided function with the provided arguments in the execution context +

      Returns ThreadWorker<Data, Response>

      A reference to asyncResource.

      +
    • Handles an error and convert it to a string so it can be sent back to the main worker.

      +

      Parameters

      • error: string | Error

        The error raised by the worker.

        +

      Returns string

      The error message.

      +
    • Call the provided function with the provided arguments in the execution context of the async resource. This will establish the context, trigger the AsyncHooks before callbacks, call the function, trigger the AsyncHooks after callbacks, and then restore the original execution context.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        This

      • -
      • -

        Result

      -
      -

      Parameters

      -
        -
      • -
        fn: ((this, ...args) => Result)
        -

        The function to call in the execution context of this async resource.

        -
        -
        -
          -
        • -
            -
          • (this, ...args): Result
          • -
          • -
            -

            Parameters

            -
              -
            • -
              this: This
            • -
            • -
              Rest ...args: any[]
            -

            Returns Result

      • -
      • -
        Optional thisArg: This
        -

        The receiver to be used for the function call.

        -
        -
      • -
      • -
        Rest ...args: any[]
        -

        Optional arguments to pass to the function.

        -
        -
      -

      Returns Result

      -
      -

      Since

      v9.6.0

      -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Returns number

      The same triggerAsyncId that is passed to the AsyncResource constructor.

      - -
    -
    - -
      - -
    • -

      Binds the given function to the current execution context.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        Func extends ((this, ...args) => any)

      • -
      • -

        ThisArg

      -
      -

      Parameters

      -
        -
      • -
        fn: Func
        -

        The function to bind to the current execution context.

        -
        -
      • -
      • -
        Optional type: string
        -

        An optional name to associate with the underlying AsyncResource.

        -
        -
      • -
      • -
        Optional thisArg: ThisArg
      -

      Returns Func

      -
      -

      Since

      v14.8.0, v12.19.0

      -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Type Parameters

    • This

    • Result

    Parameters

    • fn: ((this, ...args) => Result)

      The function to call in the execution context of this async resource.

      +
        • (this, ...args): Result
        • Parameters

          • this: This
          • Rest ...args: any[]

          Returns Result

    • Optional thisArg: This

      The receiver to be used for the function call.

      +
    • Rest ...args: any[]

      Optional arguments to pass to the function.

      +

    Returns Result

    Since

    v9.6.0

    +
    • Returns number

      The same triggerAsyncId that is passed to the AsyncResource constructor.

      +
    • Binds the given function to the current execution context.

      +

      Type Parameters

      • Func extends ((this, ...args) => any)

      • ThisArg

      Parameters

      • fn: Func

        The function to bind to the current execution context.

        +
      • Optional type: string

        An optional name to associate with the underlying AsyncResource.

        +
      • Optional thisArg: ThisArg

      Returns Func

      Since

      v14.8.0, v12.19.0

      +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/WorkerChoiceStrategyContext.html b/docs/classes/WorkerChoiceStrategyContext.html index 08d3f330..63127cba 100644 --- a/docs/classes/WorkerChoiceStrategyContext.html +++ b/docs/classes/WorkerChoiceStrategyContext.html @@ -1,316 +1,40 @@ -WorkerChoiceStrategyContext | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Class WorkerChoiceStrategyContext<Worker, Data, Response>

    -
    -

    The worker choice strategy context.

    -
    -
    -
    -

    Type Parameters

    -
      -
    • -

      Worker extends IWorker

      -

      Type of worker.

      -
      -
    • -
    • -

      Data = unknown

      -

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

      -
      -
    • -
    • -

      Response = unknown

      -

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

      -
      -
    -
    -

    Hierarchy

    -
      -
    • WorkerChoiceStrategyContext
    -
    -
    -
    - -
    -
    -

    Constructors

    -
    -
    -

    Properties

    -
    opts +WorkerChoiceStrategyContext | poolifier - v3.0.5

    Class WorkerChoiceStrategyContext<Worker, Data, Response>

    The worker choice strategy context.

    +

    Type Parameters

    • Worker extends IWorker

      Type of worker.

      +
    • Data = unknown

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

      +
    • Response = unknown

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

      +

    Hierarchy

    • WorkerChoiceStrategyContext
    -
    -

    Constructors

    -
    - -
      - -
    • -

      Worker choice strategy context constructor.

      -
      -
      -

      Type Parameters

      -
        -
      • -

        Worker extends IWorker

      • -
      • -

        Data = unknown

      • -
      • -

        Response = unknown

      -
      -

      Parameters

      -
        -
      • -
        pool: IPool<Worker, Data, Response>
        -

        The pool instance.

        -
        -
      • -
      • -
        workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN" = WorkerChoiceStrategies.ROUND_ROBIN
        -

        The worker choice strategy.

        -
        -
      • -
      • -
        opts: WorkerChoiceStrategyOptions = DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS
        -

        The worker choice strategy options.

        -
        -
      -

      Returns WorkerChoiceStrategyContext<Worker, Data, Response>

      -
    -
    -

    Properties

    -
    - -
    opts: WorkerChoiceStrategyOptions = DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS
    -

    The worker choice strategy options.

    -
    -
    -
    - -
    retriesCount: number = 0
    -

    The number of times the worker choice strategy in the context has been retried.

    -
    -
    -
    - -
    workerChoiceStrategies: Map<"ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN", IWorkerChoiceStrategy>
    -
    - -
    workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN" = WorkerChoiceStrategies.ROUND_ROBIN
    -

    The worker choice strategy.

    -
    -
    -
    -

    Methods

    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
      - -
    • -

      Sets the worker choice strategy to use in the context.

      -
      -
      -

      Parameters

      -
        -
      • -
        workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
        -

        The worker choice strategy to set.

        -
        -
      -

      Returns void

      -
    -
    - -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Constructors

    Properties

    opts: WorkerChoiceStrategyOptions = DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS

    The worker choice strategy options.

    +
    retriesCount: number = 0

    The number of times the worker choice strategy in the context has been retried.

    +
    workerChoiceStrategies: Map<"ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN", IWorkerChoiceStrategy>
    workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN" = WorkerChoiceStrategies.ROUND_ROBIN

    The worker choice strategy.

    +

    Methods

    • Sets the worker choice strategy to use in the context.

      +

      Parameters

      • workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

        The worker choice strategy to set.

        +

      Returns void

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/availableParallelism.html b/docs/functions/availableParallelism.html index f6d9f5b2..1b77e6fc 100644 --- a/docs/functions/availableParallelism.html +++ b/docs/functions/availableParallelism.html @@ -1,72 +1,4 @@ -availableParallelism | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Function availableParallelism

    -
    -

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index ba9ccbb2..3be3dde7 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,23 +1,4 @@ -poolifier - v3.0.5
    -
    - -
    -
    -
    -
    -

    poolifier - v3.0.5

    -
    -
    -

    Index

    -
    -

    Classes

    -
    AbstractPool +poolifier - v3.0.5
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Functions

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/ClusterPoolOptions.html b/docs/interfaces/ClusterPoolOptions.html index 9a0f9290..9e75e390 100644 --- a/docs/interfaces/ClusterPoolOptions.html +++ b/docs/interfaces/ClusterPoolOptions.html @@ -1,40 +1,5 @@ -ClusterPoolOptions | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface ClusterPoolOptions

    -
    -

    Options for a poolifier cluster pool.

    -
    -
    -
    -

    Hierarchy

    -
    -
    -
    -
    - -
    -
    -

    Properties

    -
    enableEvents? +ClusterPoolOptions | poolifier - v3.0.5

    Interface ClusterPoolOptions

    Options for a poolifier cluster pool.

    +

    Hierarchy

    -
    -

    Properties

    -
    - -
    enableEvents?: boolean
    -

    Pool events integrated with async resource emission.

    -
    -
    -

    Default Value

    true
    +

    Properties

    enableEvents?: boolean

    Pool events integrated with async resource emission.

    +

    Default Value

    true
     
    -
    -
    - -
    enableTasksQueue?: boolean
    -

    Pool worker node tasks queue.

    -
    -
    -

    Default Value

    false
    +
    enableTasksQueue?: boolean

    Pool worker node tasks queue.

    +

    Default Value

    false
     
    -
    -
    - -
    env?: Record<string, unknown>
    -

    Key/value pairs to add to worker process environment.

    -
    -
    -
    - -
    errorHandler?: ErrorHandler<Worker>
    -

    A function that will listen for error event on each worker.

    -
    -
    -

    Default Value

    () => {}

    -
    -
    - -
    exitHandler?: ExitHandler<Worker>
    -

    A function that will listen for exit event on each worker.

    -
    -
    -

    Default Value

    () => {}

    -
    -
    - -
    messageHandler?: MessageHandler<Worker>
    -

    A function that will listen for message event on each worker.

    -
    -
    -

    Default Value

    () => {}

    -
    -
    - -
    onlineHandler?: OnlineHandler<Worker>
    -

    A function that will listen for online event on each worker.

    -
    -
    -

    Default Value

    () => {}

    -
    -
    - -
    restartWorkerOnError?: boolean
    -

    Restart worker on error.

    -
    -
    -
    - -
    settings?: ClusterSettings
    -

    Cluster settings.

    -
    -
    -
    - -
    startWorkers?: boolean
    -

    Whether to start the minimum number of workers at pool initialization.

    -
    -
    -

    Default Value

    true
    +
    env?: Record<string, unknown>

    Key/value pairs to add to worker process environment.

    +
    errorHandler?: ErrorHandler<Worker>

    A function that will listen for error event on each worker.

    +

    Default Value

    () => {}

    +
    exitHandler?: ExitHandler<Worker>

    A function that will listen for exit event on each worker.

    +

    Default Value

    () => {}

    +
    messageHandler?: MessageHandler<Worker>

    A function that will listen for message event on each worker.

    +

    Default Value

    () => {}

    +
    onlineHandler?: OnlineHandler<Worker>

    A function that will listen for online event on each worker.

    +

    Default Value

    () => {}

    +
    restartWorkerOnError?: boolean

    Restart worker on error.

    +
    settings?: ClusterSettings

    Cluster settings.

    +
    startWorkers?: boolean

    Whether to start the minimum number of workers at pool initialization.

    +

    Default Value

    true
     
    -
    -
    - -
    tasksQueueOptions?: TasksQueueOptions
    -

    Pool worker node tasks queue options.

    -
    -
    -
    - -
    workerChoiceStrategy?: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
    -

    The worker choice strategy to use in this pool.

    -
    -
    -

    Default Value

    WorkerChoiceStrategies.ROUND_ROBIN
    +
    tasksQueueOptions?: TasksQueueOptions

    Pool worker node tasks queue options.

    +
    workerChoiceStrategy?: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

    The worker choice strategy to use in this pool.

    +

    Default Value

    WorkerChoiceStrategies.ROUND_ROBIN
     
    -
    -
    - -
    workerChoiceStrategyOptions?: WorkerChoiceStrategyOptions
    -

    The worker choice strategy options.

    -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +
    workerChoiceStrategyOptions?: WorkerChoiceStrategyOptions

    The worker choice strategy options.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/EventLoopUtilizationMeasurementStatistics.html b/docs/interfaces/EventLoopUtilizationMeasurementStatistics.html index ea4ba625..f70eb7e0 100644 --- a/docs/interfaces/EventLoopUtilizationMeasurementStatistics.html +++ b/docs/interfaces/EventLoopUtilizationMeasurementStatistics.html @@ -1,105 +1,5 @@ -EventLoopUtilizationMeasurementStatistics | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface EventLoopUtilizationMeasurementStatisticsInternal

    -
    -

    Event loop utilization measurement statistics.

    -
    -
    -
    -

    Hierarchy

    -
      -
    • EventLoopUtilizationMeasurementStatistics
    -
    -
    -
    - -
    -
    -

    Properties

    -
    active +EventLoopUtilizationMeasurementStatistics | poolifier - v3.0.5

    Interface EventLoopUtilizationMeasurementStatisticsInternal

    Event loop utilization measurement statistics.

    +

    Hierarchy

    • EventLoopUtilizationMeasurementStatistics
    -
    -

    Properties

    -
    - -
    -
    - -
    -
    - -
    utilization?: number
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Properties

    utilization?: number

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/IPool.html b/docs/interfaces/IPool.html index bb2465fb..bedcb0c5 100644 --- a/docs/interfaces/IPool.html +++ b/docs/interfaces/IPool.html @@ -1,60 +1,8 @@ -IPool | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface IPool<Worker, Data, Response>

    -
    -

    Contract definition for a poolifier pool.

    -
    -
    -
    -

    Type Parameters

    -
      -
    • -

      Worker extends IWorker

      -

      Type of worker which manages this pool.

      -
      -
    • -
    • -

      Data = unknown

      -

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

      -
      -
    • -
    • -

      Response = unknown

      -

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

      -
      -
    -
    -

    Hierarchy

    -
      -
    • IPool
    -
    -

    Implemented by

    -
    -
    -
    -
    - -
    -
    -

    Properties

    -
    addTaskFunction +IPool | poolifier - v3.0.5

    Interface IPool<Worker, Data, Response>

    Contract definition for a poolifier pool.

    +

    Type Parameters

    • Worker extends IWorker

      Type of worker which manages this pool.

      +
    • Data = unknown

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

      +
    • Response = unknown

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

      +

    Hierarchy

    • IPool

    Implemented by

    -
    -

    Properties

    -
    - -
    addTaskFunction: ((name, fn) => Promise<boolean>)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (name, fn): Promise<boolean>
      • -
      • -

        Adds a task function to this pool. +

    Properties

    addTaskFunction: ((name, fn) => Promise<boolean>)

    Type declaration

      • (name, fn): Promise<boolean>
      • Adds a task function to this pool. If a task function with the same name already exists, it will be overwritten.

        -
        -
        -

        Parameters

        -
          -
        • -
          name: string
          -

          The name of the task function.

          -
          -
        • -
        • -
          fn: TaskFunction<Data, Response>
          -

          The task function.

          -
          -
        -

        Returns Promise<boolean>

        true if the task function was added, false otherwise.

        - -
        -

        Throws

        https://nodejs.org/api/errors.html#class-typeerror If the name parameter is not a string or an empty string.

        - +

        Parameters

        • name: string

          The name of the task function.

          +
        • fn: TaskFunction<Data, Response>

          The task function.

          +

        Returns Promise<boolean>

        true if the task function was added, false otherwise.

        +

        Throws

        https://nodejs.org/api/errors.html#class-typeerror If the name parameter is not a string or an empty string.

        Throws

        https://nodejs.org/api/errors.html#class-typeerror If the fn parameter is not a function.

        -
    -
    - -
    destroy: (() => Promise<void>)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (): Promise<void>
      • -
      • -

        Terminates all workers in this pool.

        -
        -

        Returns Promise<void>

        -
    -
    - -
    emitter?: EventEmitterAsyncResource
    -

    Event emitter integrated with async resource on which events can be listened to. +

    destroy: (() => Promise<void>)

    Type declaration

      • (): Promise<void>
      • Terminates all workers in this pool.

        +

        Returns Promise<void>

    emitter?: EventEmitterAsyncResource

    Event emitter integrated with async resource on which events can be listened to. The async tracking tooling identifier is poolifier:<PoolType>-<WorkerType>-pool.

    Events that can currently be listened to:

      @@ -139,360 +38,36 @@ The async tracking tooling identifier is poolifier:<PoolType>-<Wo
    • 'taskError': Emitted when an error occurs while executing a task.
    • 'backPressure': Emitted when all worker nodes have back pressure (i.e. their tasks queue is full: queue size >= maximum queue size).
    -
    -
    -
    - -
    enableTasksQueue: ((enable, tasksQueueOptions?) => void)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (enable, tasksQueueOptions?): void
      • -
      • -

        Enables/disables the worker node tasks queue in this pool.

        -
        -
        -

        Parameters

        -
          -
        • -
          enable: boolean
          -

          Whether to enable or disable the worker node tasks queue.

          -
          -
        • -
        • -
          Optional tasksQueueOptions: TasksQueueOptions
          -

          The worker node tasks queue options.

          -
          -
        -

        Returns void

        -
    -
    - -
    execute: ((data?, name?, transferList?) => Promise<Response>)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (data?, name?, transferList?): Promise<Response>
      • -
      • -

        Executes the specified function in the worker constructor with the task data input parameter.

        -
        -
        -

        Parameters

        -
          -
        • -
          Optional data: Data
          -

          The optional task input data for the specified task function. This can only be structured-cloneable data.

          -
          -
        • -
        • -
          Optional name: string
          -

          The optional name of the task function to execute. If not specified, the default task function will be executed.

          -
          -
        • -
        • -
          Optional transferList: TransferListItem[]
          -

          An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the pool's worker_threads worker and they should not be used in the main thread afterwards.

          -
          -
        -

        Returns Promise<Response>

        Promise that will be fulfilled when the task is completed.

        - -
    -
    - -
    hasTaskFunction: ((name) => boolean)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (name): boolean
      • -
      • -

        Whether the specified task function exists in this pool.

        -
        -
        -

        Parameters

        -
          -
        • -
          name: string
          -

          The name of the task function.

          -
          -
        -

        Returns boolean

        true if the task function exists, false otherwise.

        - -
    -
    - -
    hasWorkerNodeBackPressure: ((workerNodeKey) => boolean)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (workerNodeKey): boolean
      • -
      • Internal -

        Whether the worker node has back pressure (i.e. its tasks queue is full).

        -
        -
        -

        Parameters

        -
          -
        • -
          workerNodeKey: number
          -

          The worker node key.

          -
          -
        -

        Returns boolean

        true if the worker node has back pressure, false otherwise.

        - -
    -
    - -
    info: PoolInfo
    -

    Pool information.

    -
    -
    -
    - -
    listTaskFunctionNames: (() => string[])
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (): string[]
      • -
      • -

        Lists the names of task function available in this pool.

        -
        -

        Returns string[]

        The names of task function available in this pool.

        - -
    -
    - -
    removeTaskFunction: ((name) => Promise<boolean>)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (name): Promise<boolean>
      • -
      • -

        Removes a task function from this pool.

        -
        -
        -

        Parameters

        -
          -
        • -
          name: string
          -

          The name of the task function.

          -
          -
        -

        Returns Promise<boolean>

        true if the task function was removed, false otherwise.

        - -
    -
    - -
    setDefaultTaskFunction: ((name) => Promise<boolean>)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (name): Promise<boolean>
      • -
      • -

        Sets the default task function in this pool.

        -
        -
        -

        Parameters

        -
          -
        • -
          name: string
          -

          The name of the task function.

          -
          -
        -

        Returns Promise<boolean>

        true if the default task function was set, false otherwise.

        - -
    -
    - -
    setTasksQueueOptions: ((tasksQueueOptions) => void)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (tasksQueueOptions): void
      • -
      • -

        Sets the worker node tasks queue options in this pool.

        -
        -
        -

        Parameters

        -
        -

        Returns void

        -
    -
    - -
    setWorkerChoiceStrategy: ((workerChoiceStrategy, workerChoiceStrategyOptions?) => void)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (workerChoiceStrategy, workerChoiceStrategyOptions?): void
      • -
      • -

        Sets the worker choice strategy in this pool.

        -
        -
        -

        Parameters

        -
          -
        • -
          workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
          -

          The worker choice strategy.

          -
          -
        • -
        • -
          Optional workerChoiceStrategyOptions: WorkerChoiceStrategyOptions
          -

          The worker choice strategy options.

          -
          -
        -

        Returns void

        -
    -
    - -
    setWorkerChoiceStrategyOptions: ((workerChoiceStrategyOptions) => void)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (workerChoiceStrategyOptions): void
      • -
      • -

        Sets the worker choice strategy options in this pool.

        -
        -
        -

        Parameters

        -
        -

        Returns void

        -
    -
    - -
    start: (() => void)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (): void
      • -
      • -

        Starts the minimum number of workers in this pool.

        -
        -

        Returns void

        -
    -
    - -
    workerNodes: IWorkerNode<Worker, Data>[]
    -

    Pool worker nodes.

    -
    -
    - -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +
    enableTasksQueue: ((enable, tasksQueueOptions?) => void)

    Type declaration

      • (enable, tasksQueueOptions?): void
      • Enables/disables the worker node tasks queue in this pool.

        +

        Parameters

        • enable: boolean

          Whether to enable or disable the worker node tasks queue.

          +
        • Optional tasksQueueOptions: TasksQueueOptions

          The worker node tasks queue options.

          +

        Returns void

    execute: ((data?, name?, transferList?) => Promise<Response>)

    Type declaration

      • (data?, name?, transferList?): Promise<Response>
      • Executes the specified function in the worker constructor with the task data input parameter.

        +

        Parameters

        • Optional data: Data

          The optional task input data for the specified task function. This can only be structured-cloneable data.

          +
        • Optional name: string

          The optional name of the task function to execute. If not specified, the default task function will be executed.

          +
        • Optional transferList: TransferListItem[]

          An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the pool's worker_threads worker and they should not be used in the main thread afterwards.

          +

        Returns Promise<Response>

        Promise that will be fulfilled when the task is completed.

        +
    hasTaskFunction: ((name) => boolean)

    Type declaration

      • (name): boolean
      • Whether the specified task function exists in this pool.

        +

        Parameters

        • name: string

          The name of the task function.

          +

        Returns boolean

        true if the task function exists, false otherwise.

        +
    hasWorkerNodeBackPressure: ((workerNodeKey) => boolean)

    Type declaration

      • (workerNodeKey): boolean
      • Internal

        Whether the worker node has back pressure (i.e. its tasks queue is full).

        +

        Parameters

        • workerNodeKey: number

          The worker node key.

          +

        Returns boolean

        true if the worker node has back pressure, false otherwise.

        +
    info: PoolInfo

    Pool information.

    +
    listTaskFunctionNames: (() => string[])

    Type declaration

      • (): string[]
      • Lists the names of task function available in this pool.

        +

        Returns string[]

        The names of task function available in this pool.

        +
    removeTaskFunction: ((name) => Promise<boolean>)

    Type declaration

      • (name): Promise<boolean>
      • Removes a task function from this pool.

        +

        Parameters

        • name: string

          The name of the task function.

          +

        Returns Promise<boolean>

        true if the task function was removed, false otherwise.

        +
    setDefaultTaskFunction: ((name) => Promise<boolean>)

    Type declaration

      • (name): Promise<boolean>
      • Sets the default task function in this pool.

        +

        Parameters

        • name: string

          The name of the task function.

          +

        Returns Promise<boolean>

        true if the default task function was set, false otherwise.

        +
    setTasksQueueOptions: ((tasksQueueOptions) => void)

    Type declaration

      • (tasksQueueOptions): void
      • Sets the worker node tasks queue options in this pool.

        +

        Parameters

        Returns void

    setWorkerChoiceStrategy: ((workerChoiceStrategy, workerChoiceStrategyOptions?) => void)

    Type declaration

      • (workerChoiceStrategy, workerChoiceStrategyOptions?): void
      • Sets the worker choice strategy in this pool.

        +

        Parameters

        • workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

          The worker choice strategy.

          +
        • Optional workerChoiceStrategyOptions: WorkerChoiceStrategyOptions

          The worker choice strategy options.

          +

        Returns void

    setWorkerChoiceStrategyOptions: ((workerChoiceStrategyOptions) => void)

    Type declaration

      • (workerChoiceStrategyOptions): void
      • Sets the worker choice strategy options in this pool.

        +

        Parameters

        Returns void

    start: (() => void)

    Type declaration

      • (): void
      • Starts the minimum number of workers in this pool.

        +

        Returns void

    workerNodes: IWorkerNode<Worker, Data>[]

    Pool worker nodes.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/IWorker.html b/docs/interfaces/IWorker.html index ee1e4e19..d2ebd02c 100644 --- a/docs/interfaces/IWorker.html +++ b/docs/interfaces/IWorker.html @@ -1,206 +1,13 @@ -IWorker | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface IWorker

    -
    -

    Worker interface.

    -
    -
    -
    -

    Hierarchy

    -
      -
    • IWorker
    -
    -
    -
    - -
    -
    -

    Properties

    -
    id? +IWorker | poolifier - v3.0.5

    Interface IWorker

    Worker interface.

    +

    Hierarchy

    • IWorker

    Properties

    -
    -

    Properties

    -
    - -
    id?: number
    -

    Worker id.

    -
    -
    -
    - -
    on: ((event, handler) => void) & ((event, handler) => void) & ((event, handler) => void) & ((event, handler) => void)
    -

    Registers an event listener.

    -
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (event, handler): void
      • -
      • -
        -

        Parameters

        -
        -

        Returns void

    -
    -

    Type declaration

    -
      -
    • -
        -
      • (event, handler): void
      • -
      • -
        -

        Parameters

        -
        -

        Returns void

    -
    -

    Type declaration

    -
      -
    • -
        -
      • (event, handler): void
      • -
      • -
        -

        Parameters

        -
        -

        Returns void

    -
    -

    Type declaration

    -
      -
    • -
        -
      • (event, handler): void
      • -
      • -
        -

        Parameters

        -
        -

        Returns void

    -
    -

    Param

    The event.

    - +

    Properties

    id?: number

    Worker id.

    +
    on: ((event, handler) => void) & ((event, handler) => void) & ((event, handler) => void) & ((event, handler) => void)

    Registers an event listener.

    +

    Type declaration

    Type declaration

    Type declaration

    Type declaration

    Param

    The event.

    Param

    The event handler.

    -
    -
    - -
    once: ((event, handler) => void)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (event, handler): void
      • -
      • -

        Registers a listener to the exit event that will only be performed once.

        -
        -
        -

        Parameters

        -
          -
        • -
          event: "exit"
          -

          The 'exit' event.

          -
          -
        • -
        • -
          handler: ExitHandler<IWorker>
          -

          The exit handler.

          -
          -
        -

        Returns void

        -
    -
    - -
    threadId?: number
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +
    once: ((event, handler) => void)

    Type declaration

      • (event, handler): void
      • Registers a listener to the exit event that will only be performed once.

        +

        Parameters

        Returns void

    threadId?: number

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/IWorkerChoiceStrategy.html b/docs/interfaces/IWorkerChoiceStrategy.html index 46ccd74a..ce4505d3 100644 --- a/docs/interfaces/IWorkerChoiceStrategy.html +++ b/docs/interfaces/IWorkerChoiceStrategy.html @@ -1,222 +1,25 @@ -IWorkerChoiceStrategy | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface IWorkerChoiceStrategyInternal

    -
    -

    Worker choice strategy interface.

    -
    -
    -
    -

    Hierarchy

    -
      -
    • IWorkerChoiceStrategy
    -
    -
    -
    - -
    -
    -

    Properties

    -
    choose +IWorkerChoiceStrategy | poolifier - v3.0.5

    Interface IWorkerChoiceStrategyInternal

    Worker choice strategy interface.

    +

    Hierarchy

    • IWorkerChoiceStrategy
    -
    -

    Properties

    -
    - -
    choose: (() => undefined | number)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (): undefined | number
      • -
      • -

        Chooses a worker node in the pool and returns its key. +

    Properties

    choose: (() => undefined | number)

    Type declaration

      • (): undefined | number
      • Chooses a worker node in the pool and returns its key. If no worker nodes are not eligible, undefined is returned. If undefined is returned, the caller retry.

        -
        -

        Returns undefined | number

        The worker node key or undefined.

        - -
    -
    - -
    remove: ((workerNodeKey) => boolean)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (workerNodeKey): boolean
      • -
      • -

        Removes the worker node key from strategy internals.

        -
        -
        -

        Parameters

        -
          -
        • -
          workerNodeKey: number
          -

          The worker node key.

          -
          -
        -

        Returns boolean

        true if the worker node key is removed, false otherwise.

        - -
    -
    - -
    reset: (() => boolean)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (): boolean
      • -
      • -

        Resets strategy internals.

        -
        -

        Returns boolean

        true if the reset is successful, false otherwise.

        - -
    -
    - -
    setOptions: ((opts) => void)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (opts): void
      • -
      • -

        Sets the worker choice strategy options.

        -
        -
        -

        Parameters

        -
        -

        Returns void

        -
    -
    - -
    strategyPolicy: StrategyPolicy
    -

    Strategy policy.

    -
    -
    -
    - -
    taskStatisticsRequirements: TaskStatisticsRequirements
    -

    Tasks statistics requirements.

    -
    -
    -
    - -
    update: ((workerNodeKey) => boolean)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (workerNodeKey): boolean
      • -
      • -

        Updates the worker node key strategy internals. +

        Returns undefined | number

        The worker node key or undefined.

        +
    remove: ((workerNodeKey) => boolean)

    Type declaration

      • (workerNodeKey): boolean
      • Removes the worker node key from strategy internals.

        +

        Parameters

        • workerNodeKey: number

          The worker node key.

          +

        Returns boolean

        true if the worker node key is removed, false otherwise.

        +
    reset: (() => boolean)

    Type declaration

      • (): boolean
      • Resets strategy internals.

        +

        Returns boolean

        true if the reset is successful, false otherwise.

        +
    setOptions: ((opts) => void)

    Type declaration

      • (opts): void
      • Sets the worker choice strategy options.

        +

        Parameters

        Returns void

    strategyPolicy: StrategyPolicy

    Strategy policy.

    +
    taskStatisticsRequirements: TaskStatisticsRequirements

    Tasks statistics requirements.

    +
    update: ((workerNodeKey) => boolean)

    Type declaration

      • (workerNodeKey): boolean
      • Updates the worker node key strategy internals. This is called after a task has been executed on a worker node.

        -
        -
        -

        Parameters

        -
          -
        • -
          workerNodeKey: number
        -

        Returns boolean

        true if the update is successful, false otherwise.

        - -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Parameters

    • workerNodeKey: number

    Returns boolean

    true if the update is successful, false otherwise.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/IWorkerNode.html b/docs/interfaces/IWorkerNode.html index 68aea13a..b9693522 100644 --- a/docs/interfaces/IWorkerNode.html +++ b/docs/interfaces/IWorkerNode.html @@ -1,53 +1,7 @@ -IWorkerNode | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface IWorkerNode<Worker, Data>Internal

    -
    -

    Worker node interface.

    -
    -
    -
    -

    Type Parameters

    -
      -
    • -

      Worker extends IWorker

      -

      Type of worker.

      -
      -
    • -
    • -

      Data = unknown

      -

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

      -
      -
    -
    -

    Hierarchy

    -
      -
    • EventTarget -
        -
      • IWorkerNode
    -
    -
    -
    - -
    -
    -

    Properties

    -
    clearTasksQueue +IWorkerNode | poolifier - v3.0.5

    Interface IWorkerNode<Worker, Data>Internal

    Worker node interface.

    +

    Type Parameters

    • Worker extends IWorker

      Type of worker.

      +
    • Data = unknown

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

      +

    Hierarchy

    • EventTarget
      • IWorkerNode
    -
    -

    Properties

    -
    - -
    clearTasksQueue: (() => void)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (): void
      • -
      • -

        Clears tasks queue.

        -
        -

        Returns void

        -
    -
    - -
    closeChannel: (() => void)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (): void
      • -
      • -

        Closes communication channel.

        -
        -

        Returns void

        -
    -
    - -
    deleteTaskFunctionWorkerUsage: ((name) => boolean)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (name): boolean
      • -
      • -

        Deletes task function worker usage statistics.

        -
        -
        -

        Parameters

        -
          -
        • -
          name: string
          -

          The task function name.

          -
          -
        -

        Returns boolean

        true if the task function worker usage statistics were deleted, false otherwise.

        - -
    -
    - -
    dequeueTask: (() => undefined | Task<Data>)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (): undefined | Task<Data>
      • -
      • -

        Dequeue task.

        -
        -

        Returns undefined | Task<Data>

        The dequeued task.

        - -
    -
    - -
    enqueueTask: ((task) => number)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (task): number
      • -
      • -

        Enqueue task.

        -
        -
        -

        Parameters

        -
          -
        • -
          task: Task<Data>
          -

          The task to queue.

          -
          -
        -

        Returns number

        The tasks queue size.

        - -
    -
    - -
    getTaskFunctionWorkerUsage: ((name) => undefined | WorkerUsage)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (name): undefined | WorkerUsage
      • -
      • -

        Gets task function worker usage statistics.

        -
        -
        -

        Parameters

        -
          -
        • -
          name: string
          -

          The task function name.

          -
          -
        -

        Returns undefined | WorkerUsage

        The task function worker usage statistics if the task function worker usage statistics are initialized, undefined otherwise.

        - -
    -
    - -
    hasBackPressure: (() => boolean)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (): boolean
      • -
      • -

        Whether the worker node has back pressure (i.e. its tasks queue is full).

        -
        -

        Returns boolean

        true if the worker node has back pressure, false otherwise.

        - -
    -
    - - -

    Worker info.

    -
    -
    -
    - -
    messageChannel?: MessageChannel
    -

    Message channel (worker_threads only).

    -
    -
    -
    - -
    popTask: (() => undefined | Task<Data>)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (): undefined | Task<Data>
      • -
      • -

        Pops a task from the tasks queue.

        -
        -

        Returns undefined | Task<Data>

        The popped task.

        - -
    -
    - -
    resetUsage: (() => void)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (): void
      • -
      • -

        Resets usage statistics.

        -
        -

        Returns void

        -
    -
    - -
    strategyData?: StrategyData
    -

    Worker choice strategy data. +

    Properties

    clearTasksQueue: (() => void)

    Type declaration

      • (): void
      • Clears tasks queue.

        +

        Returns void

    closeChannel: (() => void)

    Type declaration

      • (): void
      • Closes communication channel.

        +

        Returns void

    deleteTaskFunctionWorkerUsage: ((name) => boolean)

    Type declaration

      • (name): boolean
      • Deletes task function worker usage statistics.

        +

        Parameters

        • name: string

          The task function name.

          +

        Returns boolean

        true if the task function worker usage statistics were deleted, false otherwise.

        +
    dequeueTask: (() => undefined | Task<Data>)

    Type declaration

      • (): undefined | Task<Data>
      • Dequeue task.

        +

        Returns undefined | Task<Data>

        The dequeued task.

        +
    enqueueTask: ((task) => number)

    Type declaration

      • (task): number
      • Enqueue task.

        +

        Parameters

        • task: Task<Data>

          The task to queue.

          +

        Returns number

        The tasks queue size.

        +
    getTaskFunctionWorkerUsage: ((name) => undefined | WorkerUsage)

    Type declaration

      • (name): undefined | WorkerUsage
      • Gets task function worker usage statistics.

        +

        Parameters

        • name: string

          The task function name.

          +

        Returns undefined | WorkerUsage

        The task function worker usage statistics if the task function worker usage statistics are initialized, undefined otherwise.

        +
    hasBackPressure: (() => boolean)

    Type declaration

      • (): boolean
      • Whether the worker node has back pressure (i.e. its tasks queue is full).

        +

        Returns boolean

        true if the worker node has back pressure, false otherwise.

        +

    Worker info.

    +
    messageChannel?: MessageChannel

    Message channel (worker_threads only).

    +
    popTask: (() => undefined | Task<Data>)

    Type declaration

      • (): undefined | Task<Data>
      • Pops a task from the tasks queue.

        +

        Returns undefined | Task<Data>

        The popped task.

        +
    resetUsage: (() => void)

    Type declaration

      • (): void
      • Resets usage statistics.

        +

        Returns void

    strategyData?: StrategyData

    Worker choice strategy data. This is used to store data that are specific to the worker choice strategy.

    -
    -
    -
    - -
    tasksQueueBackPressureSize: number
    -

    Tasks queue back pressure size. +

    tasksQueueBackPressureSize: number

    Tasks queue back pressure size. This is the number of tasks that can be enqueued before the worker node has back pressure.

    -
    -
    -
    - -
    tasksQueueSize: (() => number)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (): number
      • -
      • -

        Tasks queue size.

        -
        -

        Returns number

        The tasks queue size.

        - -
    -
    - -
    unshiftTask: ((task) => number)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (task): number
      • -
      • -

        Prepends a task to the tasks queue.

        -
        -
        -

        Parameters

        -
          -
        • -
          task: Task<Data>
          -

          The task to prepend.

          -
          -
        -

        Returns number

        The tasks queue size.

        - -
    -
    - - -

    Worker usage statistics.

    -
    -
    -
    - -
    worker: Worker
    -

    Worker.

    -
    -
    -
    -

    Methods

    -
    - -
      - -
    • -

      Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.

      +
    tasksQueueSize: (() => number)

    Type declaration

      • (): number
      • Tasks queue size.

        +

        Returns number

        The tasks queue size.

        +
    unshiftTask: ((task) => number)

    Type declaration

      • (task): number
      • Prepends a task to the tasks queue.

        +

        Parameters

        • task: Task<Data>

          The task to prepend.

          +

        Returns number

        The tasks queue size.

        +

    Worker usage statistics.

    +
    worker: Worker

    Worker.

    +

    Methods

    • Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.

      The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.

      When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.

      When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.

      @@ -354,125 +60,8 @@ This is the number of tasks that can be enqueued before the worker node has back

      If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.

      The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.

      MDN Reference

      -
      -
      -

      Parameters

      -
        -
      • -
        type: string
      • -
      • -
        callback: null | EventListenerOrEventListenerObject
      • -
      • -
        Optional options: boolean | AddEventListenerOptions
      -

      Returns void

      -
    -
    - -
      - -
    • -

      Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

      +

      Parameters

      • type: string
      • callback: null | EventListenerOrEventListenerObject
      • Optional options: boolean | AddEventListenerOptions

      Returns void

    • Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

      MDN Reference

      -
      -
      -

      Parameters

      -
        -
      • -
        event: Event
      -

      Returns boolean

      -
    -
    - -
      - -
    • -

      Removes the event listener in target's event listener list with the same type, callback, and options.

      +

      Parameters

      • event: Event

      Returns boolean

    • Removes the event listener in target's event listener list with the same type, callback, and options.

      MDN Reference

      -
      -
      -

      Parameters

      -
        -
      • -
        type: string
      • -
      • -
        callback: null | EventListenerOrEventListenerObject
      • -
      • -
        Optional options: boolean | EventListenerOptions
      -

      Returns void

      -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Parameters

    • type: string
    • callback: null | EventListenerOrEventListenerObject
    • Optional options: boolean | EventListenerOptions

    Returns void

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/MeasurementOptions.html b/docs/interfaces/MeasurementOptions.html index f118577d..8617fbad 100644 --- a/docs/interfaces/MeasurementOptions.html +++ b/docs/interfaces/MeasurementOptions.html @@ -1,94 +1,4 @@ -MeasurementOptions | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface MeasurementOptions

    -
    -

    Measurement options.

    -
    -
    -
    -

    Hierarchy

    -
      -
    • MeasurementOptions
    -
    -
    -
    - -
    -
    -

    Properties

    -
    -
    -

    Properties

    -
    - -
    median: boolean
    -

    Set measurement median.

    -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +MeasurementOptions | poolifier - v3.0.5

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/MeasurementStatistics.html b/docs/interfaces/MeasurementStatistics.html index e3e1b5c0..d21e5141 100644 --- a/docs/interfaces/MeasurementStatistics.html +++ b/docs/interfaces/MeasurementStatistics.html @@ -1,144 +1,14 @@ -MeasurementStatistics | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface MeasurementStatisticsInternal

    -
    -

    Measurement statistics.

    -
    -
    -
    -

    Hierarchy

    -
      -
    • MeasurementStatistics
    -
    -
    -
    - -
    -
    -

    Properties

    -
    aggregate? +MeasurementStatistics | poolifier - v3.0.5

    Interface MeasurementStatisticsInternal

    Measurement statistics.

    +

    Hierarchy

    • MeasurementStatistics
    -
    -

    Properties

    -
    - -
    aggregate?: number
    -

    Measurement aggregate.

    -
    -
    -
    - -
    average?: number
    -

    Measurement average.

    -
    -
    -
    - -
    history: CircularArray<number>
    -

    Measurement history.

    -
    -
    -
    - -
    maximum?: number
    -

    Measurement maximum.

    -
    -
    -
    - -
    median?: number
    -

    Measurement median.

    -
    -
    -
    - -
    minimum?: number
    -

    Measurement minimum.

    -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Properties

    aggregate?: number

    Measurement aggregate.

    +
    average?: number

    Measurement average.

    +
    history: CircularArray<number>

    Measurement history.

    +
    maximum?: number

    Measurement maximum.

    +
    median?: number

    Measurement median.

    +
    minimum?: number

    Measurement minimum.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/MeasurementStatisticsRequirements.html b/docs/interfaces/MeasurementStatisticsRequirements.html index f09b5c53..716a7f65 100644 --- a/docs/interfaces/MeasurementStatisticsRequirements.html +++ b/docs/interfaces/MeasurementStatisticsRequirements.html @@ -1,114 +1,8 @@ -MeasurementStatisticsRequirements | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface MeasurementStatisticsRequirementsInternal

    -
    -

    Measurement statistics requirements.

    -
    -
    -
    -

    Hierarchy

    -
      -
    • MeasurementStatisticsRequirements
    -
    -
    -
    - -
    -
    -

    Properties

    -
    aggregate +MeasurementStatisticsRequirements | poolifier - v3.0.5

    Interface MeasurementStatisticsRequirementsInternal

    Measurement statistics requirements.

    +

    Hierarchy

    • MeasurementStatisticsRequirements
    -
    -

    Properties

    -
    - -
    aggregate: boolean
    -

    Requires measurement aggregate.

    -
    -
    -
    - -
    average: boolean
    -

    Requires measurement average.

    -
    -
    -
    - -
    median: boolean
    -

    Requires measurement median.

    -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Properties

    aggregate: boolean

    Requires measurement aggregate.

    +
    average: boolean

    Requires measurement average.

    +
    median: boolean

    Requires measurement median.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/MessageValue.html b/docs/interfaces/MessageValue.html index 078a4cf9..a6a59391 100644 --- a/docs/interfaces/MessageValue.html +++ b/docs/interfaces/MessageValue.html @@ -1,53 +1,7 @@ -MessageValue | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface MessageValue<Data, ErrorData>Internal

    -
    -

    Message object that is passed between main worker and worker.

    -
    -
    -
    -

    Type Parameters

    -
      -
    • -

      Data = unknown

      -

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

      -
      -
    • -
    • -

      ErrorData = unknown

      -

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

      -
      -
    -
    -

    Hierarchy

    -
      -
    • Task<Data> -
        -
      • MessageValue
    -
    -
    -
    - -
    -
    -

    Properties

    -
    checkActive? +MessageValue | poolifier - v3.0.5

    Interface MessageValue<Data, ErrorData>Internal

    Message object that is passed between main worker and worker.

    +

    Type Parameters

    • Data = unknown

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

      +
    • ErrorData = unknown

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

      +

    Hierarchy

    • Task<Data>
      • MessageValue
    -
    -

    Properties

    -
    - -
    checkActive?: boolean
    -

    Whether the worker starts or stops its activity check.

    -
    -
    -
    - -
    data?: Data
    -

    Task input data that will be passed to the worker.

    -
    -
    -
    - -
    kill?: true | "success" | "SOFT" | "HARD" | "failure"
    -

    Kill code.

    -
    -
    -
    - -
    name?: string
    -

    Task name.

    -
    -
    -
    - -
    port?: MessagePort
    -

    Message port.

    -
    -
    -
    - -
    ready?: boolean
    -

    Whether the worker is ready or not.

    -
    -
    -
    - -
    statistics?: WorkerStatistics
    -

    Whether the worker computes the given statistics or not.

    -
    -
    -
    - -
    taskFunction?: string
    -

    Task function serialized to string.

    -
    -
    -
    - -
    taskFunctionName?: string
    -

    Task function name.

    -
    -
    -
    - -
    taskFunctionNames?: string[]
    -

    Task function names.

    -
    -
    -
    - -
    taskFunctionOperation?: "add" | "default" | "remove"
    -

    Task function operation:

    +

    Properties

    checkActive?: boolean

    Whether the worker starts or stops its activity check.

    +
    data?: Data

    Task input data that will be passed to the worker.

    +
    kill?: true | "success" | "SOFT" | "HARD" | "failure"

    Kill code.

    +
    name?: string

    Task name.

    +
    port?: MessagePort

    Message port.

    +
    ready?: boolean

    Whether the worker is ready or not.

    +
    statistics?: WorkerStatistics

    Whether the worker computes the given statistics or not.

    +
    taskFunction?: string

    Task function serialized to string.

    +
    taskFunctionName?: string

    Task function name.

    +
    taskFunctionNames?: string[]

    Task function names.

    +
    taskFunctionOperation?: "add" | "default" | "remove"

    Task function operation:

    • 'add' - Add a task function.
    • 'remove' - Remove a task function.
    • 'default' - Set a task function as default.
    -
    -
    -
    - -
    taskFunctionOperationStatus?: boolean
    -

    Whether the task function operation is successful or not.

    -
    -
    -
    - -
    taskId?: string
    -

    Task UUID.

    -
    -
    -
    - -
    taskPerformance?: TaskPerformance
    -

    Task performance.

    -
    -
    -
    - -
    timestamp?: number
    -

    Timestamp.

    -
    -
    -
    - -
    transferList?: TransferListItem[]
    -

    Array of transferable objects.

    -
    -
    -
    - -
    workerError?: WorkerError<ErrorData>
    -

    Worker error.

    -
    -
    -
    - -
    workerId?: number
    -

    Worker id.

    -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +
    taskFunctionOperationStatus?: boolean

    Whether the task function operation is successful or not.

    +
    taskId?: string

    Task UUID.

    +
    taskPerformance?: TaskPerformance

    Task performance.

    +
    timestamp?: number

    Timestamp.

    +
    transferList?: TransferListItem[]

    Array of transferable objects.

    +
    workerError?: WorkerError<ErrorData>

    Worker error.

    +
    workerId?: number

    Worker id.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/PoolInfo.html b/docs/interfaces/PoolInfo.html index 325c30f1..cc5d3f6a 100644 --- a/docs/interfaces/PoolInfo.html +++ b/docs/interfaces/PoolInfo.html @@ -1,38 +1,5 @@ -PoolInfo | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface PoolInfo

    -
    -

    Pool information.

    -
    -
    -
    -

    Hierarchy

    -
      -
    • PoolInfo
    -
    -
    -
    - -
    -
    -

    Properties

    -
    backPressure? +PoolInfo | poolifier - v3.0.5

    Interface PoolInfo

    Pool information.

    +

    Hierarchy

    • PoolInfo
    -
    -

    Properties

    -
    - -
    backPressure?: boolean
    -
    - -
    busyWorkerNodes: number
    -

    Pool busy worker nodes.

    -
    -
    -
    - -
    executedTasks: number
    -
    - -
    executingTasks: number
    -
    - -
    failedTasks: number
    -
    - -
    idleWorkerNodes: number
    -

    Pool idle worker nodes.

    -
    -
    -
    - -
    maxQueuedTasks?: number
    -
    - -
    maxSize: number
    -
    - -
    minSize: number
    -
    - -
    queuedTasks?: number
    -
    - -
    ready: boolean
    -
    - -
    runTime?: {
        average?: number;
        maximum: number;
        median?: number;
        minimum: number;
    }
    -
    -

    Type declaration

    -
      -
    • -
      Optional Readonly average?: number
    • -
    • -
      Readonly maximum: number
    • -
    • -
      Optional Readonly median?: number
    • -
    • -
      Readonly minimum: number
    -
    - -
    started: boolean
    -
    - -
    stolenTasks?: number
    -
    - -
    strategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
    -
    - -
    type: "fixed" | "dynamic"
    -
    - -
    utilization?: number
    -

    Pool utilization.

    -
    -
    -
    - -
    version: string
    -
    - -
    waitTime?: {
        average?: number;
        maximum: number;
        median?: number;
        minimum: number;
    }
    -
    -

    Type declaration

    -
      -
    • -
      Optional Readonly average?: number
    • -
    • -
      Readonly maximum: number
    • -
    • -
      Optional Readonly median?: number
    • -
    • -
      Readonly minimum: number
    -
    - -
    worker: "thread" | "cluster"
    -
    - -
    workerNodes: number
    -

    Pool total worker nodes.

    -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Properties

    backPressure?: boolean
    busyWorkerNodes: number

    Pool busy worker nodes.

    +
    executedTasks: number
    executingTasks: number
    failedTasks: number
    idleWorkerNodes: number

    Pool idle worker nodes.

    +
    maxQueuedTasks?: number
    maxSize: number
    minSize: number
    queuedTasks?: number
    ready: boolean
    runTime?: {
        average?: number;
        maximum: number;
        median?: number;
        minimum: number;
    }

    Type declaration

    • Optional Readonly average?: number
    • Readonly maximum: number
    • Optional Readonly median?: number
    • Readonly minimum: number
    started: boolean
    stolenTasks?: number
    strategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
    type: "fixed" | "dynamic"
    utilization?: number

    Pool utilization.

    +
    version: string
    waitTime?: {
        average?: number;
        maximum: number;
        median?: number;
        minimum: number;
    }

    Type declaration

    • Optional Readonly average?: number
    • Readonly maximum: number
    • Optional Readonly median?: number
    • Readonly minimum: number
    worker: "thread" | "cluster"
    workerNodes: number

    Pool total worker nodes.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/PoolOptions.html b/docs/interfaces/PoolOptions.html index fc3bb3c0..e9e48ca9 100644 --- a/docs/interfaces/PoolOptions.html +++ b/docs/interfaces/PoolOptions.html @@ -1,49 +1,6 @@ -PoolOptions | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface PoolOptions<Worker>

    -
    -

    Options for a poolifier pool.

    -
    -
    -
    -

    Type Parameters

    -
      -
    • -

      Worker extends IWorker

      -

      Type of worker.

      -
      -
    -
    -

    Hierarchy

    -
    -
    -
    -
    - -
    -
    -

    Properties

    -
    enableEvents? +PoolOptions | poolifier - v3.0.5

    Interface PoolOptions<Worker>

    Options for a poolifier pool.

    +

    Type Parameters

    • Worker extends IWorker

      Type of worker.

      +

    Hierarchy

    -
    -

    Properties

    -
    - -
    enableEvents?: boolean
    -

    Pool events integrated with async resource emission.

    -
    -
    -

    Default Value

    true
    +

    Properties

    enableEvents?: boolean

    Pool events integrated with async resource emission.

    +

    Default Value

    true
     
    -
    -
    - -
    enableTasksQueue?: boolean
    -

    Pool worker node tasks queue.

    -
    -
    -

    Default Value

    false
    +
    enableTasksQueue?: boolean

    Pool worker node tasks queue.

    +

    Default Value

    false
     
    -
    -
    - -
    errorHandler?: ErrorHandler<Worker>
    -

    A function that will listen for error event on each worker.

    -
    -
    -

    Default Value

    () => {}

    -
    -
    - -
    exitHandler?: ExitHandler<Worker>
    -

    A function that will listen for exit event on each worker.

    -
    -
    -

    Default Value

    () => {}

    -
    -
    - -
    messageHandler?: MessageHandler<Worker>
    -

    A function that will listen for message event on each worker.

    -
    -
    -

    Default Value

    () => {}

    -
    -
    - -
    onlineHandler?: OnlineHandler<Worker>
    -

    A function that will listen for online event on each worker.

    -
    -
    -

    Default Value

    () => {}

    -
    -
    - -
    restartWorkerOnError?: boolean
    -

    Restart worker on error.

    -
    -
    -
    - -
    startWorkers?: boolean
    -

    Whether to start the minimum number of workers at pool initialization.

    -
    -
    -

    Default Value

    true
    +
    errorHandler?: ErrorHandler<Worker>

    A function that will listen for error event on each worker.

    +

    Default Value

    () => {}

    +
    exitHandler?: ExitHandler<Worker>

    A function that will listen for exit event on each worker.

    +

    Default Value

    () => {}

    +
    messageHandler?: MessageHandler<Worker>

    A function that will listen for message event on each worker.

    +

    Default Value

    () => {}

    +
    onlineHandler?: OnlineHandler<Worker>

    A function that will listen for online event on each worker.

    +

    Default Value

    () => {}

    +
    restartWorkerOnError?: boolean

    Restart worker on error.

    +
    startWorkers?: boolean

    Whether to start the minimum number of workers at pool initialization.

    +

    Default Value

    true
     
    -
    -
    - -
    tasksQueueOptions?: TasksQueueOptions
    -

    Pool worker node tasks queue options.

    -
    -
    -
    - -
    workerChoiceStrategy?: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
    -

    The worker choice strategy to use in this pool.

    -
    -
    -

    Default Value

    WorkerChoiceStrategies.ROUND_ROBIN
    +
    tasksQueueOptions?: TasksQueueOptions

    Pool worker node tasks queue options.

    +
    workerChoiceStrategy?: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

    The worker choice strategy to use in this pool.

    +

    Default Value

    WorkerChoiceStrategies.ROUND_ROBIN
     
    -
    -
    - -
    workerChoiceStrategyOptions?: WorkerChoiceStrategyOptions
    -

    The worker choice strategy options.

    -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +
    workerChoiceStrategyOptions?: WorkerChoiceStrategyOptions

    The worker choice strategy options.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/PromiseResponseWrapper.html b/docs/interfaces/PromiseResponseWrapper.html index 3c05d003..991eddc5 100644 --- a/docs/interfaces/PromiseResponseWrapper.html +++ b/docs/interfaces/PromiseResponseWrapper.html @@ -1,148 +1,9 @@ -PromiseResponseWrapper | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface PromiseResponseWrapper<Response>Internal

    -
    -

    An object holding the task execution response promise resolve/reject callbacks.

    -
    -
    -
    -

    Type Parameters

    -
      -
    • -

      Response = unknown

      -

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

      -
      -
    -
    -

    Hierarchy

    -
      -
    • PromiseResponseWrapper
    -
    -
    -
    - -
    -
    -

    Properties

    -
    reject +PromiseResponseWrapper | poolifier - v3.0.5

    Interface PromiseResponseWrapper<Response>Internal

    An object holding the task execution response promise resolve/reject callbacks.

    +

    Type Parameters

    • Response = unknown

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

      +

    Hierarchy

    • PromiseResponseWrapper
    -
    -

    Properties

    -
    - -
    reject: ((reason?) => void)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (reason?): void
      • -
      • -

        Reject callback to reject the promise.

        -
        -
        -

        Parameters

        -
          -
        • -
          Optional reason: unknown
        -

        Returns void

        -
    -
    - -
    resolve: ((value) => void)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (value): void
      • -
      • -

        Resolve callback to fulfill the promise.

        -
        -
        -

        Parameters

        -
          -
        • -
          value: Response | PromiseLike<Response>
        -

        Returns void

        -
    -
    - -
    workerNodeKey: number
    -

    The worker node key executing the task.

    -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Properties

    reject: ((reason?) => void)

    Type declaration

      • (reason?): void
      • Reject callback to reject the promise.

        +

        Parameters

        • Optional reason: unknown

        Returns void

    resolve: ((value) => void)

    Type declaration

      • (value): void
      • Resolve callback to fulfill the promise.

        +

        Parameters

        • value: Response | PromiseLike<Response>

        Returns void

    workerNodeKey: number

    The worker node key executing the task.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/StrategyData.html b/docs/interfaces/StrategyData.html index a3ade906..e695cadb 100644 --- a/docs/interfaces/StrategyData.html +++ b/docs/interfaces/StrategyData.html @@ -1,91 +1,3 @@ -StrategyData | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface StrategyDataInternal

    -
    -

    Worker choice strategy data.

    -
    -
    -
    -

    Hierarchy

    -
      -
    • StrategyData
    -
    -
    -
    - -
    -
    -

    Properties

    -
    -
    -

    Properties

    -
    - -
    virtualTaskEndTimestamp?: number
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +StrategyData | poolifier - v3.0.5

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/StrategyPolicy.html b/docs/interfaces/StrategyPolicy.html index 214b4693..e933ad4a 100644 --- a/docs/interfaces/StrategyPolicy.html +++ b/docs/interfaces/StrategyPolicy.html @@ -1,104 +1,6 @@ -StrategyPolicy | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface StrategyPolicyInternal

    -
    -

    Strategy policy.

    -
    -
    -
    -

    Hierarchy

    -
      -
    • StrategyPolicy
    -
    -
    -
    - -
    -
    -

    Properties

    -
    dynamicWorkerReady +StrategyPolicy | poolifier - v3.0.5

    Interface StrategyPolicyInternal

    Strategy policy.

    +

    Hierarchy

    • StrategyPolicy
    -
    -

    Properties

    -
    - -
    dynamicWorkerReady: boolean
    -

    Expects the newly created dynamic worker to be flagged as ready.

    -
    -
    -
    - -
    dynamicWorkerUsage: boolean
    -

    Expects tasks execution on the newly created dynamic worker.

    -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Properties

    dynamicWorkerReady: boolean

    Expects the newly created dynamic worker to be flagged as ready.

    +
    dynamicWorkerUsage: boolean

    Expects tasks execution on the newly created dynamic worker.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/Task.html b/docs/interfaces/Task.html index ba46bfc1..91ccb5a0 100644 --- a/docs/interfaces/Task.html +++ b/docs/interfaces/Task.html @@ -1,154 +1,15 @@ -Task | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface Task<Data>Internal

    -
    -

    Message object that is passed as a task between main worker and worker.

    -
    -
    -
    -

    Type Parameters

    -
      -
    • -

      Data = unknown

      -

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

      -
      -
    -
    -

    Hierarchy

    -
    -
    -
    -
    - -
    -
    -

    Properties

    -
    data? +Task | poolifier - v3.0.5

    Interface Task<Data>Internal

    Message object that is passed as a task between main worker and worker.

    +

    Type Parameters

    • Data = unknown

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

      +

    Hierarchy

    -
    -

    Properties

    -
    - -
    data?: Data
    -

    Task input data that will be passed to the worker.

    -
    -
    -
    - -
    name?: string
    -

    Task name.

    -
    -
    -
    - -
    taskId?: string
    -

    Task UUID.

    -
    -
    -
    - -
    timestamp?: number
    -

    Timestamp.

    -
    -
    -
    - -
    transferList?: TransferListItem[]
    -

    Array of transferable objects.

    -
    -
    -
    - -
    workerId?: number
    -

    Worker id.

    -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Properties

    data?: Data

    Task input data that will be passed to the worker.

    +
    name?: string

    Task name.

    +
    taskId?: string

    Task UUID.

    +
    timestamp?: number

    Timestamp.

    +
    transferList?: TransferListItem[]

    Array of transferable objects.

    +
    workerId?: number

    Worker id.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/TaskFunctionOperationResult.html b/docs/interfaces/TaskFunctionOperationResult.html index 422d5e15..bc93e693 100644 --- a/docs/interfaces/TaskFunctionOperationResult.html +++ b/docs/interfaces/TaskFunctionOperationResult.html @@ -1,98 +1,4 @@ -TaskFunctionOperationResult | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface TaskFunctionOperationResult

    -
    -

    Task function operation result.

    -
    -
    -
    -

    Hierarchy

    -
      -
    • TaskFunctionOperationResult
    -
    -
    -
    - -
    -
    -

    Properties

    -
    error? +TaskFunctionOperationResult | poolifier - v3.0.5

    Interface TaskFunctionOperationResult

    Task function operation result.

    +

    Hierarchy

    • TaskFunctionOperationResult

    Properties

    -
    -

    Properties

    -
    - -
    error?: Error
    -
    - -
    status: boolean
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Properties

    error?: Error
    status: boolean

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/TaskPerformance.html b/docs/interfaces/TaskPerformance.html index e1796750..522432c2 100644 --- a/docs/interfaces/TaskPerformance.html +++ b/docs/interfaces/TaskPerformance.html @@ -1,124 +1,10 @@ -TaskPerformance | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface TaskPerformanceInternal

    -
    -

    Task performance.

    -
    -
    -
    -

    Hierarchy

    -
      -
    • TaskPerformance
    -
    -
    -
    - -
    -
    -

    Properties

    -
    elu? +TaskPerformance | poolifier - v3.0.5

    Interface TaskPerformanceInternal

    Task performance.

    +

    Hierarchy

    • TaskPerformance
    -
    -

    Properties

    -
    - -
    elu?: EventLoopUtilization
    -

    Task event loop utilization.

    -
    -
    -
    - -
    name: string
    -

    Task name.

    -
    -
    -
    - -
    runTime?: number
    -

    Task runtime.

    -
    -
    -
    - -
    timestamp: number
    -

    Task performance timestamp.

    -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Properties

    elu?: EventLoopUtilization

    Task event loop utilization.

    +
    name: string

    Task name.

    +
    runTime?: number

    Task runtime.

    +
    timestamp: number

    Task performance timestamp.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/TaskStatistics.html b/docs/interfaces/TaskStatistics.html index c400289f..1d18d70f 100644 --- a/docs/interfaces/TaskStatistics.html +++ b/docs/interfaces/TaskStatistics.html @@ -1,144 +1,14 @@ -TaskStatistics | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface TaskStatisticsInternal

    -
    -

    Task statistics.

    -
    -
    -
    -

    Hierarchy

    -
      -
    • TaskStatistics
    -
    -
    -
    - -
    -
    -

    Properties

    -
    executed +TaskStatistics | poolifier - v3.0.5

    Interface TaskStatisticsInternal

    Task statistics.

    +

    Hierarchy

    • TaskStatistics
    -
    -

    Properties

    -
    - -
    executed: number
    -

    Number of executed tasks.

    -
    -
    -
    - -
    executing: number
    -

    Number of executing tasks.

    -
    -
    -
    - -
    failed: number
    -

    Number of failed tasks.

    -
    -
    -
    - -
    maxQueued?: number
    -

    Maximum number of queued tasks.

    -
    -
    -
    - -
    queued: number
    -

    Number of queued tasks.

    -
    -
    -
    - -
    stolen: number
    -

    Number of stolen tasks.

    -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Properties

    executed: number

    Number of executed tasks.

    +
    executing: number

    Number of executing tasks.

    +
    failed: number

    Number of failed tasks.

    +
    maxQueued?: number

    Maximum number of queued tasks.

    +
    queued: number

    Number of queued tasks.

    +
    stolen: number

    Number of stolen tasks.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/TaskStatisticsRequirements.html b/docs/interfaces/TaskStatisticsRequirements.html index a1fca660..024c3da9 100644 --- a/docs/interfaces/TaskStatisticsRequirements.html +++ b/docs/interfaces/TaskStatisticsRequirements.html @@ -1,114 +1,8 @@ -TaskStatisticsRequirements | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface TaskStatisticsRequirementsInternal

    -
    -

    Pool worker node worker usage statistics requirements.

    -
    -
    -
    -

    Hierarchy

    -
      -
    • TaskStatisticsRequirements
    -
    -
    -
    - -
    -
    -

    Properties

    -
    elu +TaskStatisticsRequirements | poolifier - v3.0.5

    Interface TaskStatisticsRequirementsInternal

    Pool worker node worker usage statistics requirements.

    +

    Hierarchy

    • TaskStatisticsRequirements

    Properties

    -
    -

    Properties

    -
    - - -

    Tasks event loop utilization requirements.

    -
    -
    -
    - - -

    Tasks runtime requirements.

    -
    -
    -
    - - -

    Tasks wait time requirements.

    -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Properties

    Tasks event loop utilization requirements.

    +

    Tasks runtime requirements.

    +

    Tasks wait time requirements.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/TasksQueueOptions.html b/docs/interfaces/TasksQueueOptions.html index c5f6be3b..da7cdd03 100644 --- a/docs/interfaces/TasksQueueOptions.html +++ b/docs/interfaces/TasksQueueOptions.html @@ -1,136 +1,18 @@ -TasksQueueOptions | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface TasksQueueOptions

    -
    -

    Worker node tasks queue options.

    -
    -
    -
    -

    Hierarchy

    -
      -
    • TasksQueueOptions
    -
    -
    -
    - -
    -
    -

    Properties

    -
    concurrency? +TasksQueueOptions | poolifier - v3.0.5

    Interface TasksQueueOptions

    Worker node tasks queue options.

    +

    Hierarchy

    • TasksQueueOptions
    -
    -

    Properties

    -
    - -
    concurrency?: number
    -

    Maximum number of tasks that can be executed concurrently on a worker node.

    -
    -
    -

    Default Value

    1
    +

    Properties

    concurrency?: number

    Maximum number of tasks that can be executed concurrently on a worker node.

    +

    Default Value

    1
     
    -
    -
    - -
    size?: number
    -

    Maximum tasks queue size per worker node flagging it as back pressured.

    -
    -
    -

    Default Value

    (pool maximum size)^2
    +
    size?: number

    Maximum tasks queue size per worker node flagging it as back pressured.

    +

    Default Value

    (pool maximum size)^2
     
    -
    -
    - -
    taskStealing?: boolean
    -

    Whether to enable task stealing on empty queue.

    -
    -
    -

    Default Value

    true
    +
    taskStealing?: boolean

    Whether to enable task stealing on empty queue.

    +

    Default Value

    true
     
    -
    -
    - -
    tasksStealingOnBackPressure?: boolean
    -

    Whether to enable tasks stealing under back pressure.

    -
    -
    -

    Default Value

    true
    +
    tasksStealingOnBackPressure?: boolean

    Whether to enable tasks stealing under back pressure.

    +

    Default Value

    true
     
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/ThreadPoolOptions.html b/docs/interfaces/ThreadPoolOptions.html index 742a7556..d82e2149 100644 --- a/docs/interfaces/ThreadPoolOptions.html +++ b/docs/interfaces/ThreadPoolOptions.html @@ -1,40 +1,5 @@ -ThreadPoolOptions | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface ThreadPoolOptions

    -
    -

    Options for a poolifier thread pool.

    -
    -
    -
    -

    Hierarchy

    -
    -
    -
    -
    - -
    -
    -

    Properties

    -
    enableEvents? +ThreadPoolOptions | poolifier - v3.0.5

    Interface ThreadPoolOptions

    Options for a poolifier thread pool.

    +

    Hierarchy

    -
    -

    Properties

    -
    - -
    enableEvents?: boolean
    -

    Pool events integrated with async resource emission.

    -
    -
    -

    Default Value

    true
    +

    Properties

    enableEvents?: boolean

    Pool events integrated with async resource emission.

    +

    Default Value

    true
     
    -
    -
    - -
    enableTasksQueue?: boolean
    -

    Pool worker node tasks queue.

    -
    -
    -

    Default Value

    false
    +
    enableTasksQueue?: boolean

    Pool worker node tasks queue.

    +

    Default Value

    false
     
    -
    -
    - -
    errorHandler?: ErrorHandler<Worker>
    -

    A function that will listen for error event on each worker.

    -
    -
    -

    Default Value

    () => {}

    -
    -
    - -
    exitHandler?: ExitHandler<Worker>
    -

    A function that will listen for exit event on each worker.

    -
    -
    -

    Default Value

    () => {}

    -
    -
    - -
    messageHandler?: MessageHandler<Worker>
    -

    A function that will listen for message event on each worker.

    -
    -
    -

    Default Value

    () => {}

    -
    -
    - -
    onlineHandler?: OnlineHandler<Worker>
    -

    A function that will listen for online event on each worker.

    -
    -
    -

    Default Value

    () => {}

    -
    -
    - -
    restartWorkerOnError?: boolean
    -

    Restart worker on error.

    -
    -
    -
    - -
    startWorkers?: boolean
    -

    Whether to start the minimum number of workers at pool initialization.

    -
    -
    -

    Default Value

    true
    +
    errorHandler?: ErrorHandler<Worker>

    A function that will listen for error event on each worker.

    +

    Default Value

    () => {}

    +
    exitHandler?: ExitHandler<Worker>

    A function that will listen for exit event on each worker.

    +

    Default Value

    () => {}

    +
    messageHandler?: MessageHandler<Worker>

    A function that will listen for message event on each worker.

    +

    Default Value

    () => {}

    +
    onlineHandler?: OnlineHandler<Worker>

    A function that will listen for online event on each worker.

    +

    Default Value

    () => {}

    +
    restartWorkerOnError?: boolean

    Restart worker on error.

    +
    startWorkers?: boolean

    Whether to start the minimum number of workers at pool initialization.

    +

    Default Value

    true
     
    -
    -
    - -
    tasksQueueOptions?: TasksQueueOptions
    -

    Pool worker node tasks queue options.

    -
    -
    -
    - -
    workerChoiceStrategy?: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
    -

    The worker choice strategy to use in this pool.

    -
    -
    -

    Default Value

    WorkerChoiceStrategies.ROUND_ROBIN
    +
    tasksQueueOptions?: TasksQueueOptions

    Pool worker node tasks queue options.

    +
    workerChoiceStrategy?: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

    The worker choice strategy to use in this pool.

    +

    Default Value

    WorkerChoiceStrategies.ROUND_ROBIN
     
    -
    -
    - -
    workerChoiceStrategyOptions?: WorkerChoiceStrategyOptions
    -

    The worker choice strategy options.

    -
    -
    -
    - -
    workerOptions?: WorkerOptions
    -

    Worker options.

    -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +
    workerChoiceStrategyOptions?: WorkerChoiceStrategyOptions

    The worker choice strategy options.

    +
    workerOptions?: WorkerOptions

    Worker options.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/WorkerChoiceStrategyOptions.html b/docs/interfaces/WorkerChoiceStrategyOptions.html index 8e7ad732..0c45d1b5 100644 --- a/docs/interfaces/WorkerChoiceStrategyOptions.html +++ b/docs/interfaces/WorkerChoiceStrategyOptions.html @@ -1,160 +1,25 @@ -WorkerChoiceStrategyOptions | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface WorkerChoiceStrategyOptions

    -
    -

    Worker choice strategy options.

    -
    -
    -
    -

    Hierarchy

    -
      -
    • WorkerChoiceStrategyOptions
    -
    -
    -
    - -
    -
    -

    Properties

    -
    elu? +WorkerChoiceStrategyOptions | poolifier - v3.0.5

    Interface WorkerChoiceStrategyOptions

    Worker choice strategy options.

    +

    Hierarchy

    • WorkerChoiceStrategyOptions
    -
    -

    Properties

    -
    - - -

    Event loop utilization options.

    -
    -
    -

    Default Value

    { median: false }
    +

    Properties

    Event loop utilization options.

    +

    Default Value

    { median: false }
     
    -
    -
    - -
    measurement?: "runTime" | "waitTime" | "elu"
    -

    Measurement to use in worker choice strategy supporting it.

    -
    -
    -
    - -
    retries?: number
    -

    Number of worker choice retries to perform if no worker is eligible.

    -
    -
    -

    Default Value

    6
    +
    measurement?: "runTime" | "waitTime" | "elu"

    Measurement to use in worker choice strategy supporting it.

    +
    retries?: number

    Number of worker choice retries to perform if no worker is eligible.

    +

    Default Value

    6
     
    -
    -
    - - -

    Runtime options.

    -
    -
    -

    Default Value

    { median: false }
    +

    Runtime options.

    +

    Default Value

    { median: false }
     
    -
    -
    - - -

    Wait time options.

    -
    -
    -

    Default Value

    { median: false }
    +

    Wait time options.

    +

    Default Value

    { median: false }
     
    -
    -
    - -
    weights?: Record<number, number>
    -

    Worker weights to use for weighted round robin worker selection strategies. +

    weights?: Record<number, number>

    Worker weights to use for weighted round robin worker selection strategies. A weight is tasks maximum execution time in milliseconds for a worker node.

    -
    -
    -

    Default Value

    Weights computed automatically given the CPU performance.
    +

    Default Value

    Weights computed automatically given the CPU performance.
     
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/WorkerError.html b/docs/interfaces/WorkerError.html index fe36df79..c4bcebf2 100644 --- a/docs/interfaces/WorkerError.html +++ b/docs/interfaces/WorkerError.html @@ -1,122 +1,9 @@ -WorkerError | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface WorkerError<Data>

    -
    -

    Worker error.

    -
    -
    -
    -

    Type Parameters

    -
      -
    • -

      Data = unknown

      -

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

      -
      -
    -
    -

    Hierarchy

    -
      -
    • WorkerError
    -
    -
    -
    - -
    -
    -

    Properties

    -
    data? +WorkerError | poolifier - v3.0.5

    Interface WorkerError<Data>

    Worker error.

    +

    Type Parameters

    • Data = unknown

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

      +

    Hierarchy

    • WorkerError

    Properties

    -
    -

    Properties

    -
    - -
    data?: Data
    -

    Data triggering the error.

    -
    -
    -
    - -
    message: string
    -

    Error message.

    -
    -
    -
    - -
    name: string
    -

    Task function name triggering the error.

    -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Properties

    data?: Data

    Data triggering the error.

    +
    message: string

    Error message.

    +
    name: string

    Task function name triggering the error.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/WorkerInfo.html b/docs/interfaces/WorkerInfo.html index 26e09414..f914b368 100644 --- a/docs/interfaces/WorkerInfo.html +++ b/docs/interfaces/WorkerInfo.html @@ -1,134 +1,12 @@ -WorkerInfo | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface WorkerInfoInternal

    -
    -

    Worker information.

    -
    -
    -
    -

    Hierarchy

    -
      -
    • WorkerInfo
    -
    -
    -
    - -
    -
    -

    Properties

    -
    dynamic +WorkerInfo | poolifier - v3.0.5

    Interface WorkerInfoInternal

    Worker information.

    +

    Hierarchy

    • WorkerInfo
    -
    -

    Properties

    -
    - -
    dynamic: boolean
    -

    Dynamic flag.

    -
    -
    -
    - -
    id: undefined | number
    -

    Worker id.

    -
    -
    -
    - -
    ready: boolean
    -

    Ready flag.

    -
    -
    -
    - -
    taskFunctionNames?: string[]
    -

    Task function names.

    -
    -
    -
    - -
    type: "thread" | "cluster"
    -

    Worker type.

    -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Properties

    dynamic: boolean

    Dynamic flag.

    +
    id: undefined | number

    Worker id.

    +
    ready: boolean

    Ready flag.

    +
    taskFunctionNames?: string[]

    Task function names.

    +
    type: "thread" | "cluster"

    Worker type.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/WorkerNodeEventDetail.html b/docs/interfaces/WorkerNodeEventDetail.html index cf249683..9c631c8f 100644 --- a/docs/interfaces/WorkerNodeEventDetail.html +++ b/docs/interfaces/WorkerNodeEventDetail.html @@ -1,91 +1,3 @@ -WorkerNodeEventDetail | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface WorkerNodeEventDetailInternal

    -
    -

    Worker node event detail.

    -
    -
    -
    -

    Hierarchy

    -
      -
    • WorkerNodeEventDetail
    -
    -
    -
    - -
    -
    -

    Properties

    -
    -
    -

    Properties

    -
    - -
    workerId: number
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +WorkerNodeEventDetail | poolifier - v3.0.5

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/WorkerOptions.html b/docs/interfaces/WorkerOptions.html index d57bd0d5..ec9dbeb4 100644 --- a/docs/interfaces/WorkerOptions.html +++ b/docs/interfaces/WorkerOptions.html @@ -1,73 +1,18 @@ -WorkerOptions | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface WorkerOptions

    -
    -

    Options for workers.

    -
    -
    -
    -

    Hierarchy

    -
      -
    • WorkerOptions
    -
    -
    -
    - -
    -
    -

    Properties

    -
    killBehavior? +WorkerOptions | poolifier - v3.0.5

    Interface WorkerOptions

    Options for workers.

    +

    Hierarchy

    • WorkerOptions
    -
    -

    Properties

    -
    - -
    killBehavior?: "SOFT" | "HARD"
    -

    killBehavior dictates if your worker will be deleted in case a task is active on it.

    +

    Properties

    killBehavior?: "SOFT" | "HARD"

    killBehavior dictates if your worker will be deleted in case a task is active on it.

    • SOFT: If currentTime - lastActiveTime is greater than maxInactiveTime but a task is still executing or queued, then the worker won't be deleted.
    • HARD: If currentTime - lastActiveTime is greater than maxInactiveTime but a task is still executing or queued, then the worker will be deleted.

    This option only apply to the newly created workers.

    -
    -
    -

    Default Value

    KillBehaviors.SOFT
    +

    Default Value

    KillBehaviors.SOFT
     
    -
    -
    - -
    killHandler?: KillHandler
    -

    The function to call when a worker is killed.

    -
    -
    -

    Default Value

    () => {}

    -
    -
    - -
    maxInactiveTime?: number
    -

    Maximum waiting time in milliseconds for tasks on newly created workers. It must be greater or equal than 5.

    +
    killHandler?: KillHandler

    The function to call when a worker is killed.

    +

    Default Value

    () => {}

    +
    maxInactiveTime?: number

    Maximum waiting time in milliseconds for tasks on newly created workers. It must be greater or equal than 5.

    After this time, newly created workers will be terminated. The last active time of your worker will be updated when it terminates a task.

      @@ -75,60 +20,6 @@ The last active time of your worker will be updated when it terminates a task.
    • If killBehavior is set to KillBehaviors.SOFT your tasks have no timeout and your workers will not be terminated until your task is completed.
    -
    -
    -

    Default Value

    60000
    +

    Default Value

    60000
     
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/WorkerStatistics.html b/docs/interfaces/WorkerStatistics.html index 4e3904be..271d2902 100644 --- a/docs/interfaces/WorkerStatistics.html +++ b/docs/interfaces/WorkerStatistics.html @@ -1,104 +1,6 @@ -WorkerStatistics | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface WorkerStatisticsInternal

    -
    -

    Worker task performance statistics computation settings.

    -
    -
    -
    -

    Hierarchy

    -
      -
    • WorkerStatistics
    -
    -
    -
    - -
    -
    -

    Properties

    -
    elu +WorkerStatistics | poolifier - v3.0.5

    Interface WorkerStatisticsInternal

    Worker task performance statistics computation settings.

    +

    Hierarchy

    • WorkerStatistics

    Properties

    -
    -

    Properties

    -
    - -
    elu: boolean
    -

    Whether the worker computes the task event loop utilization (ELU) or not.

    -
    -
    -
    - -
    runTime: boolean
    -

    Whether the worker computes the task runtime or not.

    -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Properties

    elu: boolean

    Whether the worker computes the task event loop utilization (ELU) or not.

    +
    runTime: boolean

    Whether the worker computes the task runtime or not.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/WorkerUsage.html b/docs/interfaces/WorkerUsage.html index 83eb3a26..cd44acc8 100644 --- a/docs/interfaces/WorkerUsage.html +++ b/docs/interfaces/WorkerUsage.html @@ -1,124 +1,10 @@ -WorkerUsage | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Interface WorkerUsageInternal

    -
    -

    Worker usage statistics.

    -
    -
    -
    -

    Hierarchy

    -
      -
    • WorkerUsage
    -
    -
    -
    - -
    -
    -

    Properties

    -
    elu +WorkerUsage | poolifier - v3.0.5

    Interface WorkerUsageInternal

    Worker usage statistics.

    +

    Hierarchy

    • WorkerUsage
    -
    -

    Properties

    -
    - - -

    Tasks event loop utilization statistics.

    -
    -
    -
    - - -

    Tasks runtime statistics.

    -
    -
    -
    - - -

    Tasks statistics.

    -
    -
    -
    - - -

    Tasks wait time statistics.

    -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Properties

    Tasks event loop utilization statistics.

    +

    Tasks runtime statistics.

    +

    Tasks statistics.

    +

    Tasks wait time statistics.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/ErrorHandler.html b/docs/types/ErrorHandler.html index e0c621bb..21158a3d 100644 --- a/docs/types/ErrorHandler.html +++ b/docs/types/ErrorHandler.html @@ -1,89 +1,3 @@ -ErrorHandler | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Type alias ErrorHandler<Worker>

    -
    ErrorHandler<Worker>: ((this, error) => void)
    -
    -

    Type Parameters

    -
      -
    • -

      Worker extends IWorker

      -

      Type of worker.

      -
      -
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (this, error): void
      • -
      • -

        Callback invoked if the worker raised an error.

        -
        -
        -

        Parameters

        -
          -
        • -
          this: Worker
        • -
        • -
          error: Error
        -

        Returns void

        -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +ErrorHandler | poolifier - v3.0.5

    Type alias ErrorHandler<Worker>

    ErrorHandler<Worker>: ((this, error) => void)

    Type Parameters

    • Worker extends IWorker

      Type of worker.

      +

    Type declaration

      • (this, error): void
      • Callback invoked if the worker raised an error.

        +

        Parameters

        • this: Worker
        • error: Error

        Returns void

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/ExitHandler.html b/docs/types/ExitHandler.html index 17120a85..6c85f989 100644 --- a/docs/types/ExitHandler.html +++ b/docs/types/ExitHandler.html @@ -1,89 +1,3 @@ -ExitHandler | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Type alias ExitHandler<Worker>

    -
    ExitHandler<Worker>: ((this, exitCode) => void)
    -
    -

    Type Parameters

    -
      -
    • -

      Worker extends IWorker

      -

      Type of worker.

      -
      -
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (this, exitCode): void
      • -
      • -

        Callback invoked when the worker exits successfully.

        -
        -
        -

        Parameters

        -
          -
        • -
          this: Worker
        • -
        • -
          exitCode: number
        -

        Returns void

        -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +ExitHandler | poolifier - v3.0.5

    Type alias ExitHandler<Worker>

    ExitHandler<Worker>: ((this, exitCode) => void)

    Type Parameters

    • Worker extends IWorker

      Type of worker.

      +

    Type declaration

      • (this, exitCode): void
      • Callback invoked when the worker exits successfully.

        +

        Parameters

        • this: Worker
        • exitCode: number

        Returns void

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/KillBehavior.html b/docs/types/KillBehavior.html index 00d6aaef..2582cfa8 100644 --- a/docs/types/KillBehavior.html +++ b/docs/types/KillBehavior.html @@ -1,66 +1,2 @@ -KillBehavior | poolifier - v3.0.5
    -
    - -
    - -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +KillBehavior | poolifier - v3.0.5

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/KillHandler.html b/docs/types/KillHandler.html index 433b9b86..8d3e9877 100644 --- a/docs/types/KillHandler.html +++ b/docs/types/KillHandler.html @@ -1,74 +1,2 @@ -KillHandler | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Type alias KillHandler

    -
    KillHandler: (() => void | Promise<void>)
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (): void | Promise<void>
      • -
      • -

        Handler called when a worker is killed.

        -
        -

        Returns void | Promise<void>

        -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +KillHandler | poolifier - v3.0.5

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/Measurement.html b/docs/types/Measurement.html index d3c70f84..322a783a 100644 --- a/docs/types/Measurement.html +++ b/docs/types/Measurement.html @@ -1,66 +1,2 @@ -Measurement | poolifier - v3.0.5
    -
    - -
    - -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +Measurement | poolifier - v3.0.5

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/MessageHandler.html b/docs/types/MessageHandler.html index a23a969f..bd66df51 100644 --- a/docs/types/MessageHandler.html +++ b/docs/types/MessageHandler.html @@ -1,89 +1,3 @@ -MessageHandler | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Type alias MessageHandler<Worker>

    -
    MessageHandler<Worker>: ((this, message) => void)
    -
    -

    Type Parameters

    -
      -
    • -

      Worker extends IWorker

      -

      Type of worker.

      -
      -
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (this, message): void
      • -
      • -

        Callback invoked if the worker has received a message.

        -
        -
        -

        Parameters

        -
          -
        • -
          this: Worker
        • -
        • -
          message: unknown
        -

        Returns void

        -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +MessageHandler | poolifier - v3.0.5

    Type alias MessageHandler<Worker>

    MessageHandler<Worker>: ((this, message) => void)

    Type Parameters

    • Worker extends IWorker

      Type of worker.

      +

    Type declaration

      • (this, message): void
      • Callback invoked if the worker has received a message.

        +

        Parameters

        • this: Worker
        • message: unknown

        Returns void

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/OnlineHandler.html b/docs/types/OnlineHandler.html index e8e70c30..f9b1eb8f 100644 --- a/docs/types/OnlineHandler.html +++ b/docs/types/OnlineHandler.html @@ -1,87 +1,3 @@ -OnlineHandler | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Type alias OnlineHandler<Worker>

    -
    OnlineHandler<Worker>: ((this) => void)
    -
    -

    Type Parameters

    -
      -
    • -

      Worker extends IWorker

      -

      Type of worker.

      -
      -
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (this): void
      • -
      • -

        Callback invoked when the worker has started successfully.

        -
        -
        -

        Parameters

        -
          -
        • -
          this: Worker
        -

        Returns void

        -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +OnlineHandler | poolifier - v3.0.5

    Type alias OnlineHandler<Worker>

    OnlineHandler<Worker>: ((this) => void)

    Type Parameters

    • Worker extends IWorker

      Type of worker.

      +

    Type declaration

      • (this): void
      • Callback invoked when the worker has started successfully.

        +

        Parameters

        • this: Worker

        Returns void

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/PoolEvent.html b/docs/types/PoolEvent.html index e08fe262..bfce896d 100644 --- a/docs/types/PoolEvent.html +++ b/docs/types/PoolEvent.html @@ -1,66 +1,2 @@ -PoolEvent | poolifier - v3.0.5
    -
    - -
    - -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +PoolEvent | poolifier - v3.0.5

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/PoolType.html b/docs/types/PoolType.html index 3c7bf6dd..b346dd73 100644 --- a/docs/types/PoolType.html +++ b/docs/types/PoolType.html @@ -1,66 +1,2 @@ -PoolType | poolifier - v3.0.5
    -
    - -
    - -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +PoolType | poolifier - v3.0.5

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/TaskAsyncFunction.html b/docs/types/TaskAsyncFunction.html index da29193e..4f0c5342 100644 --- a/docs/types/TaskAsyncFunction.html +++ b/docs/types/TaskAsyncFunction.html @@ -1,96 +1,6 @@ -TaskAsyncFunction | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Type alias TaskAsyncFunction<Data, Response>

    -
    TaskAsyncFunction<Data, Response>: ((data?) => Promise<Response>)
    -
    -

    Type Parameters

    -
      -
    • -

      Data = unknown

      -

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

      -
      -
    • -
    • -

      Response = unknown

      -

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

      -
      -
    -
    -

    Type declaration

    -

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/TaskFunction.html b/docs/types/TaskFunction.html index 6533100e..ea9a8788 100644 --- a/docs/types/TaskFunction.html +++ b/docs/types/TaskFunction.html @@ -1,80 +1,5 @@ -TaskFunction | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Type alias TaskFunction<Data, Response>

    -
    TaskFunction<Data, Response>: TaskSyncFunction<Data, Response> | TaskAsyncFunction<Data, Response>
    -

    Task function that can be executed. +TaskFunction | poolifier - v3.0.5

    Type alias TaskFunction<Data, Response>

    TaskFunction<Data, Response>: TaskSyncFunction<Data, Response> | TaskAsyncFunction<Data, Response>

    Task function that can be executed. This function can be synchronous or asynchronous.

    -
    -
    -

    Type Parameters

    -
      -
    • -

      Data = unknown

      -

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

      -
      -
    • -
    • -

      Response = unknown

      -

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

      -
      -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Type Parameters

    • Data = unknown

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

      +
    • Response = unknown

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

      +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/TaskFunctions.html b/docs/types/TaskFunctions.html index 9bcf1278..7cae5288 100644 --- a/docs/types/TaskFunctions.html +++ b/docs/types/TaskFunctions.html @@ -1,82 +1,7 @@ -TaskFunctions | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Type alias TaskFunctions<Data, Response>

    -
    TaskFunctions<Data, Response>: Record<string, TaskFunction<Data, Response>>
    -

    Tasks functions that can be executed. +TaskFunctions | poolifier - v3.0.5

    Type alias TaskFunctions<Data, Response>

    TaskFunctions<Data, Response>: Record<string, TaskFunction<Data, Response>>

    Tasks functions that can be executed. This object can contain synchronous or asynchronous functions. The key is the name of the function. The value is the function itself.

    -
    -
    -

    Type Parameters

    -
      -
    • -

      Data = unknown

      -

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

      -
      -
    • -
    • -

      Response = unknown

      -

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

      -
      -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +

    Type Parameters

    • Data = unknown

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

      +
    • Response = unknown

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

      +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/TaskSyncFunction.html b/docs/types/TaskSyncFunction.html index 2f5acd38..e487af65 100644 --- a/docs/types/TaskSyncFunction.html +++ b/docs/types/TaskSyncFunction.html @@ -1,95 +1,5 @@ -TaskSyncFunction | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Type alias TaskSyncFunction<Data, Response>

    -
    TaskSyncFunction<Data, Response>: ((data?) => Response)
    -
    -

    Type Parameters

    -
      -
    • -

      Data = unknown

      -

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

      -
      -
    • -
    • -

      Response = unknown

      -

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

      -
      -
    -
    -

    Type declaration

    -
      -
    • -
        -
      • (data?): Response
      • -
      • -

        Task synchronous function that can be executed.

        -
        -
        -

        Parameters

        -
          -
        • -
          Optional data: Data
          -

          Data sent to the worker.

          -
          -
        -

        Returns Response

        -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +TaskSyncFunction | poolifier - v3.0.5

    Type alias TaskSyncFunction<Data, Response>

    TaskSyncFunction<Data, Response>: ((data?) => Response)

    Type Parameters

    • Data = unknown

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

      +
    • Response = unknown

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

      +

    Type declaration

      • (data?): Response
      • Task synchronous function that can be executed.

        +

        Parameters

        • Optional data: Data

          Data sent to the worker.

          +

        Returns Response

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/WorkerChoiceStrategy.html b/docs/types/WorkerChoiceStrategy.html index adab3361..f5a85303 100644 --- a/docs/types/WorkerChoiceStrategy.html +++ b/docs/types/WorkerChoiceStrategy.html @@ -1,66 +1,2 @@ -WorkerChoiceStrategy | poolifier - v3.0.5
    -
    - -
    - -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +WorkerChoiceStrategy | poolifier - v3.0.5

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/WorkerType.html b/docs/types/WorkerType.html index 78180d59..d916da0b 100644 --- a/docs/types/WorkerType.html +++ b/docs/types/WorkerType.html @@ -1,66 +1,2 @@ -WorkerType | poolifier - v3.0.5
    -
    - -
    - -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +WorkerType | poolifier - v3.0.5

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/Writable.html b/docs/types/Writable.html index e78f6496..517f0371 100644 --- a/docs/types/Writable.html +++ b/docs/types/Writable.html @@ -1,68 +1 @@ -Writable | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Type alias Writable<T>

    -
    Writable<T>: {
        -readonly [P in keyof T]: T[P]
    }
    -
    -

    Type Parameters

    -
      -
    • -

      T

    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +Writable | poolifier - v3.0.5

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/KillBehaviors.html b/docs/variables/KillBehaviors.html index 4405629e..35b8c919 100644 --- a/docs/variables/KillBehaviors.html +++ b/docs/variables/KillBehaviors.html @@ -1,79 +1,4 @@ -KillBehaviors | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Variable KillBehaviorsConst

    -
    KillBehaviors: Readonly<{
        HARD: "HARD";
        SOFT: "SOFT";
    }> = ...
    -

    Enumeration of kill behaviors.

    -
    -
    -

    Type declaration

    -
      -
    • -
      Readonly HARD: "HARD"
      -

      If currentTime - lastActiveTime is greater than maxInactiveTime but a task is still executing or queued, then the worker will be deleted.

      -
      -
    • -
    • -
      Readonly SOFT: "SOFT"
      -

      If currentTime - lastActiveTime is greater than maxInactiveTime but a task is still executing or queued, then the worker wont be deleted.

      -
      -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +KillBehaviors | poolifier - v3.0.5

    Variable KillBehaviorsConst

    KillBehaviors: Readonly<{
        HARD: "HARD";
        SOFT: "SOFT";
    }> = ...

    Enumeration of kill behaviors.

    +

    Type declaration

    • Readonly HARD: "HARD"

      If currentTime - lastActiveTime is greater than maxInactiveTime but a task is still executing or queued, then the worker will be deleted.

      +
    • Readonly SOFT: "SOFT"

      If currentTime - lastActiveTime is greater than maxInactiveTime but a task is still executing or queued, then the worker wont be deleted.

      +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/Measurements.html b/docs/variables/Measurements.html index 60556a39..24f816c8 100644 --- a/docs/variables/Measurements.html +++ b/docs/variables/Measurements.html @@ -1,75 +1,2 @@ -Measurements | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Variable MeasurementsConst

    -
    Measurements: Readonly<{
        elu: "elu";
        runTime: "runTime";
        waitTime: "waitTime";
    }> = ...
    -

    Enumeration of measurements.

    -
    -
    -

    Type declaration

    -
      -
    • -
      Readonly elu: "elu"
    • -
    • -
      Readonly runTime: "runTime"
    • -
    • -
      Readonly waitTime: "waitTime"
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +Measurements | poolifier - v3.0.5

    Variable MeasurementsConst

    Measurements: Readonly<{
        elu: "elu";
        runTime: "runTime";
        waitTime: "waitTime";
    }> = ...

    Enumeration of measurements.

    +

    Type declaration

    • Readonly elu: "elu"
    • Readonly runTime: "runTime"
    • Readonly waitTime: "waitTime"

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/PoolEvents.html b/docs/variables/PoolEvents.html index 4ae809a3..cad6ec39 100644 --- a/docs/variables/PoolEvents.html +++ b/docs/variables/PoolEvents.html @@ -1,83 +1,2 @@ -PoolEvents | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Variable PoolEventsConst

    -
    PoolEvents: Readonly<{
        backPressure: "backPressure";
        busy: "busy";
        destroy: "destroy";
        error: "error";
        full: "full";
        ready: "ready";
        taskError: "taskError";
    }> = ...
    -

    Enumeration of pool events.

    -
    -
    -

    Type declaration

    -
      -
    • -
      Readonly backPressure: "backPressure"
    • -
    • -
      Readonly busy: "busy"
    • -
    • -
      Readonly destroy: "destroy"
    • -
    • -
      Readonly error: "error"
    • -
    • -
      Readonly full: "full"
    • -
    • -
      Readonly ready: "ready"
    • -
    • -
      Readonly taskError: "taskError"
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +PoolEvents | poolifier - v3.0.5

    Variable PoolEventsConst

    PoolEvents: Readonly<{
        backPressure: "backPressure";
        busy: "busy";
        destroy: "destroy";
        error: "error";
        full: "full";
        ready: "ready";
        taskError: "taskError";
    }> = ...

    Enumeration of pool events.

    +

    Type declaration

    • Readonly backPressure: "backPressure"
    • Readonly busy: "busy"
    • Readonly destroy: "destroy"
    • Readonly error: "error"
    • Readonly full: "full"
    • Readonly ready: "ready"
    • Readonly taskError: "taskError"

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/PoolTypes.html b/docs/variables/PoolTypes.html index f40cc2fd..917a208e 100644 --- a/docs/variables/PoolTypes.html +++ b/docs/variables/PoolTypes.html @@ -1,79 +1,4 @@ -PoolTypes | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Variable PoolTypesConst

    -
    PoolTypes: Readonly<{
        dynamic: "dynamic";
        fixed: "fixed";
    }> = ...
    -

    Enumeration of pool types.

    -
    -
    -

    Type declaration

    -
      -
    • -
      Readonly dynamic: "dynamic"
      -

      Dynamic pool type.

      -
      -
    • -
    • -
      Readonly fixed: "fixed"
      -

      Fixed pool type.

      -
      -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +PoolTypes | poolifier - v3.0.5

    Variable PoolTypesConst

    PoolTypes: Readonly<{
        dynamic: "dynamic";
        fixed: "fixed";
    }> = ...

    Enumeration of pool types.

    +

    Type declaration

    • Readonly dynamic: "dynamic"

      Dynamic pool type.

      +
    • Readonly fixed: "fixed"

      Fixed pool type.

      +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/WorkerChoiceStrategies.html b/docs/variables/WorkerChoiceStrategies.html index 487f2e0e..b1739dc8 100644 --- a/docs/variables/WorkerChoiceStrategies.html +++ b/docs/variables/WorkerChoiceStrategies.html @@ -1,104 +1,9 @@ -WorkerChoiceStrategies | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Variable WorkerChoiceStrategiesConst

    -
    WorkerChoiceStrategies: Readonly<{
        FAIR_SHARE: "FAIR_SHARE";
        INTERLEAVED_WEIGHTED_ROUND_ROBIN: "INTERLEAVED_WEIGHTED_ROUND_ROBIN";
        LEAST_BUSY: "LEAST_BUSY";
        LEAST_ELU: "LEAST_ELU";
        LEAST_USED: "LEAST_USED";
        ROUND_ROBIN: "ROUND_ROBIN";
        WEIGHTED_ROUND_ROBIN: "WEIGHTED_ROUND_ROBIN";
    }> = ...
    -

    Enumeration of worker choice strategies.

    -
    -
    -

    Type declaration

    -
      -
    • -
      Readonly FAIR_SHARE: "FAIR_SHARE"
      -

      Fair share worker selection strategy.

      -
      -
    • -
    • -
      Readonly Experimental INTERLEAVED_WEIGHTED_ROUND_ROBIN: "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
      -

      Interleaved weighted round robin worker selection strategy.

      -
      -
    • -
    • -
      Readonly LEAST_BUSY: "LEAST_BUSY"
      -

      Least busy worker selection strategy.

      -
      -
    • -
    • -
      Readonly LEAST_ELU: "LEAST_ELU"
      -

      Least ELU worker selection strategy.

      -
      -
    • -
    • -
      Readonly LEAST_USED: "LEAST_USED"
      -

      Least used worker selection strategy.

      -
      -
    • -
    • -
      Readonly ROUND_ROBIN: "ROUND_ROBIN"
      -

      Round robin worker selection strategy.

      -
      -
    • -
    • -
      Readonly WEIGHTED_ROUND_ROBIN: "WEIGHTED_ROUND_ROBIN"
      -

      Weighted round robin worker selection strategy.

      -
      -
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +WorkerChoiceStrategies | poolifier - v3.0.5

    Variable WorkerChoiceStrategiesConst

    WorkerChoiceStrategies: Readonly<{
        FAIR_SHARE: "FAIR_SHARE";
        INTERLEAVED_WEIGHTED_ROUND_ROBIN: "INTERLEAVED_WEIGHTED_ROUND_ROBIN";
        LEAST_BUSY: "LEAST_BUSY";
        LEAST_ELU: "LEAST_ELU";
        LEAST_USED: "LEAST_USED";
        ROUND_ROBIN: "ROUND_ROBIN";
        WEIGHTED_ROUND_ROBIN: "WEIGHTED_ROUND_ROBIN";
    }> = ...

    Enumeration of worker choice strategies.

    +

    Type declaration

    • Readonly FAIR_SHARE: "FAIR_SHARE"

      Fair share worker selection strategy.

      +
    • Readonly Experimental INTERLEAVED_WEIGHTED_ROUND_ROBIN: "INTERLEAVED_WEIGHTED_ROUND_ROBIN"

      Interleaved weighted round robin worker selection strategy.

      +
    • Readonly LEAST_BUSY: "LEAST_BUSY"

      Least busy worker selection strategy.

      +
    • Readonly LEAST_ELU: "LEAST_ELU"

      Least ELU worker selection strategy.

      +
    • Readonly LEAST_USED: "LEAST_USED"

      Least used worker selection strategy.

      +
    • Readonly ROUND_ROBIN: "ROUND_ROBIN"

      Round robin worker selection strategy.

      +
    • Readonly WEIGHTED_ROUND_ROBIN: "WEIGHTED_ROUND_ROBIN"

      Weighted round robin worker selection strategy.

      +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/WorkerTypes.html b/docs/variables/WorkerTypes.html index 129dd4f5..b22e507f 100644 --- a/docs/variables/WorkerTypes.html +++ b/docs/variables/WorkerTypes.html @@ -1,73 +1,2 @@ -WorkerTypes | poolifier - v3.0.5
    -
    - -
    -
    -
    -
    - -

    Variable WorkerTypesConst

    -
    WorkerTypes: Readonly<{
        cluster: "cluster";
        thread: "thread";
    }> = ...
    -

    Enumeration of worker types.

    -
    -
    -

    Type declaration

    -
      -
    • -
      Readonly cluster: "cluster"
    • -
    • -
      Readonly thread: "thread"
    -
    -
    -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +WorkerTypes | poolifier - v3.0.5

    Variable WorkerTypesConst

    WorkerTypes: Readonly<{
        cluster: "cluster";
        thread: "thread";
    }> = ...

    Enumeration of worker types.

    +

    Type declaration

    • Readonly cluster: "cluster"
    • Readonly thread: "thread"

    Generated using TypeDoc

    \ No newline at end of file -- 2.34.1