X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FAbstractWorker.html;h=ee6528c7ecbdceafae2a69a8bbd2c4c76abe0eb1;hb=76b46937556ea55049d5c413aa0a77d0c7f47f48;hp=5ff29d945688f69d7286b7924b37b4433ecb8a6d;hpb=ed1ecf09c599769ed61771ec25d71c39c19ba70b;p=poolifier.git diff --git a/docs/classes/AbstractWorker.html b/docs/classes/AbstractWorker.html index 5ff29d94..ad386bb2 100644 --- a/docs/classes/AbstractWorker.html +++ b/docs/classes/AbstractWorker.html @@ -1,13 +1,15 @@ -AbstractWorker | poolifier
+AbstractWorker | poolifier - v2.6.19
-
+
  • The search index is not available
  • poolifier - v2.6.19 +
    -
    +
    • poolifier
    • @@ -15,33 +17,37 @@

      Class AbstractWorker<MainWorker, Data, Response>Abstract

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

    -
    -
    +
    +
    +

    Type Parameters

    -
      +
      • -

        MainWorker extends Worker | MessagePort

        +

        MainWorker extends Worker | MessagePort

        Type of main worker.

        -
      • +
    +
  • -

    Data = unknown

    -

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

    -
  • +

    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 serializable data.

    -
  • +

    Response = unknown

    +

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

    +
    +

    Hierarchy

    @@ -49,465 +55,756 @@

    Constructors

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

        -
        +

        Type Parameters

        -
          +
          • -

            MainWorker extends Worker | MessagePort

          • +

            MainWorker extends MessagePort | Worker

          • -

            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

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

      Reference to main worker.

      -
    • +
    +
    +
  • +
    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.

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

    Options for the worker.

    -
  • -

    Returns AbstractWorker<MainWorker, Data, Response>

    Properties

    -
    - -
    aliveInterval?: Timeout
    -

    Handler Id of the aliveInterval worker alive check.

    -
    +
    + +
    isMain: boolean
    +

    Whether this is the main worker or not.

    +
    +
    +
    + +
    lastTaskTimestamp: number

    Timestamp of the last task processed by this worker.

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

    Reference to main worker.

    +
    +
    -
    - - +
  • Defined in src/worker/abstract-worker.ts:76
  • +
    + +
    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:51
  • Methods

    -
    - -
    +
    + +
    +
    + +

    Parameters

    -

    Returns Func & { asyncResource: AsyncResource }

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

    Returns void

    +
    -
    - -
    +
    + +

    Returns void

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

    Returns string

    The error message.

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

    Returns void

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

    The received message.

    +
    +
    +

    Returns void

    +
    +
    + + +

    Returns boolean

    Whether the task function existed and was removed or not.

    + +
    +

    Throws

    https://nodejs.org/api/errors.html#class-typeerror If the name parameter is not a string.

    + +

    Throws

    https://nodejs.org/api/errors.html#class-error If the name parameter is the default task function reserved name.

    + +

    Throws

    https://nodejs.org/api/errors.html#class-error If the name parameter is the task function used as default task function.

    +
    -
    - -
    +
    + +
    +
    + + +
    fn: WorkerAsyncFunction<Data, Response>
    +

    Task function that will be executed.

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

    Input data for the given function.

    -
  • -

    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

    - -
    +
  • constructor
  • +
  • activeInterval
  • +
  • id
  • +
  • isMain
  • +
  • lastTaskTimestamp
  • +
  • mainWorker
  • +
  • opts
  • +
  • statistics
  • +
  • taskFunctions
  • +
  • addTaskFunction
  • +
  • asyncId
  • +
  • beginTaskPerformance
  • +
  • bind
  • +
  • checkActive
  • +
  • checkStatistics
  • +
  • checkTaskFunctions
  • +
  • checkWorkerOptions
  • +
  • emitDestroy
  • +
  • endTaskPerformance
  • +
  • getMainWorker
  • +
  • getTaskFunction
  • +
  • handleError
  • +
  • handleKillMessage
  • +
  • handleReadyMessage
  • +
  • hasTaskFunction
  • +
  • listTaskFunctions
  • +
  • messageListener
  • +
  • removeTaskFunction
  • +
  • run
  • +
  • runAsync
  • +
  • runInAsyncScope
  • +
  • runSync
  • +
  • sendToMainWorker
  • +
  • setDefaultTaskFunction
  • +
  • startCheckActive
  • +
  • stopCheckActive
  • +
  • triggerAsyncId
  • +
  • updateLastTaskTimestamp
  • +
  • bind
  • + +

    Generated using TypeDoc

    -
    \ No newline at end of file +
    \ No newline at end of file