X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FFixedThreadPool.html;h=f76448bb1447f1949c378be213edc3b6a37aaf6b;hb=fbc22127e53d3ec0ecbd38ecea25fb92ebef50e7;hp=2a68eb0cdd600770995af3c6a19f981d2de71afb;hpb=1938bc376fa92d0c773c4c23b0305291ab483e6c;p=poolifier.git diff --git a/docs/classes/FixedThreadPool.html b/docs/classes/FixedThreadPool.html index 2a68eb0c..f76448bb 100644 --- a/docs/classes/FixedThreadPool.html +++ b/docs/classes/FixedThreadPool.html @@ -1,4 +1,4 @@ -FixedThreadPool | poolifier
+FixedThreadPool | poolifier
-
+
+
  • Defined in src/pools/thread/fixed.ts:29
  • @@ -52,51 +52,54 @@

    Constructors

    -
    +
    -
      - +
        +
      • Constructs a new poolifier fixed thread pool.

        @@ -104,413 +107,495 @@

        Type Parameters

        • -

          Data = unknown

        • +

          Data = unknown

        • -

          Response = unknown

    +

    Response = unknown

    Parameters

    -

    Returns FixedThreadPool<Data, Response>

    +
  • Defined in src/pools/thread/fixed.ts:40
  • Properties

    -
    +
    -
    emitter?: PoolEmitter
    -

    {@inheritDoc}

    +
    emitter?: PoolEmitter
    +

    Emitter on which events can be listened to.

    +

    Events that can currently be listened to:

    +
      +
    • 'full': Emitted when the pool is dynamic and full.
    • +
    • 'busy': Emitted when the pool is busy.
    • +
    -
    +
  • Defined in src/pools/abstract-pool.ts:42
  • +
    -
    filePath: string
    -

    Path to the worker-file.

    +
    filePath: string
    +

    Path to the worker file.

    -
    +
  • Defined in src/pools/abstract-pool.ts:77
  • +
    -
    numberOfWorkers: number
    +
    numberOfWorkers: number

    Number of workers that this pool should manage.

    -
    +
  • Defined in src/pools/abstract-pool.ts:76
  • +
    - +

    Options for the pool.

    -
    +
  • Defined in src/pools/abstract-pool.ts:78
  • +
    -
    promiseResponseMap: Map<string, PromiseResponseWrapper<ThreadWorkerWithMessageChannel, Response>> = ...
    -

    The promise response map.

    +
    promiseResponseMap: Map<string, PromiseResponseWrapper<ThreadWorkerWithMessageChannel, Response>> = ...
    +

    The execution response promise map.

    • key: The message id of each submitted task.
    • -
    • value: An object that contains the worker, the promise resolve and reject callbacks.
    • +
    • value: An object that contains the worker, the execution response promise resolve and reject callbacks.
    -

    When we receive a message from the worker we get a map entry with the promise resolve/reject bound to the message.

    +

    When we receive a message from the worker, we get a map entry with the promise resolve/reject bound to the message id.

    -
    +
  • Defined in src/pools/abstract-pool.ts:52
  • +
    -
    workerChoiceStrategyContext: WorkerChoiceStrategyContext<ThreadWorkerWithMessageChannel, Data, Response>
    -

    Worker choice strategy instance implementing the worker choice algorithm.

    -

    Default to a strategy implementing a round robin algorithm.

    +
    workerChoiceStrategyContext: WorkerChoiceStrategyContext<ThreadWorkerWithMessageChannel, Data, Response>
    +

    Worker choice strategy context referencing a worker choice algorithm implementation.

    +

    Default to a round robin algorithm.

    -
    - -
    workers: WorkerType<ThreadWorkerWithMessageChannel>[] = []
    -

    {@inheritDoc}

    +
  • Defined in src/pools/abstract-pool.ts:62
  • +
    + +
    workerNodes: WorkerNode<ThreadWorkerWithMessageChannel, Data>[] = []
    +

    Pool worker nodes.

    +
  • Defined in src/pools/abstract-pool.ts:39
  • Accessors

    -
    - -
    +
    + +
      +
    • get full(): boolean
    • +
    • +

      Whether the pool is full or not.

      +

      The pool filling boolean status.

      +
      +

      Returns boolean

    +
    + +
      +
    • get numberOfQueuedTasks(): number
    • +
    • +

      Number of tasks queued in the pool.

      +
      +

      Returns number

    +
    + +
    • get numberOfRunningTasks(): number
    • -

      {@inheritDoc}

      +

      Number of tasks running in the pool.

      Returns number

    -
    +
  • Defined in src/pools/abstract-pool.ts:185
  • +
    -
      -
    • get type(): PoolType
    • +
    +
  • Defined in src/pools/thread/fixed.ts:95
  • Methods

    -
    - -
    +
    -

    Returns void

    -
    - -
    +
    + +
      +
    • -

      Hook executed before the worker task promise resolution. +

      Hook executed before the worker task execution. Can be overridden.

      Parameters

      • -
        workerKey: number
        -

        The worker key.

        +
        workerNodeKey: number
        +

        The worker node key.

      Returns void

    -
    - -
    +
    + +
    -
    +
  • Defined in src/pools/abstract-pool.ts:419
  • +
    -
    -
    +
  • Defined in src/pools/abstract-pool.ts:481
  • +
    -
    -
    +
  • Defined in src/pools/thread/fixed.ts:78
  • +
    -
      - +
        +
      • -

        {@inheritDoc}

        +

        Shutdowns every current worker in this pool.

        -

        Returns Promise<void>

    -
    - -
    +
    + +
    -
    - -
    +

    Returns Promise<void>

    +
    + +
      +
    • -

      {@inheritDoc}

      +

      Enables/disables the worker tasks queue in this pool.

      Parameters

      • -
        data: Data
      -

      Returns Promise<Response>

    -
    - -
      - +
      enable: boolean
      +

      Whether to enable or disable the worker tasks queue.

      +
      +
    • +
      Optional tasksQueueOptions: TasksQueueOptions
      +

      The worker tasks queue options.

      +
    +

    Returns void

    +
    + +
      +
    • -

      {@inheritDoc}

      +

      Executes the function specified in the worker constructor with the task data input parameter.

      + +

      Returns

      Promise that will be fulfilled when the task is completed.

      -

      Returns number

    -
    - -
      - +
      +

      Parameters

      +
        +
      • +
        Optional data: Data
        +

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

        +
      +

      Returns Promise<Response>

    +
    + +
    -
    +
  • Defined in src/pools/abstract-pool.ts:298
  • +
    -
      - +
    -
    - -
    +
    + +
      +
    • -

      {@inheritDoc}

      +

      Registers a listener callback on the given worker.

      Type Parameters

      • -

        Message

      +

      Message

    Parameters

    • -
      messageChannel: ThreadWorkerWithMessageChannel
    • +
      worker: ThreadWorkerWithMessageChannel
      +

      The worker which should register a listener.

      +
    • -
      listener: ((message: MessageValue<Message, unknown>) => void)
      +
      listener: ((message) => void)
      +

      The message listener callback.

      +
      • -
          -
        • (message: MessageValue<Message, unknown>): void
        • +
            +
          • (message): void
          • Parameters

            • -
              message: MessageValue<Message, unknown>
            +
            message: MessageValue<Message, unknown>

    Returns void

    Returns void

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

    Returns void

    -
    +
  • Defined in src/pools/abstract-pool.ts:266
  • +
    -
    +
    + +
    -
    +
  • Defined in src/pools/abstract-pool.ts:244
  • +
    -
    -
    +
  • Defined in src/pools/abstract-pool.ts:360
  • +
    -
    - +
    +
    +
    +

    On This Page

    - -
    +
  • constructor
  • +
  • emitter
  • +
  • filePath
  • +
  • numberOfWorkers
  • +
  • opts
  • +
  • promiseResponseMap
  • +
  • workerChoiceStrategyContext
  • +
  • workerNodes
  • +
  • busy
  • +
  • full
  • +
  • numberOfQueuedTasks
  • +
  • numberOfRunningTasks
  • +
  • type
  • +
  • afterTaskExecutionHook
  • +
  • afterWorkerSetup
  • +
  • beforeTaskExecutionHook
  • +
  • chooseWorkerNode
  • +
  • createAndSetupWorker
  • +
  • createWorker
  • +
  • destroy
  • +
  • destroyWorker
  • +
  • enableTasksQueue
  • +
  • execute
  • +
  • internalBusy
  • +
  • isMain
  • +
  • registerWorkerMessageListener
  • +
  • sendToWorker
  • +
  • setTasksQueueOptions
  • +
  • setWorkerChoiceStrategy
  • +
  • setWorkerChoiceStrategyOptions
  • +
  • setupHook
  • +
  • workerListener
  • + +

    Generated using TypeDoc

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