X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Finterfaces%2FIPool.html;h=c44a88aa1c850c9d206bd19790d7e6b594697ce1;hb=b667be1103b9362ae29d094de05f812468464d4f;hp=fa5693f5038395cc509a11608b576aba5a23e309;hpb=06fa9e0de6b62965c9dd2fe6023e943f35775026;p=poolifier.git diff --git a/docs/interfaces/IPool.html b/docs/interfaces/IPool.html index fa5693f5..c44a88aa 100644 --- a/docs/interfaces/IPool.html +++ b/docs/interfaces/IPool.html @@ -1,4 +1,4 @@ -IPool | poolifier
+IPool | poolifier - v2.6.8
  • Preparing search index...
  • -
  • The search index is not available
poolifier
+
  • The search index is not available
  • poolifier - v2.6.8
    @@ -17,22 +17,26 @@

    Interface IPool<Worker, Data, Response>

    Contract definition for a poolifier pool.

    -
    -
    +
    +
    +

    Type Parameters

    -
    +

    Response = unknown

    +

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

    +
    +

    Hierarchy

    +
  • Defined in src/pools/pool.ts:176
  • @@ -50,95 +54,149 @@

    Properties

    -
    - -
    destroy: (() => Promise<void>)
    +
    + +
    destroy: (() => Promise<void>)

    Type declaration

    • -
        -
      • (): Promise<void>
      • +
          +
        • (): Promise<void>
        • -

          Shutdowns every current worker in this pool.

          +

          Terminates every current worker in this pool.

          -

          Returns Promise<void>

    -
    - -
    emitter?: PoolEmitter
    +
  • Defined in src/pools/pool.ts:211
  • +
    + +
    emitter?: PoolEmitter

    Emitter on which events can be listened to.

    Events that can currently be listened to:

    • 'full': Emitted when the pool is dynamic and full.
    • 'busy': Emitted when the pool is busy.
    • +
    • 'error': Emitted when an uncaught error occurs.
    • +
    • 'taskError': Emitted when an error occurs while executing a task.
    -
    -
    - -
    execute: ((data: Data) => Promise<Response>)
    +
  • Defined in src/pools/pool.ts:199
  • +
    + +
    enableTasksQueue: ((enable, tasksQueueOptions?) => void)

    Type declaration

    • -
        -
      • (data: Data): Promise<Response>
      • +
          +
        • (enable, tasksQueueOptions?): void
        • -

          Performs the task specified in the constructor with the data parameter.

          - -

          Returns

          Promise that will be resolved when the task is successfully completed.

          +

          Enables/disables the worker tasks queue in this pool.

          Parameters

          • -
            data: Data
            -

            The input for the specified task. This can only be serializable data.

            -
          -

          Returns Promise<Response>

    -
    - -
    findFreeWorkerNodeKey: (() => number)
    +
  • Defined in src/pools/pool.ts:236
  • +
    + +
    execute: ((data?, name?) => Promise<Response>)

    Type declaration

    • -
        -
      • (): number
      • +
          +
        • (data?, name?): Promise<Response>
        • -

          Finds a free worker node key based on the number of tasks the worker has applied.

          -

          If a worker is found with 0 running tasks, it is detected as free and its worker node key is returned.

          -

          If no free worker is found, -1 is returned.

          +

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

          +
          +
          +

          Parameters

          +
            +
          • +
            Optional data: Data
            +

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

            +
            +
          • +
          • +
            Optional name: string
            +

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

            +
            +
          +

          Returns Promise<Response>

          Promise that will be fulfilled when the task is completed.

          -

          Returns

          A worker node key if there is one, -1 otherwise.

          +
    +
    + +
    info: PoolInfo
    +

    Pool information.

    +
    +
    +
    + +
    setTasksQueueOptions: ((tasksQueueOptions) => void)
    +
    +

    Type declaration

    +
      +
    • +
        +
      • (tasksQueueOptions): void
      • +
      • +

        Sets the worker tasks queue options in this pool.

        +
        +
        +

        Parameters

        +
          +
        • +
          tasksQueueOptions: TasksQueueOptions
          +

          The worker tasks queue options.

          -

          Returns number

    -
    - -
    setWorkerChoiceStrategy: ((workerChoiceStrategy: "ROUND_ROBIN" | "LESS_USED" | "LESS_BUSY" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN") => void)
    +
  • Defined in src/pools/pool.ts:245
  • +
    + +
    setWorkerChoiceStrategy: ((workerChoiceStrategy, workerChoiceStrategyOptions?) => void)

    Type declaration

    • -
        -
      • (workerChoiceStrategy: "ROUND_ROBIN" | "LESS_USED" | "LESS_BUSY" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN"): void
      • +
          +
        • (workerChoiceStrategy, workerChoiceStrategyOptions?): void
        • Sets the worker choice strategy in this pool.

          @@ -146,32 +204,56 @@

          Parameters

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

            The worker choice strategy.

            -
    -

    Returns void

    -
    - -
    type: PoolType
    -

    Pool type.

    -

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

    -
    +
    + +
    setWorkerChoiceStrategyOptions: ((workerChoiceStrategyOptions) => void)
    +
    +

    Type declaration

    +
      +
    • +
        +
      • (workerChoiceStrategyOptions): void
      • +
      • +

        Sets the worker choice strategy options in this pool.

        +
        +
        +

        Parameters

        +
        +

        Returns void

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

    Pool worker nodes.

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

    On This Page

    +

    On This Page

    +
  • destroy
  • +
  • emitter
  • +
  • enableTasksQueue
  • +
  • execute
  • +
  • info
  • +
  • setTasksQueueOptions
  • +
  • setWorkerChoiceStrategy
  • +
  • setWorkerChoiceStrategyOptions
  • +
  • workerNodes
  • +
  • AbstractPool
  • +
  • AbstractWorker
  • +
  • CircularArray
  • +
  • ClusterWorker
  • +
  • DynamicClusterPool
  • +
  • DynamicThreadPool
  • +
  • FixedClusterPool
  • +
  • FixedThreadPool
  • +
  • PoolEmitter
  • +
  • Queue
  • +
  • ThreadWorker
  • +
  • WorkerChoiceStrategyContext
  • +
  • ClusterPoolOptions
  • +
  • EventLoopUtilizationMeasurementStatistics
  • +
  • IPool
  • +
  • IWorker
  • +
  • IWorkerChoiceStrategy
  • +
  • MeasurementOptions
  • +
  • MeasurementStatistics
  • +
  • MeasurementStatisticsRequirements
  • +
  • MessageValue
  • +
  • PoolInfo
  • +
  • PoolOptions
  • +
  • PromiseResponseWrapper
  • +
  • StrategyPolicy
  • +
  • Task
  • +
  • TaskError
  • +
  • TaskPerformance
  • +
  • TaskStatistics
  • +
  • TaskStatisticsRequirements
  • +
  • TasksQueueOptions
  • +
  • ThreadPoolOptions
  • +
  • WorkerChoiceStrategyOptions
  • +
  • WorkerInfo
  • +
  • WorkerNode
  • +
  • WorkerOptions
  • +
  • WorkerStatistics
  • +
  • WorkerUsage
  • +
  • ErrorHandler
  • +
  • ExitHandler
  • +
  • KillBehavior
  • +
  • Measurement
  • +
  • MessageHandler
  • +
  • OnlineHandler
  • +
  • PoolEvent
  • +
  • PoolType
  • +
  • TaskFunctions
  • +
  • WorkerAsyncFunction
  • +
  • WorkerChoiceStrategy
  • +
  • WorkerFunction
  • +
  • WorkerSyncFunction
  • +
  • WorkerType
  • +
  • KillBehaviors
  • +
  • Measurements
  • +
  • PoolEvents
  • +
  • PoolTypes
  • +
  • WorkerChoiceStrategies
  • +
  • WorkerTypes
  • +
  • availableParallelism
  • Generated using TypeDoc

    \ No newline at end of file