X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Finterfaces%2FIWorkerNode.html;h=a2e23260b47e4f553be3c83e6d6dfb21db6065f8;hb=b8882b9d826a828a34eb8ba64b02a74b83db9a09;hp=b356e715268aa556b89a7576b26a12bc9a6b6096;hpb=0bcaa61099884958be02cb6d32b7873083c0f494;p=poolifier.git diff --git a/docs/interfaces/IWorkerNode.html b/docs/interfaces/IWorkerNode.html index b356e715..a2e23260 100644 --- a/docs/interfaces/IWorkerNode.html +++ b/docs/interfaces/IWorkerNode.html @@ -1,54 +1,7 @@ -IWorkerNode | poolifier - v3.0.2
-
- -
-
-
-
- -

Interface IWorkerNode<Worker, Data>Internal

-
-

Worker node interface.

-
-
-
-

Type Parameters

-
    -
  • -

    Worker extends IWorker

    -

    Type of worker.

    -
    -
  • -
  • -

    Data = unknown

    -

    Type of data sent to the worker. This can only be structured-cloneable data.

    -
    -
-
-

Hierarchy

-
    -
  • EventTarget -
      -
    • IWorkerNode
-
-
-
- -
-
-

Properties

-
clearTasksQueue -closeChannel +IWorkerNode | poolifier - v3.1.14

Interface IWorkerNode<Worker, Data>Internal

Worker node interface.

+
interface IWorkerNode<Worker, Data> {
    clearTasksQueue: (() => void);
    deleteTaskFunctionWorkerUsage: ((name) => boolean);
    dequeueTask: (() => undefined | Task<Data>);
    enqueueTask: ((task) => number);
    getTaskFunctionWorkerUsage: ((name) => undefined | WorkerUsage);
    hasBackPressure: (() => boolean);
    info: WorkerInfo;
    messageChannel?: MessageChannel;
    popTask: (() => undefined | Task<Data>);
    registerOnceWorkerEventHandler: ((event, handler) => void);
    registerWorkerEventHandler: ((event, handler) => void);
    resetUsage: (() => void);
    strategyData?: StrategyData;
    tasksQueueBackPressureSize: number;
    tasksQueueSize: (() => number);
    terminate: (() => Promise<void>);
    unshiftTask: ((task) => number);
    usage: WorkerUsage;
    worker: Worker;
    [captureRejectionSymbol]?(error, event, ...args): void;
    addListener(eventName, listener): this;
    emit(eventName, ...args): boolean;
    eventNames(): (string | symbol)[];
    getMaxListeners(): number;
    listenerCount(eventName, listener?): number;
    listeners(eventName): Function[];
    off(eventName, listener): this;
    on(eventName, listener): this;
    once(eventName, listener): this;
    prependListener(eventName, listener): this;
    prependOnceListener(eventName, listener): this;
    rawListeners(eventName): Function[];
    removeAllListeners(event?): this;
    removeListener(eventName, listener): this;
    setMaxListeners(n): this;
}

Type Parameters

  • Worker extends IWorker

    Type of worker.

    +
  • Data = unknown

    Type of data sent to the worker. This can only be structured-cloneable data.

    +

Hierarchy

  • EventEmitter
    • IWorkerNode
-
-

Properties

-
- -
clearTasksQueue: (() => void)
-
-

Type declaration

-
    -
  • -
      -
    • (): void
    • -
    • -

      Clears tasks queue.

      -
      -

      Returns void

      -
-
- -
closeChannel: (() => void)
-
-

Type declaration

-
    -
  • -
      -
    • (): void
    • -
    • -

      Closes communication channel.

      -
      -

      Returns void

      -
-
- -
deleteTaskFunctionWorkerUsage: ((name) => boolean)
-
-

Type declaration

-
    -
  • -
      -
    • (name): boolean
    • -
    • -

      Deletes task function worker usage statistics.

      -
      -
      -

      Parameters

      -
        -
      • -
        name: string
        -

        The task function name.

        -
        -
      -

      Returns boolean

      true if the task function worker usage statistics were deleted, false otherwise.

      - -
