X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FAbstractWorker.html;h=c544fca00d13c053a2729753e25234b188106419;hb=a6b5c73ccccb3ef0ccc24ad462182e3cacee77b4;hp=cc9478be9593e622995c642388bf6421a412e27e;hpb=b45edd35eec0fb1d5fd8fa979ff00f17f4e3c24e;p=poolifier.git diff --git a/docs/classes/AbstractWorker.html b/docs/classes/AbstractWorker.html index cc9478be..c544fca0 100644 --- a/docs/classes/AbstractWorker.html +++ b/docs/classes/AbstractWorker.html @@ -1,4 +1,4 @@ -AbstractWorker | poolifier
+AbstractWorker | poolifier - v2.6.9
  • Preparing search index...
  • -
  • The search index is not available
poolifier
+
  • The search index is not available
  • poolifier - v2.6.9
    @@ -17,33 +17,37 @@

    Class AbstractWorker<MainWorker, Data, Response>Abstract

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

    -
    -
    +
    +
    +

    Type Parameters

    -
    +

    Response = unknown

    +

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

    +
    +

    Hierarchy

    @@ -51,334 +55,362 @@

    Constructors

    -
    - -
      - +
      + +
        +
      • Constructs a new poolifier worker.

        -
        +

        Type Parameters

        -
          +
          • -

            MainWorker extends Worker | MessagePort

          • +

            MainWorker extends Worker | MessagePort

          • -

            Data = unknown

          • +

            Data = unknown

          • -

            Response = unknown

        +

        Response = unknown

      Parameters

      • -
        type: string
        +
        type: string

        The type of async event.

        -
      • +
      +
    • -
      isMain: boolean
      +
      isMain: boolean

      Whether this is the main worker or not.

      -
    • -
    • -
      fn: ((data: Data) => Response)
      -

      Function processed by the worker when the pool's execution function is invoked.

      -
        -
      • -
          -
        • (data: Data): Response
        • -
        • -
          -

          Parameters

          -
            +
          • -
            data: Data
          -

          Returns Response

    • +
      taskFunctions: WorkerFunction<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.

      +
      +
    • -
      mainWorker: undefined | null | MainWorker
      +
      mainWorker: MainWorker

      Reference to main worker.

      -
    • + +
    • -
      opts: WorkerOptions = ...
      +
      opts: WorkerOptions = ...

      Options for the worker.

      -
    -

    Returns AbstractWorker<MainWorker, Data, Response>

    +
  • Defined in src/worker/abstract-worker.ts:68
  • Properties

    -
    - -
    aliveInterval?: Timeout
    +
    + +
    aliveInterval?: Timeout

    Handler id of the aliveInterval worker alive check.

    -
    -
    - -
    isMain: boolean
    +
  • Defined in src/worker/abstract-worker.ts:58
  • +
    + +
    id: number
    +

    Worker id.

    +
    +
    +
    + +
    isMain: boolean

    Whether this is the main worker or not.

    -
    -
    - -
    lastTaskTimestamp: number
    +
  • Defined in src/worker/abstract-worker.ts:70
  • +
    + +
    lastTaskTimestamp: number

    Timestamp of the last task processed by this worker.

    -
    -
    - -
    mainWorker: undefined | null | MainWorker
    +
  • Defined in src/worker/abstract-worker.ts:50
  • +
    + +
    mainWorker: MainWorker

    Reference to main worker.

    -
    -
    - -
    opts: WorkerOptions = ...
    +
  • Defined in src/worker/abstract-worker.ts:74
  • +
    + +
    opts: WorkerOptions = ...

    Options for the worker.

    -
    +
    + +
    statistics: WorkerStatistics
    +

    Performance statistics computation requirements.

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

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

    +
    +
    +
  • Defined in src/worker/abstract-worker.ts:46
  • Methods

    -
    - -
      - +
      + +
        +
      • -
        -

        Returns

        The unique asyncId assigned to the resource.

        -
        -

        Returns number

      -
      - -
        - +
      • Defined in node_modules/.pnpm/@types+node@20.4.0/node_modules/@types/node/async_hooks.d.ts:306
    +
    + +
    +
    + +
      +
    • Binds the given function to execute to this AsyncResource's scope.

      -

      The returned function will have an asyncResource property referencing -the AsyncResource to which the function is bound.

      - -

      Since

      v14.8.0, v12.19.0

      -
      +

      Type Parameters

      -
        +
        • -

          Func extends ((...args: any[]) => any)

      +

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

    Parameters

    • -
      fn: Func
      +
      fn: Func

      The function to bind to the current AsyncResource.

      -
    -

    Returns Func & {
        asyncResource: AsyncResource;
    }

    -
    - -
    +
    + +
    +
    + +
    -
    - -
    +
    + + +

    Returns void

    +
    -
    - -
    +
    + +

    Returns void

    -
    - -
    +
    + +
    -
    - -
    -
    - -
    +
    + +
    -
    - - +

    Returns TaskPerformance

    +
    + +
    +
    + + -

    Returns void

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

    Input data for the given function.

    -
  • -

    Returns void

    -
    - -
    +
    + + +

    Returns void

    +
    -
    - -
    +
    + +

    Parameters

    +

    Returns Result

  • -
    Optional thisArg: This
    +
    Optional thisArg: This

    The receiver to be used for the function call.

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

    Optional arguments to pass to the function.

    -
  • -

    Returns Result

    +
    + +
    +
    + + +

    Returns void

    +
    -
    - -
    +
    + +
    +
    + +
    +
    + +
    -
    - -
    +
    + +

    Parameters

    +
  • -
    Optional type: string
    +
    Optional type: string

    An optional name to associate with the underlying AsyncResource.

    -
  • + +
  • -
    Optional thisArg: ThisArg
  • -

    Returns Func & {
        asyncResource: AsyncResource;
    }

    -

    On This Page

    +

    On This Page

    +
  • constructor
  • +
  • aliveInterval
  • +
  • id
  • +
  • isMain
  • +
  • lastTaskTimestamp
  • +
  • mainWorker
  • +
  • opts
  • +
  • statistics
  • +
  • taskFunctions
  • +
  • asyncId
  • +
  • beginTaskPerformance
  • +
  • bind
  • +
  • checkAlive
  • +
  • checkStatistics
  • +
  • checkTaskFunctions
  • +
  • checkWorkerOptions
  • +
  • emitDestroy
  • +
  • endTaskPerformance
  • +
  • getMainWorker
  • +
  • getTaskFunction
  • +
  • handleError
  • +
  • messageListener
  • +
  • runAsync
  • +
  • runInAsyncScope
  • +
  • runSync
  • +
  • sendToMainWorker
  • +
  • startCheckAlive
  • +
  • stopCheckAlive
  • +
  • triggerAsyncId
  • +
  • bind
  • +
  • AbstractPool
  • +
  • AbstractWorker
  • +
  • CircularArray
  • +
  • ClusterWorker
  • +
  • DynamicClusterPool
  • +
  • DynamicThreadPool
  • +
  • FixedClusterPool
  • +
  • FixedThreadPool
  • +
  • PoolEmitter
  • +
  • Queue
  • +
  • ThreadWorker
  • +
  • WorkerChoiceStrategyContext
  • +
  • ClusterPoolOptions
  • +
  • EventLoopUtilizationMeasurementStatistics
  • +
  • IPool
  • +
  • IWorker
  • +
  • IWorkerChoiceStrategy
  • +
  • IWorkerNode
  • +
  • MeasurementOptions
  • +
  • MeasurementStatistics
  • +
  • MeasurementStatisticsRequirements
  • +
  • MessageValue
  • +
  • PoolInfo
  • +
  • PoolOptions
  • +
  • PromiseResponseWrapper
  • +
  • StrategyPolicy
  • +
  • Task
  • +
  • TaskError
  • +
  • TaskPerformance
  • +
  • TaskStatistics
  • +
  • TaskStatisticsRequirements
  • +
  • TasksQueueOptions
  • +
  • ThreadPoolOptions
  • +
  • WorkerChoiceStrategyOptions
  • +
  • WorkerInfo
  • +
  • WorkerOptions
  • +
  • WorkerStatistics
  • +
  • WorkerUsage
  • +
  • ErrorHandler
  • +
  • ExitHandler
  • +
  • KillBehavior
  • +
  • Measurement
  • +
  • MessageHandler
  • +
  • OnlineHandler
  • +
  • PoolEvent
  • +
  • PoolType
  • +
  • TaskFunctions
  • +
  • WorkerAsyncFunction
  • +
  • WorkerChoiceStrategy
  • +
  • WorkerFunction
  • +
  • WorkerSyncFunction
  • +
  • WorkerType
  • +
  • KillBehaviors
  • +
  • Measurements
  • +
  • PoolEvents
  • +
  • PoolTypes
  • +
  • WorkerChoiceStrategies
  • +
  • WorkerTypes
  • +
  • availableParallelism
  • Generated using TypeDoc

    \ No newline at end of file