X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FClusterWorker.html;h=a43f3ae9efb274792c5307fb9f5e1bf6aeadf69d;hb=5a24d71c903b876f660285d52b2369a5496954e5;hp=8c0f1bf25e7c7d68dff8c7037c2456cad6d1b9c4;hpb=e604957d6ec7c137a3588de2ebbc9c83c0f634ba;p=poolifier.git diff --git a/docs/classes/ClusterWorker.html b/docs/classes/ClusterWorker.html index 8c0f1bf2..1d5f2f8b 100644 --- a/docs/classes/ClusterWorker.html +++ b/docs/classes/ClusterWorker.html @@ -1,4 +1,4 @@ -ClusterWorker | poolifier
+ClusterWorker | poolifier - v2.6.36
  • Preparing search index...
  • -
  • The search index is not available
poolifier
+
  • The search index is not available
  • poolifier - v2.6.36
    -
    +
    • poolifier
    • @@ -21,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

    -

    Author

    Christopher Quadflieg

    - -

    Since

    2.0.0

    +

    Since

    2.0.0

    -
    +

    Type Parameters

    -
      +
      • -

        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

      -
    • AbstractWorker<Worker, Data, Response> +
    • AbstractWorker<Worker, Data, Response>
      • ClusterWorker
    +
  • Defined in src/worker/cluster-worker.ts:21
  • @@ -52,424 +55,610 @@ but the minimum number of workers will be guaranteed.

    Constructors

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

        -
        +

        Type Parameters

        -
          -
        • -

          Data = unknown

        • +
          • -

            Response = unknown

        -
        -

        Parameters

        -
          +

          Data = unknown

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

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

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

              Response = unknown

        Parameters

        • -
          data: Data
        -

        Returns Response

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

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

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

    Options for the worker.

  • -

    Returns ClusterWorker<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
    +
  • Defined in src/worker/abstract-worker.ts:85
  • +
    + +
    lastTaskTimestamp: number

    Timestamp of the last task processed by this worker.

    -
    -
    - -
    mainWorker: undefined | null | Worker
    -

    Reference to main worker.

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

    +
    + +
    +
  • Defined in src/worker/cluster-worker.ts:65
  • Methods

    -
    - -
      - +
      + +
        +
      • -
        -

        Returns

        The unique asyncId assigned to the resource.

        +

        Adds a task function to the worker. +If a task function with the same name already exists, it is replaced.

        -

        Returns number

      -
      - -
    +
    + +
      +
    • -

      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.

      +

      Returns number

      The unique asyncId assigned to the resource.

      -

      Since

      v14.8.0, v12.19.0

      +
    +
    + +
      + +
    • +

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

      -
      +

      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 string

    The error message.

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

    Returns void

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

    Input data for the given function.

    +
    message: MessageValue<Data, unknown>
    +

    The received message.

  • -

    Returns void

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

    Task function that will be executed.

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

    Input data for the given function.

    +
    task: Task<Data>
    +

    Input data for the task function.

  • -

    Returns void

    -
    - -
    +
    + +

    Parameters

    +

    Returns Result

  • -
    Optional thisArg: This
    +
    Optional thisArg: This

    The receiver to be used for the function call.

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

    Optional arguments to pass to the function.

    +
    Rest
  • +

    Returns Result

    +
    +

    Since

    v9.6.0

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

    Returns void

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

    Parameters

    Optional
  • -
    Optional thisArg: ThisArg
  • -

    Returns Func & {
        asyncResource: AsyncResource;
    }

    +
    +
    +
    +

    On This Page

    - -
    -

    Generated using TypeDoc

    -
    \ No newline at end of file +
  • constructor
  • +
  • activeInterval
  • +
  • isMain
  • +
  • lastTaskTimestamp
  • +
  • opts
  • +
  • statistics
  • +
  • taskFunctions
  • +
  • id
  • +
  • addTaskFunction
  • +
  • asyncId
  • +
  • bind
  • +
  • emitDestroy
  • +
  • getMainWorker
  • +
  • handleError
  • +
  • handleKillMessage
  • +
  • handleReadyMessage
  • +
  • hasTaskFunction
  • +
  • listTaskFunctions
  • +
  • messageListener
  • +
  • removeTaskFunction
  • +
  • run
  • +
  • runAsync
  • +
  • runInAsyncScope
  • +
  • runSync
  • +
  • sendTaskFunctionsListToMainWorker
  • +
  • sendToMainWorker
  • +
  • setDefaultTaskFunction
  • +
  • triggerAsyncId
  • +
  • bind
  • + +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file