-
- -
dequeueTask: (() => undefined | Task<Data>)
-
-

Type declaration

-
    -
  • -
      -
    • (): undefined | Task<Data>
    • -
    • -

      Dequeue task.

      -
      -

      Returns undefined | Task<Data>

      The dequeued task.

      - -
-
- -
enqueueTask: ((task) => number)
-
-

Type declaration

-
    -
  • -
      -
    • (task): number
    • -
    • -

      Enqueue task.

      -
      -
      -

      Parameters

      -
        -
      • -
        task: Task<Data>
        -

        The task to queue.

        -
        -
      -

      Returns number

      The tasks queue size.

      - -
-
- -
getTaskFunctionWorkerUsage: ((name) => undefined | WorkerUsage)
-
-

Type declaration

-
    -
  • -
      -
    • (name): undefined | WorkerUsage
    • -
    • -

      Gets task function worker usage statistics.

      -
      -
      -

      Parameters

      -
        -
      • -
        name: string
        -

        The task function name.

        -
        -
      -

      Returns undefined | WorkerUsage

      The task function worker usage statistics if the task function worker usage statistics are initialized, undefined otherwise.

      - -
-
- -
hasBackPressure: (() => boolean)
-
-

Type declaration

-
    -
  • -
      -
    • (): boolean
    • -
    • -

      Whether the worker node has back pressure (i.e. its tasks queue is full).

      -
      -

      Returns boolean

      true if the worker node has back pressure, false otherwise.

      - -
-
- - -

Worker info.

-
-
-
- -
messageChannel?: MessageChannel
-

Message channel (worker_threads only).

-
-
-
- -
popTask: (() => undefined | Task<Data>)
-
-

Type declaration

-
    -
  • -
      -
    • (): undefined | Task<Data>
    • -
    • -

      Pops a task from the tasks queue.

      -
      -

      Returns undefined | Task<Data>

      The popped task.

      - -
-
- -
resetUsage: (() => void)
-
-

Type declaration

-
    -
  • -
      -
    • (): void
    • -
    • -

      Resets usage statistics.

      -
      -

      Returns void

      -
-
- -
strategyData?: StrategyData
-

Worker choice strategy data. +worker +

Methods

Properties

clearTasksQueue: (() => void)

Clears tasks queue.

+

Type declaration

    • (): void
    • Clears tasks queue.

      +

      Returns void

deleteTaskFunctionWorkerUsage: ((name) => boolean)

Deletes task function worker usage statistics.

+

Type declaration

    • (name): boolean
    • Deletes task function worker usage statistics.

      +

      Parameters

      • name: string

        The task function name.

        +

      Returns boolean

      true if the task function worker usage statistics were deleted, false otherwise.

      +

Param: name

The task function name.

+

Returns

true if the task function worker usage statistics were deleted, false otherwise.

+
dequeueTask: (() => undefined | Task<Data>)

Dequeue task.

+

Type declaration

    • (): undefined | Task<Data>
    • Dequeue task.

      +

      Returns undefined | Task<Data>

      The dequeued task.

      +

Returns

The dequeued task.

+
enqueueTask: ((task) => number)

Enqueue task.

+

Type declaration

    • (task): number
    • Enqueue task.

      +

      Parameters

      Returns number

      The tasks queue size.

      +

Param: task

The task to queue.

+

Returns

The tasks queue size.

+
getTaskFunctionWorkerUsage: ((name) => undefined | WorkerUsage)

Gets task function worker usage statistics.

+

Type declaration

    • (name): undefined | WorkerUsage
    • Gets task function worker usage statistics.

      +

      Parameters

      • name: string

        The task function name.

        +

      Returns undefined | WorkerUsage

      The task function worker usage statistics if the task function worker usage statistics are initialized, undefined otherwise.

      +

Param: name

The task function name.

+

Returns

The task function worker usage statistics if the task function worker usage statistics are initialized, undefined otherwise.

