From d0f1dce33156fdb99f0ca3627839001909419497 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 6 Jan 2022 18:33:01 +0100 Subject: [PATCH] Fix documentation links MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- ...bstractworker.html => AbstractWorker.html} | 22 +++++++++---------- ...{clusterworker.html => ClusterWorker.html} | 18 +++++++-------- ...usterpool.html => DynamicClusterPool.html} | 20 ++++++++--------- ...threadpool.html => DynamicThreadPool.html} | 22 +++++++++---------- ...clusterpool.html => FixedClusterPool.html} | 20 ++++++++--------- ...edthreadpool.html => FixedThreadPool.html} | 22 +++++++++---------- .../{threadworker.html => ThreadWorker.html} | 18 +++++++-------- docs/index.html | 16 +++++++------- ...oloptions.html => ClusterPoolOptions.html} | 14 ++++++------ docs/interfaces/{ipool.html => IPool.html} | 6 ++--- .../interfaces/{iworker.html => IWorker.html} | 10 ++++----- .../{pooloptions.html => PoolOptions.html} | 12 +++++----- ...{workeroptions.html => WorkerOptions.html} | 6 ++--- 13 files changed, 103 insertions(+), 103 deletions(-) rename docs/classes/{abstractworker.html => AbstractWorker.html} (98%) rename docs/classes/{clusterworker.html => ClusterWorker.html} (98%) rename docs/classes/{dynamicclusterpool.html => DynamicClusterPool.html} (96%) rename docs/classes/{dynamicthreadpool.html => DynamicThreadPool.html} (97%) rename docs/classes/{fixedclusterpool.html => FixedClusterPool.html} (96%) rename docs/classes/{fixedthreadpool.html => FixedThreadPool.html} (97%) rename docs/classes/{threadworker.html => ThreadWorker.html} (98%) rename docs/interfaces/{clusterpooloptions.html => ClusterPoolOptions.html} (95%) rename docs/interfaces/{ipool.html => IPool.html} (97%) rename docs/interfaces/{iworker.html => IWorker.html} (97%) rename docs/interfaces/{pooloptions.html => PoolOptions.html} (96%) rename docs/interfaces/{workeroptions.html => WorkerOptions.html} (97%) diff --git a/docs/classes/abstractworker.html b/docs/classes/AbstractWorker.html similarity index 98% rename from docs/classes/abstractworker.html rename to docs/classes/AbstractWorker.html index b1ae0439..8ff6b374 100644 --- a/docs/classes/abstractworker.html +++ b/docs/classes/AbstractWorker.html @@ -6,7 +6,7 @@

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

  • Response = unknown

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

    -
  • Hierarchy

    Index

    Constructors

    constructor

    • new AbstractWorker<MainWorker, Data, Response>(type: string, isMain: boolean, fn: (data: Data) => Response, mainWorker: undefined | null | MainWorker, opts?: WorkerOptions): AbstractWorker<MainWorker, Data, Response>

    Hierarchy

    Index

    Constructors

    constructor

    • new AbstractWorker<MainWorker, Data, Response>(type: string, isMain: boolean, fn: (data: Data) => Response, mainWorker: undefined | null | MainWorker, opts?: WorkerOptions): AbstractWorker<MainWorker, Data, Response>
    • Constructs a new poolifier worker.

      Type parameters

      • MainWorker: Worker | MessagePort

      • Data = unknown

      • Response = unknown

      Parameters

      • type: string

        The type of async event.

        @@ -18,9 +18,9 @@

        Reference to main worker.

      • opts: WorkerOptions = ...

        Options for the worker.

        -

      Returns AbstractWorker<MainWorker, Data, Response>

    Properties

    Protected Optional Readonly aliveInterval

    aliveInterval?: Timeout
    +

    Returns AbstractWorker<MainWorker, Data, Response>

    Properties

    Protected Optional Readonly aliveInterval

    aliveInterval?: Timeout

    Handler Id of the aliveInterval worker alive check.

    -

    Protected lastTaskTimestamp

    lastTaskTimestamp: number
    +

    Protected lastTaskTimestamp

    lastTaskTimestamp: number

    Timestamp of the last task processed by this worker.

    Protected mainWorker

    mainWorker: undefined | null | MainWorker

    Readonly opts

    opts: WorkerOptions = ...

    Methods

    asyncId

    • asyncId(): number
    • Returns number

      The unique asyncId assigned to the resource.

    bind

    • bind<Func>(fn: Func): Func & { asyncResource: AsyncResource }
    • @@ -30,33 +30,33 @@ the AsyncResource to which the function is bound.

      since

      v14.8.0, v12.19.0

      Type parameters

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

      Parameters

      • fn: Func

        The function to bind to the current AsyncResource.

        -

      Returns Func & { asyncResource: AsyncResource }

    Protected checkAlive

    • checkAlive(): void

    Returns Func & { asyncResource: AsyncResource }

    Protected checkAlive

    • checkAlive(): void

    Private checkFunctionInput

    • checkFunctionInput(fn: (data: Data) => Response): void

    Private checkFunctionInput

    • checkFunctionInput(fn: (data: Data) => Response): void
    • Check if the fn parameter is passed to the constructor.

      Parameters

      • fn: (data: Data) => Response

        The function that should be defined.

        -
          • (data: Data): Response
          • Parameters

            • data: Data

            Returns Response

      Returns void

    Private checkWorkerOptions

    emitDestroy

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

          • data: Data

          Returns Response

    Returns void

    Private checkWorkerOptions

    emitDestroy

    • 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 AbstractWorker<MainWorker, Data, Response>

      A reference to asyncResource.

      -

    Protected getMainWorker

    • getMainWorker(): MainWorker

    Protected getMainWorker

    • getMainWorker(): MainWorker

    Protected handleError

    • handleError(e: string | Error): string

    Protected handleError

    • handleError(e: string | Error): string
    • Handle an error and convert it to a string so it can be sent back to the main worker.

      Parameters

      • e: string | Error

        The error raised by the worker.

      Returns string

      Message of the error.

      -

    Protected run

    • run(fn: (data?: Data) => Response, value: MessageValue<Data, unknown>): void

    Protected run

    • run(fn: (data?: Data) => Response, value: MessageValue<Data, unknown>): void
    • Run the given function synchronously.

      Parameters

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

        Function that will be executed.

          • (data?: Data): Response
          • Parameters

            • Optional data: Data

            Returns Response

      • value: MessageValue<Data, unknown>

        Input data for the given function.

        -

      Returns void

    Protected runAsync

    • runAsync(fn: (data?: Data) => Promise<Response>, value: MessageValue<Data, unknown>): void

    Returns void

    Protected runAsync

    • runAsync(fn: (data?: Data) => Promise<Response>, value: MessageValue<Data, unknown>): void
    • Run the given function asynchronously.

      Parameters

      • fn: (data?: Data) => Promise<Response>

        Function that will be executed.

        @@ -74,7 +74,7 @@ then restore the original execution context.

        The receiver to be used for the function call.

      • Rest ...args: any[]

        Optional arguments to pass to the function.

        -

      Returns Result

    Protected Abstract sendToMainWorker

    • sendToMainWorker(message: MessageValue<Response, unknown>): void

    Returns Result

    Protected Abstract sendToMainWorker

    • sendToMainWorker(message: MessageValue<Response, unknown>): void
    • Send a message to the main worker.

      Parameters

      • message: MessageValue<Response, unknown>

        The response message.

        diff --git a/docs/classes/clusterworker.html b/docs/classes/ClusterWorker.html similarity index 98% rename from docs/classes/clusterworker.html rename to docs/classes/ClusterWorker.html index a0efa1b7..ea6c5d88 100644 --- a/docs/classes/clusterworker.html +++ b/docs/classes/ClusterWorker.html @@ -8,15 +8,15 @@ but the minimum number of workers will be guaranteed.

        template ResponseType

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

        author

        Christopher Quadflieg

        since

        2.0.0

        -

    Type parameters

    • Data = unknown

    • Response = unknown

    Hierarchy

    Index

    Constructors

    constructor

    Type parameters

    • Data = unknown

    • Response = unknown

    Hierarchy

    Index

    Constructors

    constructor

    • Constructs a new poolifier cluster worker.

      Type parameters

      • Data = unknown

      • Response = unknown

      Parameters

      • 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

      • opts: WorkerOptions = {}

        Options for the worker.

        -

      Returns ClusterWorker<Data, Response>

    Properties

    Protected Optional Readonly aliveInterval

    aliveInterval?: Timeout
    +

    Returns ClusterWorker<Data, Response>

    Properties

    Protected Optional Readonly aliveInterval

    aliveInterval?: Timeout

    Handler Id of the aliveInterval worker alive check.

    -

    Protected lastTaskTimestamp

    lastTaskTimestamp: number
    +

    Protected lastTaskTimestamp

    lastTaskTimestamp: number

    Timestamp of the last task processed by this worker.

    Protected mainWorker

    mainWorker: undefined | null | Worker

    Readonly opts

    opts: WorkerOptions = ...

    Methods

    asyncId

    • asyncId(): number
    • Returns number

      The unique asyncId assigned to the resource.

    bind

    • bind<Func>(fn: Func): Func & { asyncResource: AsyncResource }
    • @@ -26,7 +26,7 @@ the AsyncResource to which the function is bound.

      since

      v14.8.0, v12.19.0

      Type parameters

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

      Parameters

      • fn: Func

        The function to bind to the current AsyncResource.

        -

      Returns Func & { asyncResource: AsyncResource }

    Protected checkAlive

    • checkAlive(): void

    Returns Func & { asyncResource: AsyncResource }

    Protected checkAlive

    • checkAlive(): void

    emitDestroy

    • Call all destroy hooks. This should only ever be called once. An error will @@ -34,21 +34,21 @@ be thrown if it is called more than once. This must be manually the resource is left to be collected by the GC then the destroy hooks will never be called.

      Returns ClusterWorker<Data, Response>

      A reference to asyncResource.

      -

    Protected getMainWorker

    • getMainWorker(): Worker

    Protected getMainWorker

    • getMainWorker(): Worker

    Protected handleError

    • handleError(e: string | Error): string

    Protected handleError

    • handleError(e: string | Error): string

    Protected run

    • run(fn: (data?: Data) => Response, value: MessageValue<Data, unknown>): void

    Protected run

    • run(fn: (data?: Data) => Response, value: MessageValue<Data, unknown>): void
    • Run the given function synchronously.

      Parameters

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

        Function that will be executed.

          • (data?: Data): Response
          • Parameters

            • Optional data: Data

            Returns Response

      • value: MessageValue<Data, unknown>

        Input data for the given function.

        -

      Returns void

    Protected runAsync

    • runAsync(fn: (data?: Data) => Promise<Response>, value: MessageValue<Data, unknown>): void

    Returns void

    Protected runAsync

    • runAsync(fn: (data?: Data) => Promise<Response>, value: MessageValue<Data, unknown>): void
    • Run the given function asynchronously.

      Parameters

      • fn: (data?: Data) => Promise<Response>

        Function that will be executed.

        @@ -66,7 +66,7 @@ then restore the original execution context.

        The receiver to be used for the function call.

      • Rest ...args: any[]

        Optional arguments to pass to the function.

        -

      Returns Result

    Protected sendToMainWorker

    • sendToMainWorker(message: MessageValue<Response, unknown>): void

    Returns Result

    Protected sendToMainWorker

    • sendToMainWorker(message: MessageValue<Response, unknown>): void
    • Send a message to the main worker.

      Parameters

      • message: MessageValue<Response, unknown>

        The response message.

        diff --git a/docs/classes/dynamicclusterpool.html b/docs/classes/DynamicClusterPool.html similarity index 96% rename from docs/classes/dynamicclusterpool.html rename to docs/classes/DynamicClusterPool.html index 90137110..50217700 100644 --- a/docs/classes/dynamicclusterpool.html +++ b/docs/classes/DynamicClusterPool.html @@ -6,7 +6,7 @@ When the maximum number of workers is reached, an event is emitted. If you want
        template ResponseType

        of response of execution. This can only be serializable data.

        author

        Christopher Quadflieg

        since

        2.0.0

        -

    Type parameters

    • Data = unknown

    • Response = unknown

    Hierarchy

    Index

    Constructors

    constructor

    Type parameters

    • Data = unknown

    • Response = unknown

    Hierarchy

    Index

    Constructors

    constructor

    • Constructs a new poolifier dynamic cluster pool.

      Type parameters

      • Data = unknown

      • Response = unknown

      Parameters

      • min: number

        Minimum number of workers which are always active.

        @@ -14,38 +14,38 @@ When the maximum number of workers is reached, an event is emitted. If you want

        Maximum number of workers that can be created by this pool.

      • filePath: string

        Path to an implementation of a ClusterWorker file, which can be relative or absolute.

        -
      • opts: ClusterPoolOptions = {}

      Returns DynamicClusterPool<Data, Response>

    Properties

    Optional Readonly emitter

    emitter?: PoolEmitter

    Readonly filePath

    filePath: string

    Readonly max

    max: number

    Protected nextMessageId

    nextMessageId: number = 0
    +
  • opts: ClusterPoolOptions = {}
  • Returns DynamicClusterPool<Data, Response>

    Properties

    Optional Readonly emitter

    emitter?: PoolEmitter

    Readonly filePath

    filePath: string

    Readonly max

    max: number

    Protected nextMessageId

    nextMessageId: number = 0

    Id of the next message.

    -

    Readonly numberOfWorkers

    numberOfWorkers: number

    Readonly opts

    Protected promiseMap

    promiseMap: Map<number, PromiseWorkerResponseWrapper<Worker, Response>> = ...
    +

    Readonly numberOfWorkers

    numberOfWorkers: number

    Readonly opts

    Protected promiseMap

    promiseMap: Map<number, PromiseWorkerResponseWrapper<Worker, Response>> = ...

    The promise map.

    • key: This is the message Id of each submitted task.
    • value: An object that contains the worker, the resolve function and the reject function.

    When we receive a message from the worker we get a map entry and resolve/reject the promise based on the message.

    -

    Readonly tasks

    tasks: Map<Worker, number> = ...

    Protected workerChoiceStrategyContext

    workerChoiceStrategyContext: WorkerChoiceStrategyContext<Worker, Data, Response>
    +

    Readonly tasks

    tasks: Map<Worker, number> = ...

    Protected workerChoiceStrategyContext

    workerChoiceStrategyContext: WorkerChoiceStrategyContext<Worker, Data, Response>

    Worker choice strategy instance implementing the worker choice algorithm.

    Default to a strategy implementing a round robin algorithm.

    -

    Readonly workers

    workers: Worker[] = []

    Accessors

    busy

    • get busy(): boolean

    numberOfRunningTasks

    • get numberOfRunningTasks(): number

    type

    • get type(): PoolType

    Methods

    Protected afterWorkerSetup

    • afterWorkerSetup(worker: Worker): void

    Protected chooseWorker

    • chooseWorker(): Worker

    Readonly workers

    workers: Worker[] = []

    Accessors

    busy

    • get busy(): boolean

    numberOfRunningTasks

    • get numberOfRunningTasks(): number

    type

    • get type(): PoolType

    Methods

    Protected afterWorkerSetup

    • afterWorkerSetup(worker: Worker): void

    Protected chooseWorker

    • chooseWorker(): Worker

    Protected createAndSetupWorker

    • createAndSetupWorker(): Worker

    Protected createAndSetupWorker

    • createAndSetupWorker(): Worker

    Protected createWorker

    • createWorker(): Worker

    Protected decreaseWorkersTasks

    • decreaseWorkersTasks(worker: Worker): void

    Protected createWorker

    • createWorker(): Worker

    Protected decreaseWorkersTasks

    • decreaseWorkersTasks(worker: Worker): void

    destroy

    • destroy(): Promise<void>

    destroyWorker

    • destroyWorker(worker: Worker): void

    execute

    • execute(data: Data): Promise<Response>

    findFreeTasksMapEntry

    • findFreeTasksMapEntry(): false | [Worker, number]

    Protected increaseWorkersTask

    • increaseWorkersTask(worker: Worker): void

    Returns void

    destroy

    • destroy(): Promise<void>

    destroyWorker

    • destroyWorker(worker: Worker): void

    execute

    • execute(data: Data): Promise<Response>

    findFreeTasksMapEntry

    • findFreeTasksMapEntry(): false | [Worker, number]

    Protected increaseWorkersTask

    • increaseWorkersTask(worker: Worker): void

    Protected internalExecute

    • internalExecute(worker: Worker, messageId: number): Promise<Response>

    Protected internalGetBusyStatus

    • internalGetBusyStatus(): boolean

    Protected isMain

    • isMain(): boolean

    registerWorkerMessageListener

    • registerWorkerMessageListener<Message>(worker: Worker, listener: (message: MessageValue<Message, unknown>) => void): void

    Protected removeWorker

    • removeWorker(worker: Worker): void

    Returns void

    Protected internalExecute

    • internalExecute(worker: Worker, messageId: number): Promise<Response>

    Protected internalGetBusyStatus

    • internalGetBusyStatus(): boolean

    Protected isMain

    • isMain(): boolean

    registerWorkerMessageListener

    • registerWorkerMessageListener<Message>(worker: Worker, listener: (message: MessageValue<Message, unknown>) => void): void

    Protected removeWorker

    • removeWorker(worker: Worker): void

    Protected sendToWorker

    • sendToWorker(worker: Worker, message: MessageValue<Data, unknown>): void

    setWorkerChoiceStrategy

    • setWorkerChoiceStrategy(workerChoiceStrategy: "ROUND_ROBIN" | "LESS_RECENTLY_USED"): void

    Protected setupHook

    • setupHook(): void

    Protected workerListener

    • workerListener(): (message: MessageValue<Response, unknown>) => void

    Returns void

    Protected sendToWorker

    • sendToWorker(worker: Worker, message: MessageValue<Data, unknown>): void

    setWorkerChoiceStrategy

    • setWorkerChoiceStrategy(workerChoiceStrategy: "ROUND_ROBIN" | "LESS_RECENTLY_USED"): void

    Protected setupHook

    • setupHook(): void

    Protected workerListener

    • workerListener(): (message: MessageValue<Response, unknown>) => void
    • This function is the listener registered for each worker.

      Returns (message: MessageValue<Response, unknown>) => void

      The listener function to execute when a message is sent from a worker.

        • (message: MessageValue<Response, unknown>): void
        • diff --git a/docs/classes/dynamicthreadpool.html b/docs/classes/DynamicThreadPool.html similarity index 97% rename from docs/classes/dynamicthreadpool.html rename to docs/classes/DynamicThreadPool.html index 4aa63803..6910150b 100644 --- a/docs/classes/dynamicthreadpool.html +++ b/docs/classes/DynamicThreadPool.html @@ -6,7 +6,7 @@ When the maximum number of threads is reached, an event is emitted. If you want
          template ResponseType

          of response of execution. This can only be serializable data.

          author

          Alessandro Pio Ardizio

          since

          0.0.1

          -

    Type parameters

    • Data = unknown

    • Response = unknown

    Hierarchy

    Index

    Constructors

    constructor

    Type parameters

    • Data = unknown

    • Response = unknown

    Hierarchy

    Index

    Constructors

    constructor

    • Constructs a new poolifier dynamic thread pool.

      Type parameters

      • Data = unknown

      • Response = unknown

      Parameters

      • min: number

        Minimum number of threads which are always active.

        @@ -14,41 +14,41 @@ When the maximum number of threads is reached, an event is emitted. If you want

        Maximum number of threads that can be created by this pool.

      • filePath: string

        Path to an implementation of a ThreadWorker file, which can be relative or absolute.

        -
      • opts: PoolOptions<ThreadWorkerWithMessageChannel> = {}

      Returns DynamicThreadPool<Data, Response>

    Properties

    Optional Readonly emitter

    emitter?: PoolEmitter

    Readonly filePath

    filePath: string

    Readonly max

    max: number

    Protected nextMessageId

    nextMessageId: number = 0
    +
  • opts: PoolOptions<ThreadWorkerWithMessageChannel> = {}
  • Returns DynamicThreadPool<Data, Response>

    Properties

    Optional Readonly emitter

    emitter?: PoolEmitter

    Readonly filePath

    filePath: string

    Readonly max

    max: number

    Protected nextMessageId

    nextMessageId: number = 0

    Id of the next message.

    -

    Readonly numberOfWorkers

    numberOfWorkers: number

    Readonly opts

    Protected promiseMap

    promiseMap: Map<number, PromiseWorkerResponseWrapper<ThreadWorkerWithMessageChannel, Response>> = ...
    +

    Readonly numberOfWorkers

    numberOfWorkers: number

    Readonly opts

    Protected promiseMap

    promiseMap: Map<number, PromiseWorkerResponseWrapper<ThreadWorkerWithMessageChannel, Response>> = ...

    The promise map.

    • key: This is the message Id of each submitted task.
    • value: An object that contains the worker, the resolve function and the reject function.

    When we receive a message from the worker we get a map entry and resolve/reject the promise based on the message.

    -

    Readonly tasks

    tasks: Map<ThreadWorkerWithMessageChannel, number> = ...

    Protected workerChoiceStrategyContext

    workerChoiceStrategyContext: WorkerChoiceStrategyContext<ThreadWorkerWithMessageChannel, Data, Response>
    +

    Readonly tasks

    tasks: Map<ThreadWorkerWithMessageChannel, number> = ...

    Protected workerChoiceStrategyContext

    workerChoiceStrategyContext: WorkerChoiceStrategyContext<ThreadWorkerWithMessageChannel, Data, Response>

    Worker choice strategy instance implementing the worker choice algorithm.

    Default to a strategy implementing a round robin algorithm.

    -

    Readonly workers

    Accessors

    busy

    • get busy(): boolean

    numberOfRunningTasks

    • get numberOfRunningTasks(): number

    type

    • get type(): PoolType

    Methods

    Protected afterWorkerSetup

    Protected chooseWorker

    Readonly workers

    Accessors

    busy

    • get busy(): boolean

    numberOfRunningTasks

    • get numberOfRunningTasks(): number

    type

    • get type(): PoolType

    Methods

    Protected afterWorkerSetup

    Protected chooseWorker

    Protected createAndSetupWorker

    Protected createAndSetupWorker

    Protected createWorker

    Protected decreaseWorkersTasks

    Protected createWorker

    Protected decreaseWorkersTasks

    destroy

    • destroy(): Promise<void>

    destroyWorker

    execute

    • execute(data: Data): Promise<Response>

    findFreeTasksMapEntry

    Protected increaseWorkersTask

    Returns void

    destroy

    • destroy(): Promise<void>

    destroyWorker

    execute

    • execute(data: Data): Promise<Response>

    findFreeTasksMapEntry

    Protected increaseWorkersTask

    Protected internalExecute

    Protected internalGetBusyStatus

    • internalGetBusyStatus(): boolean

    Protected isMain

    • isMain(): boolean

    registerWorkerMessageListener

    • registerWorkerMessageListener<Message>(messageChannel: ThreadWorkerWithMessageChannel, listener: (message: MessageValue<Message, unknown>) => void): void

    Protected removeWorker

    Returns void

    Protected internalExecute

    Protected internalGetBusyStatus

    • internalGetBusyStatus(): boolean

    Protected isMain

    • isMain(): boolean

    registerWorkerMessageListener

    • registerWorkerMessageListener<Message>(messageChannel: ThreadWorkerWithMessageChannel, listener: (message: MessageValue<Message, unknown>) => void): void

    Protected removeWorker

    Protected sendToWorker

    setWorkerChoiceStrategy

    • setWorkerChoiceStrategy(workerChoiceStrategy: "ROUND_ROBIN" | "LESS_RECENTLY_USED"): void

    Protected setupHook

    • setupHook(): void

    Returns void

    Protected sendToWorker

    setWorkerChoiceStrategy

    • setWorkerChoiceStrategy(workerChoiceStrategy: "ROUND_ROBIN" | "LESS_RECENTLY_USED"): void

    Protected setupHook

    • setupHook(): void

    Protected workerListener

    • workerListener(): (message: MessageValue<Response, unknown>) => void

    Protected workerListener

    • workerListener(): (message: MessageValue<Response, unknown>) => void
    • This function is the listener registered for each worker.

      Returns (message: MessageValue<Response, unknown>) => void

      The listener function to execute when a message is sent from a worker.

        • (message: MessageValue<Response, unknown>): void
        • diff --git a/docs/classes/fixedclusterpool.html b/docs/classes/FixedClusterPool.html similarity index 96% rename from docs/classes/fixedclusterpool.html rename to docs/classes/FixedClusterPool.html index 46ba3f75..7a604f57 100644 --- a/docs/classes/fixedclusterpool.html +++ b/docs/classes/FixedClusterPool.html @@ -6,44 +6,44 @@
          template ResponseType

          of response of execution. This can only be serializable data.

          author

          Christopher Quadflieg

          since

          2.0.0

          -

    Type parameters

    • Data = unknown

    • Response = unknown

    Hierarchy

    Index

    Constructors

    constructor

    Type parameters

    • Data = unknown

    • Response = unknown

    Hierarchy

    Index

    Constructors

    constructor

    • Constructs a new poolifier fixed cluster pool.

      Type parameters

      • Data = unknown

      • Response = unknown

      Parameters

      • numberOfWorkers: number

        Number of workers for this pool.

      • filePath: string

        Path to an implementation of a ClusterWorker file, which can be relative or absolute.

        -
      • opts: ClusterPoolOptions = {}

      Returns FixedClusterPool<Data, Response>

    Properties

    Optional Readonly emitter

    emitter?: PoolEmitter
    inheritdoc

    Readonly filePath

    filePath: string

    Optional Readonly max

    max?: number
    inheritdoc

    Protected nextMessageId

    nextMessageId: number = 0
    +
  • opts: ClusterPoolOptions = {}
  • Returns FixedClusterPool<Data, Response>

    Properties

    Optional Readonly emitter

    emitter?: PoolEmitter
    inheritdoc

    Readonly filePath

    filePath: string

    Optional Readonly max

    max?: number
    inheritdoc

    Protected nextMessageId

    nextMessageId: number = 0

    Id of the next message.

    -

    Readonly numberOfWorkers

    numberOfWorkers: number

    Readonly opts

    Protected promiseMap

    promiseMap: Map<number, PromiseWorkerResponseWrapper<Worker, Response>> = ...
    +

    Readonly numberOfWorkers

    numberOfWorkers: number

    Readonly opts

    Protected promiseMap

    promiseMap: Map<number, PromiseWorkerResponseWrapper<Worker, Response>> = ...

    The promise map.

    • key: This is the message Id of each submitted task.
    • value: An object that contains the worker, the resolve function and the reject function.

    When we receive a message from the worker we get a map entry and resolve/reject the promise based on the message.

    -

    Readonly tasks

    tasks: Map<Worker, number> = ...
    inheritdoc

    Protected workerChoiceStrategyContext

    workerChoiceStrategyContext: WorkerChoiceStrategyContext<Worker, Data, Response>
    +

    Readonly tasks

    tasks: Map<Worker, number> = ...
    inheritdoc

    Protected workerChoiceStrategyContext

    workerChoiceStrategyContext: WorkerChoiceStrategyContext<Worker, Data, Response>

    Worker choice strategy instance implementing the worker choice algorithm.

    Default to a strategy implementing a round robin algorithm.

    -

    Readonly workers

    workers: Worker[] = []
    inheritdoc

    Accessors

    busy

    • get busy(): boolean

    numberOfRunningTasks

    • get numberOfRunningTasks(): number

    type

    • get type(): PoolType

    Methods

    Protected afterWorkerSetup

    • afterWorkerSetup(worker: Worker): void

    Protected chooseWorker

    • chooseWorker(): Worker

    Readonly workers

    workers: Worker[] = []
    inheritdoc

    Accessors

    busy

    • get busy(): boolean

    numberOfRunningTasks

    • get numberOfRunningTasks(): number

    type

    • get type(): PoolType

    Methods

    Protected afterWorkerSetup

    • afterWorkerSetup(worker: Worker): void

    Protected chooseWorker

    • chooseWorker(): Worker
    • Choose a worker for the next task.

      The default implementation uses a round robin algorithm to distribute the load.

      Returns Worker

      Worker.

      -

    Protected createAndSetupWorker

    • createAndSetupWorker(): Worker

    Protected createAndSetupWorker

    • createAndSetupWorker(): Worker
    • Creates a new worker for this pool and sets it up completely.

      Returns Worker

      New, completely set up worker.

      -

    Protected createWorker

    • createWorker(): Worker

    Protected decreaseWorkersTasks

    • decreaseWorkersTasks(worker: Worker): void

    Protected createWorker

    • createWorker(): Worker

    Protected decreaseWorkersTasks

    • decreaseWorkersTasks(worker: Worker): void
    • Decrease the number of tasks that the given worker has applied.

      Parameters

      • worker: Worker

        Worker whose tasks are decreased.

        -

      Returns void

    destroy

    • destroy(): Promise<void>

    destroyWorker

    • destroyWorker(worker: Worker): void

    execute

    • execute(data: Data): Promise<Response>

    findFreeTasksMapEntry

    • findFreeTasksMapEntry(): false | [Worker, number]

    Protected increaseWorkersTask

    • increaseWorkersTask(worker: Worker): void

    Returns void

    destroy

    • destroy(): Promise<void>

    destroyWorker

    • destroyWorker(worker: Worker): void

    execute

    • execute(data: Data): Promise<Response>

    findFreeTasksMapEntry

    • findFreeTasksMapEntry(): false | [Worker, number]

    Protected increaseWorkersTask

    • increaseWorkersTask(worker: Worker): void
    • Increase the number of tasks that the given worker has applied.

      Parameters

      • worker: Worker

        Worker whose tasks are increased.

        -

      Returns void

    Protected internalExecute

    • internalExecute(worker: Worker, messageId: number): Promise<Response>
    • Parameters

      • worker: Worker
      • messageId: number

      Returns Promise<Response>

    Protected internalGetBusyStatus

    • internalGetBusyStatus(): boolean

    Protected isMain

    • isMain(): boolean

    registerWorkerMessageListener

    • registerWorkerMessageListener<Message>(worker: Worker, listener: (message: MessageValue<Message, unknown>) => void): void
    • inheritdoc

      Type parameters

      • Message

      Parameters

      • worker: Worker
      • listener: (message: MessageValue<Message, unknown>) => void
          • (message: MessageValue<Message, unknown>): void
          • Parameters

            • message: MessageValue<Message, unknown>

            Returns void

      Returns void

    Protected removeWorker

    • removeWorker(worker: Worker): void

    Returns void

    Protected internalExecute

    • internalExecute(worker: Worker, messageId: number): Promise<Response>
    • Parameters

      • worker: Worker
      • messageId: number

      Returns Promise<Response>

    Protected internalGetBusyStatus

    • internalGetBusyStatus(): boolean

    Protected isMain

    • isMain(): boolean

    registerWorkerMessageListener

    • registerWorkerMessageListener<Message>(worker: Worker, listener: (message: MessageValue<Message, unknown>) => void): void
    • inheritdoc

      Type parameters

      • Message

      Parameters

      • worker: Worker
      • listener: (message: MessageValue<Message, unknown>) => void
          • (message: MessageValue<Message, unknown>): void
          • Parameters

            • message: MessageValue<Message, unknown>

            Returns void

      Returns void

    Protected removeWorker

    • removeWorker(worker: Worker): void
    • Removes the given worker from the pool.

      Parameters

      • worker: Worker

        Worker that will be removed.

        -

      Returns void

    Protected sendToWorker

    • sendToWorker(worker: Worker, message: MessageValue<Data, unknown>): void
    • inheritdoc

      Parameters

      • worker: Worker
      • message: MessageValue<Data, unknown>

      Returns void

    setWorkerChoiceStrategy

    • setWorkerChoiceStrategy(workerChoiceStrategy: "ROUND_ROBIN" | "LESS_RECENTLY_USED"): void
    • inheritdoc

      Parameters

      • workerChoiceStrategy: "ROUND_ROBIN" | "LESS_RECENTLY_USED"

      Returns void

    Protected setupHook

    • setupHook(): void

    Protected workerListener

    • workerListener(): (message: MessageValue<Response, unknown>) => void

    Returns void

    Protected sendToWorker

    • sendToWorker(worker: Worker, message: MessageValue<Data, unknown>): void
    • inheritdoc

      Parameters

      • worker: Worker
      • message: MessageValue<Data, unknown>

      Returns void

    setWorkerChoiceStrategy

    • setWorkerChoiceStrategy(workerChoiceStrategy: "ROUND_ROBIN" | "LESS_RECENTLY_USED"): void
    • inheritdoc

      Parameters

      • workerChoiceStrategy: "ROUND_ROBIN" | "LESS_RECENTLY_USED"

      Returns void

    Protected setupHook

    • setupHook(): void

    Protected workerListener

    • workerListener(): (message: MessageValue<Response, unknown>) => void
    • This function is the listener registered for each worker.

      Returns (message: MessageValue<Response, unknown>) => void

      The listener function to execute when a message is sent from a worker.

        • (message: MessageValue<Response, unknown>): void
        • diff --git a/docs/classes/fixedthreadpool.html b/docs/classes/FixedThreadPool.html similarity index 97% rename from docs/classes/fixedthreadpool.html rename to docs/classes/FixedThreadPool.html index 28730582..de188c51 100644 --- a/docs/classes/fixedthreadpool.html +++ b/docs/classes/FixedThreadPool.html @@ -6,47 +6,47 @@
          template ResponseType

          of response of execution. This can only be serializable data.

          author

          Alessandro Pio Ardizio

          since

          0.0.1

          -

    Type parameters

    • Data = unknown

    • Response = unknown

    Hierarchy

    Index

    Constructors

    constructor

    Type parameters

    • Data = unknown

    • Response = unknown

    Hierarchy

    Index

    Constructors

    constructor

    • Constructs a new poolifier fixed thread pool.

      Type parameters

      • Data = unknown

      • Response = unknown

      Parameters

      • numberOfThreads: number

        Number of threads for this pool.

      • filePath: string

        Path to an implementation of a ThreadWorker file, which can be relative or absolute.

        -
      • opts: PoolOptions<ThreadWorkerWithMessageChannel> = {}

      Returns FixedThreadPool<Data, Response>

    Properties

    Optional Readonly emitter

    emitter?: PoolEmitter
    inheritdoc

    Readonly filePath

    filePath: string

    Optional Readonly max

    max?: number
    inheritdoc

    Protected nextMessageId

    nextMessageId: number = 0
    +
  • opts: PoolOptions<ThreadWorkerWithMessageChannel> = {}
  • Returns FixedThreadPool<Data, Response>

    Properties

    Optional Readonly emitter

    emitter?: PoolEmitter
    inheritdoc

    Readonly filePath

    filePath: string

    Optional Readonly max

    max?: number
    inheritdoc

    Protected nextMessageId

    nextMessageId: number = 0

    Id of the next message.

    -

    Readonly numberOfWorkers

    numberOfWorkers: number

    Readonly opts

    Protected promiseMap

    promiseMap: Map<number, PromiseWorkerResponseWrapper<ThreadWorkerWithMessageChannel, Response>> = ...
    +

    Readonly numberOfWorkers

    numberOfWorkers: number

    Readonly opts

    Protected promiseMap

    promiseMap: Map<number, PromiseWorkerResponseWrapper<ThreadWorkerWithMessageChannel, Response>> = ...

    The promise map.

    • key: This is the message Id of each submitted task.
    • value: An object that contains the worker, the resolve function and the reject function.

    When we receive a message from the worker we get a map entry and resolve/reject the promise based on the message.

    -

    Readonly tasks

    tasks: Map<ThreadWorkerWithMessageChannel, number> = ...
    inheritdoc

    Protected workerChoiceStrategyContext

    workerChoiceStrategyContext: WorkerChoiceStrategyContext<ThreadWorkerWithMessageChannel, Data, Response>
    +

    Readonly tasks

    tasks: Map<ThreadWorkerWithMessageChannel, number> = ...
    inheritdoc

    Protected workerChoiceStrategyContext

    workerChoiceStrategyContext: WorkerChoiceStrategyContext<ThreadWorkerWithMessageChannel, Data, Response>

    Worker choice strategy instance implementing the worker choice algorithm.

    Default to a strategy implementing a round robin algorithm.

    -

    Readonly workers

    inheritdoc

    Accessors

    busy

    • get busy(): boolean

    numberOfRunningTasks

    • get numberOfRunningTasks(): number

    type

    • get type(): PoolType

    Methods

    Protected afterWorkerSetup

    Protected chooseWorker

    Readonly workers

    inheritdoc

    Accessors

    busy

    • get busy(): boolean

    numberOfRunningTasks

    • get numberOfRunningTasks(): number

    type

    • get type(): PoolType

    Methods

    Protected afterWorkerSetup

    Protected chooseWorker

    Protected createAndSetupWorker

    Protected createAndSetupWorker

    Protected createWorker

    Protected decreaseWorkersTasks

    Protected createWorker

    Protected decreaseWorkersTasks

    destroy

    • destroy(): Promise<void>

    destroyWorker

    execute

    • execute(data: Data): Promise<Response>

    findFreeTasksMapEntry

    Protected increaseWorkersTask

    Returns void

    destroy

    • destroy(): Promise<void>

    destroyWorker

    execute

    • execute(data: Data): Promise<Response>

    findFreeTasksMapEntry

    Protected increaseWorkersTask

    Protected internalExecute

    Protected internalGetBusyStatus

    • internalGetBusyStatus(): boolean

    Protected isMain

    • isMain(): boolean

    registerWorkerMessageListener

    • registerWorkerMessageListener<Message>(messageChannel: ThreadWorkerWithMessageChannel, listener: (message: MessageValue<Message, unknown>) => void): void
    • inheritdoc

      Type parameters

      • Message

      Parameters

      • messageChannel: ThreadWorkerWithMessageChannel
      • listener: (message: MessageValue<Message, unknown>) => void
          • (message: MessageValue<Message, unknown>): void
          • Parameters

            • message: MessageValue<Message, unknown>

            Returns void

      Returns void

    Protected removeWorker

    Returns void

    Protected internalExecute

    Protected internalGetBusyStatus

    • internalGetBusyStatus(): boolean

    Protected isMain

    • isMain(): boolean

    registerWorkerMessageListener

    • registerWorkerMessageListener<Message>(messageChannel: ThreadWorkerWithMessageChannel, listener: (message: MessageValue<Message, unknown>) => void): void
    • inheritdoc

      Type parameters

      • Message

      Parameters

      • messageChannel: ThreadWorkerWithMessageChannel
      • listener: (message: MessageValue<Message, unknown>) => void
          • (message: MessageValue<Message, unknown>): void
          • Parameters

            • message: MessageValue<Message, unknown>

            Returns void

      Returns void

    Protected removeWorker

    Protected sendToWorker

    setWorkerChoiceStrategy

    • setWorkerChoiceStrategy(workerChoiceStrategy: "ROUND_ROBIN" | "LESS_RECENTLY_USED"): void
    • inheritdoc

      Parameters

      • workerChoiceStrategy: "ROUND_ROBIN" | "LESS_RECENTLY_USED"

      Returns void

    Protected setupHook

    • setupHook(): void

    Returns void

    Protected sendToWorker

    setWorkerChoiceStrategy

    • setWorkerChoiceStrategy(workerChoiceStrategy: "ROUND_ROBIN" | "LESS_RECENTLY_USED"): void
    • inheritdoc

      Parameters

      • workerChoiceStrategy: "ROUND_ROBIN" | "LESS_RECENTLY_USED"

      Returns void

    Protected setupHook

    • setupHook(): void
    • Setup hook that can be overridden by a Poolifier pool implementation to run code before workers are created in the abstract constructor.

      -

      Returns void

    Protected workerListener

    • workerListener(): (message: MessageValue<Response, unknown>) => void

    Protected workerListener

    • workerListener(): (message: MessageValue<Response, unknown>) => void
    • This function is the listener registered for each worker.

      Returns (message: MessageValue<Response, unknown>) => void

      The listener function to execute when a message is sent from a worker.

        • (message: MessageValue<Response, unknown>): void
        • diff --git a/docs/classes/threadworker.html b/docs/classes/ThreadWorker.html similarity index 98% rename from docs/classes/threadworker.html rename to docs/classes/ThreadWorker.html index 08ea47f8..e90d1519 100644 --- a/docs/classes/threadworker.html +++ b/docs/classes/ThreadWorker.html @@ -8,15 +8,15 @@ but the minimum number of workers will be guaranteed.

          template ResponseType

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

          author

          Alessandro Pio Ardizio

          since

          0.0.1

          -

    Type parameters

    • Data = unknown

    • Response = unknown

    Hierarchy

    Index

    Constructors

    constructor

    Type parameters

    • Data = unknown

    • Response = unknown

    Hierarchy

    Index

    Constructors

    constructor

    • Constructs a new poolifier thread worker.

      Type parameters

      • Data = unknown

      • Response = unknown

      Parameters

      • 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

      • opts: WorkerOptions = {}

        Options for the worker.

        -

      Returns ThreadWorker<Data, Response>

    Properties

    Protected Optional Readonly aliveInterval

    aliveInterval?: Timeout
    +

    Returns ThreadWorker<Data, Response>

    Properties

    Protected Optional Readonly aliveInterval

    aliveInterval?: Timeout

    Handler Id of the aliveInterval worker alive check.

    -

    Protected lastTaskTimestamp

    lastTaskTimestamp: number
    +

    Protected lastTaskTimestamp

    lastTaskTimestamp: number

    Timestamp of the last task processed by this worker.

    Protected mainWorker

    mainWorker: undefined | null | MessagePort

    Readonly opts

    opts: WorkerOptions = ...

    Methods

    asyncId

    • asyncId(): number
    • Returns number

      The unique asyncId assigned to the resource.

    bind

    • bind<Func>(fn: Func): Func & { asyncResource: AsyncResource }
    • @@ -26,7 +26,7 @@ the AsyncResource to which the function is bound.

      since

      v14.8.0, v12.19.0

      Type parameters

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

      Parameters

      • fn: Func

        The function to bind to the current AsyncResource.

        -

      Returns Func & { asyncResource: AsyncResource }

    Protected checkAlive

    • checkAlive(): void

    Returns Func & { asyncResource: AsyncResource }

    Protected checkAlive

    • checkAlive(): void

    emitDestroy

    • Call all destroy hooks. This should only ever be called once. An error will @@ -34,21 +34,21 @@ be thrown if it is called more than once. This must be manually the resource is left to be collected by the GC then the destroy hooks will never be called.

      Returns ThreadWorker<Data, Response>

      A reference to asyncResource.

      -

    Protected getMainWorker

    • getMainWorker(): MessagePort

    Protected getMainWorker

    • getMainWorker(): MessagePort

    Protected handleError

    • handleError(e: string | Error): string

    Protected handleError

    • handleError(e: string | Error): string

    Protected run

    • run(fn: (data?: Data) => Response, value: MessageValue<Data, unknown>): void

    Protected run

    • run(fn: (data?: Data) => Response, value: MessageValue<Data, unknown>): void
    • Run the given function synchronously.

      Parameters

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

        Function that will be executed.

          • (data?: Data): Response
          • Parameters

            • Optional data: Data

            Returns Response

      • value: MessageValue<Data, unknown>

        Input data for the given function.

        -

      Returns void

    Protected runAsync

    • runAsync(fn: (data?: Data) => Promise<Response>, value: MessageValue<Data, unknown>): void

    Returns void

    Protected runAsync

    • runAsync(fn: (data?: Data) => Promise<Response>, value: MessageValue<Data, unknown>): void
    • Run the given function asynchronously.

      Parameters

      • fn: (data?: Data) => Promise<Response>

        Function that will be executed.

        @@ -66,7 +66,7 @@ then restore the original execution context.

        The receiver to be used for the function call.

      • Rest ...args: any[]

        Optional arguments to pass to the function.

        -

      Returns Result

    Protected sendToMainWorker

    • sendToMainWorker(message: MessageValue<Response, unknown>): void

    Returns Result

    Protected sendToMainWorker

    • sendToMainWorker(message: MessageValue<Response, unknown>): void

    ThreadWorkerWithMessageChannel

    ThreadWorkerWithMessageChannel: Worker & Draft<MessageChannel>

    A thread worker with message channels for communication between main thread and thread worker.

    -

    WorkerChoiceStrategy

    WorkerChoiceStrategy: keyof typeof WorkerChoiceStrategies
    +

    WorkerChoiceStrategy

    WorkerChoiceStrategy: keyof typeof WorkerChoiceStrategies

    Worker choice strategy.

    -

    Variables

    KillBehaviors

    KillBehaviors: Readonly<{ HARD: "HARD"; SOFT: "SOFT" }> = ...
    +

    Variables

    KillBehaviors

    KillBehaviors: Readonly<{ HARD: "HARD"; SOFT: "SOFT" }> = ...

    Enumeration of kill behaviors.

    -

    WorkerChoiceStrategies

    WorkerChoiceStrategies: Readonly<{ LESS_RECENTLY_USED: "LESS_RECENTLY_USED"; ROUND_ROBIN: "ROUND_ROBIN" }> = ...
    +

    WorkerChoiceStrategies

    WorkerChoiceStrategies: Readonly<{ LESS_RECENTLY_USED: "LESS_RECENTLY_USED"; ROUND_ROBIN: "ROUND_ROBIN" }> = ...

    Enumeration of worker choice strategies.

    Legend

    • Property
    • Method
    • Property
    • Method
    • Inherited property
    • Inherited method
    • Protected property
    • Protected method
    • Private method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/clusterpooloptions.html b/docs/interfaces/ClusterPoolOptions.html similarity index 95% rename from docs/interfaces/clusterpooloptions.html rename to docs/interfaces/ClusterPoolOptions.html index f741a902..02740562 100644 --- a/docs/interfaces/clusterpooloptions.html +++ b/docs/interfaces/ClusterPoolOptions.html @@ -1,19 +1,19 @@ ClusterPoolOptions | poolifier
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface ClusterPoolOptions

    Options for a poolifier cluster pool.

    -

    Hierarchy

    Index

    Properties

    Optional enableEvents

    enableEvents?: boolean
    +

    Hierarchy

    Index

    Properties

    Optional enableEvents

    enableEvents?: boolean

    Pool events emission.

    default

    true

    -

    Optional env

    env?: any
    +

    Optional env

    env?: any

    Key/value pairs to add to worker process environment.

    see

    https://nodejs.org/api/cluster.html#cluster_cluster_fork_env

    -

    Optional errorHandler

    errorHandler?: ErrorHandler<Worker>
    +

    Optional errorHandler

    errorHandler?: ErrorHandler<Worker>

    A function that will listen for error event on each worker.

    -

    Optional exitHandler

    exitHandler?: ExitHandler<Worker>
    +

    Optional exitHandler

    exitHandler?: ExitHandler<Worker>

    A function that will listen for exit event on each worker.

    -

    Optional messageHandler

    messageHandler?: MessageHandler<Worker>
    +

    Optional messageHandler

    messageHandler?: MessageHandler<Worker>

    A function that will listen for message event on each worker.

    -

    Optional onlineHandler

    onlineHandler?: OnlineHandler<Worker>
    +

    Optional onlineHandler

    onlineHandler?: OnlineHandler<Worker>

    A function that will listen for online event on each worker.

    -

    Optional workerChoiceStrategy

    workerChoiceStrategy?: "ROUND_ROBIN" | "LESS_RECENTLY_USED"
    +

    Optional workerChoiceStrategy

    workerChoiceStrategy?: "ROUND_ROBIN" | "LESS_RECENTLY_USED"

    The work choice strategy to use in this pool.

    Legend

    • Property
    • Method
    • Property
    • Method
    • Inherited property
    • Inherited method
    • Protected property
    • Protected method
    • Private method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/ipool.html b/docs/interfaces/IPool.html similarity index 97% rename from docs/interfaces/ipool.html rename to docs/interfaces/IPool.html index f5acef7d..36b35e12 100644 --- a/docs/interfaces/ipool.html +++ b/docs/interfaces/IPool.html @@ -4,14 +4,14 @@

    Type of data sent to the worker. This can only be serializable data.

  • Response = unknown

    Type of response of execution. This can only be serializable data.

    -
  • Hierarchy

    • IPool

    Index

    Methods

    destroy

    • destroy(): Promise<void>

    Hierarchy

    • IPool

    Index

    Methods

    destroy

    • destroy(): Promise<void>

    execute

    • execute(data: Data): Promise<Response>

    execute

    • execute(data: Data): Promise<Response>
    • Perform the task specified in the constructor with the data parameter.

      Parameters

      • data: Data

        The input for the specified task. This can only be serializable data.

      Returns Promise<Response>

      Promise that will be resolved when the task is successfully completed.

      -

    setWorkerChoiceStrategy

    • setWorkerChoiceStrategy(workerChoiceStrategy: "ROUND_ROBIN" | "LESS_RECENTLY_USED"): void

    setWorkerChoiceStrategy

    • setWorkerChoiceStrategy(workerChoiceStrategy: "ROUND_ROBIN" | "LESS_RECENTLY_USED"): void

    Returns void

  • Register a listener to the exit event.

    Parameters

    Returns void

  • once

    Returns void

    once