X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FClusterWorker.html;h=0ac4865d24a4757f25900904a46b066b3d7a2746;hb=65ec4e64a4690b019d3ef86c97aa7182b715f539;hp=68e7fd70c8aa38bbc386cb5108caf897939e08fa;hpb=bfed591d93e26b1e424e916abdb27c6f91dc9b45;p=poolifier.git diff --git a/docs/classes/ClusterWorker.html b/docs/classes/ClusterWorker.html index 68e7fd70..0ac4865d 100644 --- a/docs/classes/ClusterWorker.html +++ b/docs/classes/ClusterWorker.html @@ -1,4 +1,4 @@ -ClusterWorker | poolifier
+ClusterWorker | poolifier
  • Preparing search index...
  • -
  • The search index is not available
poolifier
+
  • The search index is not available
  • poolifier
    -
    +
    • poolifier
    • @@ -26,25 +26,25 @@ but the minimum number of workers will be guaranteed.

      Since

      2.0.0

    -
    +

    Type Parameters

    -
      +
      • -

        Data = unknown

        +

        Data = unknown

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

      • -

        Response = unknown

        +

        Response = unknown

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

    Hierarchy

      -
    • AbstractWorker<Worker, Data, Response> +
    • AbstractWorker<Worker, Data, Response>
      • ClusterWorker
    +
  • Defined in src/worker/cluster-worker.ts:21
  • @@ -52,123 +52,122 @@ 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)
      +
      fn: WorkerFunction<Data, Response>

      Function 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>

    Properties

    -
    +
    -
    aliveInterval?: Timeout
    -

    Handler Id of the aliveInterval worker alive check.

    +
    aliveInterval?: Timeout
    +

    Handler id of the aliveInterval worker alive check.

    +
    +
    + +
    isMain: boolean
    +

    Whether this is the main worker or not.

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

    Timestamp of the last task processed by this worker.

    -
    +
  • Defined in src/worker/abstract-worker.ts:32
  • +
    -
    mainWorker: undefined | null | Worker
    -
    - - +
  • Defined in src/worker/abstract-worker.ts:50
  • +
    + +
    opts: WorkerOptions = ...

    Options for the worker.

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

    -
    +
    -
      - +
        +
      • -
        -

        Returns

        The unique asyncId assigned to the resource.

        -
        -

        Returns number

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

        The returned function will have an asyncResource property referencing @@ -176,109 +175,105 @@ 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;
    }

    -
    +
  • Defined in node_modules/.pnpm/@types+node@18.16.0/node_modules/@types/node/async_hooks.d.ts:288
  • +
    -
    -
    +
  • Defined in src/worker/abstract-worker.ts:156
  • +
    -
      - +
        +
      • Call all destroy hooks. This should only ever be called once. An error will be thrown if it is called more than once. This must be manually called. If the resource is left to be collected by the GC then the destroy hooks will never be called.

        - -

        Returns

        A reference to asyncResource.

        -

        Returns ClusterWorker<Data, Response>

    -
    +
  • Defined in node_modules/.pnpm/@types+node@18.16.0/node_modules/@types/node/async_hooks.d.ts:311
  • +
    -
      - +
    -
    +
  • Defined in src/worker/abstract-worker.ts:139
  • +
    -
      - +
        +
      • -
        -

        Inherit Doc

        +

        Handles an error and convert it to a string so it can be sent back to the main worker.

        +

        Parameters

        • -
          e: string | Error
        -

        Returns string

    +

    Returns string

    Message of the error.

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

        Worker message listener.

        +

        Parameters

        • -
          value: MessageValue<Data, Worker>
        • -
        • -
          fn: ((data: Data) => Response)
          -
            -
          • -
              -
            • (data: Data): Response
            • -
            • -
              -

              Parameters

              -
                +
                message: MessageValue<Data, Worker>
                +

                Message received.

                +
              • -
                data: Data
              -

              Returns Response

        +
        fn: WorkerFunction<Data, Response>
        +

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

        +

    Returns void

    -
    +
  • Defined in src/worker/abstract-worker.ts:113
  • +
    -
    -
    +
  • Defined in src/worker/abstract-worker.ts:181
  • +
    -
    -
    +
  • Defined in src/worker/abstract-worker.ts:208
  • +
    -

    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

    +
    -
    -
    +
  • Defined in src/worker/cluster-worker.ts:45
  • +
    -
    -
    +
  • Defined in node_modules/.pnpm/@types+node@18.16.0/node_modules/@types/node/async_hooks.d.ts:320
  • +
    -

    Parameters

    -

    Returns Func & {
        asyncResource: AsyncResource;
    }

    +
    +
    +
    +

    On This Page

    - -
    +
  • constructor
  • +
  • aliveInterval
  • +
  • isMain
  • +
  • lastTaskTimestamp
  • +
  • mainWorker
  • +
  • opts
  • +
  • asyncId
  • +
  • bind
  • +
  • checkAlive
  • +
  • emitDestroy
  • +
  • getMainWorker
  • +
  • handleError
  • +
  • messageListener
  • +
  • run
  • +
  • runAsync
  • +
  • runInAsyncScope
  • +
  • sendToMainWorker
  • +
  • triggerAsyncId
  • +
  • bind
  • + +

    Generated using TypeDoc

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