+
hasBackPressure: (() => boolean)

Whether the worker node has back pressure (i.e. its tasks queue is full).

+

Type declaration

    • (): boolean
    • Whether the worker node has back pressure (i.e. its tasks queue is full).

      +

      Returns boolean

      true if the worker node has back pressure, false otherwise.

      +

Returns

true if the worker node has back pressure, false otherwise.

+

Worker info.

+
messageChannel?: MessageChannel

Message channel (worker thread only).

+
popTask: (() => undefined | Task<Data>)

Pops a task from the tasks queue.

+

Type declaration

    • (): undefined | Task<Data>
    • Pops a task from the tasks queue.

      +

      Returns undefined | Task<Data>

      The popped task.

      +

Returns

The popped task.

+
registerOnceWorkerEventHandler: ((event, handler) => void)

Registers once a worker event handler.

+

Type declaration

Param: event

The event.

+

Param: handler

The event handler.

+
registerWorkerEventHandler: ((event, handler) => void)

Registers a worker event handler.

+

Type declaration

Param: event

The event.

+

Param: handler

The event handler.

+
resetUsage: (() => void)

Resets usage statistics.

+

Type declaration

    • (): void
    • Resets usage statistics.

      +

      Returns void

strategyData?: StrategyData

Worker choice strategy data. This is used to store data that are specific to the worker choice strategy.

-
-
-
- -
tasksQueueBackPressureSize: number
-

Tasks queue back pressure size. +

tasksQueueBackPressureSize: number

Tasks queue back pressure size. This is the number of tasks that can be enqueued before the worker node has back pressure.

-
-
-
- -
tasksQueueSize: (() => number)
-
-

Type declaration

-
    -
  • -
      -
    • (): number
    • -
    • -

      Tasks queue size.

      -
      -

      Returns number

      The tasks queue size.

      - -
-
- -
unshiftTask: ((task) => number)
-
-

Type declaration

-
    -
  • -
      -
    • (task): number
    • -
    • -

      Prepends a task to the tasks queue.

      -
      -
      -

      Parameters

      -
        -
      • -
        task: Task<Data>
        -

        The task to prepend.

        -
        -
      -

      Returns number

      The tasks queue size.

      - -
-
- - -

Worker usage statistics.

-
-
-
- -
worker: Worker
-

Worker.

-
-
-
-

Methods

-
- -
    - -
  • -

    Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.

    -

    The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.

    -

    When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.

    -

    When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.

    -

    When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.

    -

    If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.

    -

    The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.

    -

    MDN Reference

    -
    -
    -

    Parameters

    -
      -
    • -
      type: string
    • -
    • -
      callback: null | EventListenerOrEventListenerObject
    • -
    • -
      Optional options: boolean | AddEventListenerOptions
    -

    Returns void

    -
-
- -
    - -
  • -

    Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

    -

    MDN Reference

    -
    -
    -

    Parameters

    -
      -
    • -
      event: Event
    -

    Returns boolean

    -
-
- -
    - -
  • -

    Removes the event listener in target's event listener list with the same type, callback, and options.

    -

    MDN Reference

    -
    -
    -

    Parameters

    -
      -
    • -
      type: string
    • -
    • -
      callback: null | EventListenerOrEventListenerObject
    • -
    • -
      Optional options: boolean | EventListenerOptions
    -

    Returns void

    -
-
- -
-
-

Generated using TypeDoc

-
\ No newline at end of file +
tasksQueueSize: (() => number)

Tasks queue size.

+

Type declaration

Returns

The tasks queue size.

+
terminate: (() => Promise<void>)

Terminates the worker node.

+

Type declaration

unshiftTask: ((task) => number)

Prepends a task to the tasks queue.

+

Type declaration

Param: task

The task to prepend.

+

Returns

The tasks queue size.

+
usage: WorkerUsage

Worker usage statistics.

+
worker: Worker

Worker.

+

Methods

Generated using TypeDoc

\ No newline at end of file