X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FClusterWorker.html;h=0ac4865d24a4757f25900904a46b066b3d7a2746;hb=76b46937556ea55049d5c413aa0a77d0c7f47f48;hp=7ee60557f3f97e205678e5e4bf59501697223385;hpb=8662ea71e523af81c1138618f0e12b89df35ce8a;p=poolifier.git diff --git a/docs/classes/ClusterWorker.html b/docs/classes/ClusterWorker.html index 7ee60557..926a5b93 100644 --- a/docs/classes/ClusterWorker.html +++ b/docs/classes/ClusterWorker.html @@ -1,13 +1,15 @@ -ClusterWorker | poolifier
+ClusterWorker | poolifier - v2.6.19
-
+
  • The search index is not available
  • poolifier - v2.6.19 +
    -
    +
    • poolifier
    • @@ -19,30 +21,33 @@ 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

    -

    Template

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

    - -

    Template

    of response the worker sends back to the main worker. This can only be serializable data.

    - -

    Author

    Christopher Quadflieg

    - -

    Since

    2.0.0

    +

    Since

    2.0.0

    -
    +

    Type Parameters

    -
      +
      • -

        Data = unknown

      • +

        Data = unknown

        +

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

        +
        +
      • -

        Response = unknown

    +

    Response = unknown

    +

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

    +
    +

    Hierarchy

    +
  • Defined in src/worker/cluster-worker.ts:21
  • @@ -50,354 +55,525 @@ but the minimum number of workers will be guaranteed.

    Constructors

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

        -
        +

        Type Parameters

        -
          +
          • -

            Data = unknown

          • +

            Data = unknown

          • -

            Response = unknown

        +

        Response = unknown

      Parameters

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

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

        +
        taskFunctions: WorkerFunction<Data, Response> | TaskFunctions<Data, Response>
        +

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

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

            Parameters

            -
              +
            • -
              data: Data
            -

            Returns Response

      • -
      • -
        opts: WorkerOptions = {}
        +
        opts: WorkerOptions = {}

        Options for the worker.

        -
      -

      Returns ClusterWorker<Data, Response>

    +
    +

    Returns ClusterWorker<Data, Response>

    +
    +
  • Defined in src/worker/cluster-worker.ts:31
  • 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 | Worker
    -
    - -
    opts: WorkerOptions
    +
  • Defined in src/worker/abstract-worker.ts:55
  • +
    + +
    opts: WorkerOptions = ...

    Options for the worker.

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

    +
    +
    +
    +

    Accessors

    +
    + +

    Methods

    -
    - -
    +
    + +

    Parameters

    -

    Returns Func & { asyncResource: AsyncResource }

    -
    - - +

    Returns Func

    +
    +

    Since

    v14.8.0, v12.19.0

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

    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
  • +
  • isMain
  • +
  • lastTaskTimestamp
  • +
  • opts
  • +
  • statistics
  • +
  • taskFunctions
  • +
  • id
  • +
  • addTaskFunction
  • +
  • asyncId
  • +
  • bind
  • +
  • emitDestroy
  • +
  • getMainWorker
  • +
  • handleError
  • +
  • handleKillMessage
  • +
  • handleReadyMessage
  • +
  • hasTaskFunction
  • +
  • listTaskFunctions
  • +
  • messageListener
  • +
  • removeTaskFunction
  • +
  • run
  • +
  • runAsync
  • +
  • runInAsyncScope
  • +
  • runSync
  • +
  • sendToMainWorker
  • +
  • setDefaultTaskFunction
  • +
  • triggerAsyncId
  • +
  • bind
  • + +

    Generated using TypeDoc

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