X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Finterfaces%2FIWorkerNode.html;h=b410b9c47ca1828214838bbf482b4f6453659f07;hb=165f3d56b9d736623b8f919ac357890d959f5191;hp=4d66bf6dfe6ee5bed1576348344e5c5333bebc0e;hpb=52a04779d6d7fce6b3db10d1abf5e03b42ea9723;p=poolifier.git diff --git a/docs/interfaces/IWorkerNode.html b/docs/interfaces/IWorkerNode.html index 4d66bf6d..b410b9c4 100644 --- a/docs/interfaces/IWorkerNode.html +++ b/docs/interfaces/IWorkerNode.html @@ -1,7 +1,7 @@ -
Internal
Worker node interface.
+- Preparing search index...
- The search index is not available
poolifier - v3.1.5Interface IWorkerNode<Worker, Data>
Internal
Worker node interface.
    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): IWorkerNode<Worker, Data>;
    emit(eventName, ...args): boolean;
    eventNames(): (string | symbol)[];
    getMaxListeners(): number;
    listenerCount(eventName, listener?): number;
    listeners(eventName): Function[];
    off(eventName, listener): IWorkerNode<Worker, Data>;
    on(eventName, listener): IWorkerNode<Worker, Data>;
    once(eventName, listener): IWorkerNode<Worker, Data>;
    prependListener(eventName, listener): IWorkerNode<Worker, Data>;
    prependOnceListener(eventName, listener): IWorkerNode<Worker, Data>;
    rawListeners(eventName): Function[];
    removeAllListeners(event?): IWorkerNode<Worker, Data>;
    removeListener(eventName, listener): IWorkerNode<Worker, Data>;
    setMaxListeners(n): IWorkerNode<Worker, Data>;
}
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
Index
Properties
Hierarchy
Index
Properties
Properties
Readonly
clearType declaration
Clears tasks queue.
-Returns void
Readonly
deleteType declaration
Deletes task function worker usage statistics.
+Returns void
Readonly
deleteType declaration
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.Readonly
dequeueType declaration
Dequeue task.
+Readonly
dequeueType declaration
Dequeue task.
Returns undefined | Task<Data>
The dequeued task.
-Readonly
enqueueType declaration
Enqueue task.
+Readonly
enqueueType declaration
Enqueue task.
Parameters
task: Task<Data>
The task to queue.
Returns number
The tasks queue size.
-Readonly
getType declaration
Gets task function worker usage statistics.
+Readonly
getType declaration
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.Readonly
hasType declaration
Whether the worker node has back pressure (i.e. its tasks queue is full).
+Readonly
hasType declaration
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.Readonly
infoWorker info.
-Optional
Readonly
messageMessage channel (worker thread only).
-Readonly
popType declaration
Pops a task from the tasks queue.
+Readonly
infoWorker info.
+Optional
Readonly
messageMessage channel (worker thread only).
+Readonly
popType declaration
Pops a task from the tasks queue.
Returns undefined | Task<Data>
The popped task.
-Readonly
registerType declaration
Registers once a worker event handler.
+Readonly
registerType declaration
Registers once a worker event handler.
Parameters
event: string
The event.
handler: OnlineHandler<Worker> | MessageHandler<Worker> | ErrorHandler<Worker> | ExitHandler<Worker>
The event handler.
-Returns void
Readonly
registerType declaration
Registers a worker event handler.
+Returns void
Readonly
registerType declaration
Registers a worker event handler.
Parameters
event: string
The event.
handler: OnlineHandler<Worker> | MessageHandler<Worker> | ErrorHandler<Worker> | ExitHandler<Worker>
The event handler.
-Returns void
Readonly
resetType declaration
Resets usage statistics.
-Returns void
Optional
strategyWorker choice strategy data. +
Returns void
Readonly
resetType declaration
Resets usage statistics.
+Returns void
Optional
strategyWorker choice strategy data. This is used to store data that are specific to the worker choice strategy.
-tasks Queue Back Pressure Size
Tasks queue back pressure size. +
tasks Queue Back Pressure Size
Tasks queue back pressure size. This is the number of tasks that can be enqueued before the worker node has back pressure.
-Readonly
tasksType declaration
Tasks queue size.
+Readonly
tasksType declaration
Tasks queue size.
Returns number
The tasks queue size.
-Readonly
terminateType declaration
Terminates the worker node.
-Returns Promise<void>
Readonly
unshiftType declaration
Prepends a task to the tasks queue.
+Readonly
terminateType declaration
Terminates the worker node.
+Returns Promise<void>
Readonly
unshiftType declaration
Prepends a task to the tasks queue.
Parameters
task: Task<Data>
The task to prepend.
Returns number
The tasks queue size.
-Readonly
usageWorker usage statistics.
-Readonly
workerWorker.
-Methods
Optional
[captureParameters
error: Error
event: string
Rest
...args: any[]Returns void
add Listener
Alias for
+emitter.on(eventName, listener)
.Readonly
usageWorker usage statistics.
+Readonly
workerWorker.
+Methods
Optional
[captureParameters
error: Error
event: string
Rest
...args: any[]Returns void
add Listener
Alias for
emitter.on(eventName, listener)
.Parameters
eventName: string | symbol
listener: ((...args) => void)
Parameters
Rest
...args: any[]Returns void
Returns IWorkerNode<Worker, Data>
Since
v0.1.26
-emit
Synchronously calls each of the listeners registered for the event named
eventName
, in the order they were registered, passing the supplied arguments +emit
Synchronously calls each of the listeners registered for the event named
eventName
, in the order they were registered, passing the supplied arguments to each.Returns
true
if the event had listeners,false
otherwise.Parameters
eventName: string | symbol
Rest
...args: any[]Returns boolean
Since
v0.1.26
-event Names
Returns an array listing the events for which the emitter has registered +
event Names
Returns an array listing the events for which the emitter has registered listeners. The values in the array are strings or
Symbol
s.Returns (string | symbol)[]
Since
v6.0.0
-get Max Listeners
Returns the current max listener value for the
EventEmitter
which is either +get Max Listeners
Returns the current max listener value for the
EventEmitter
which is either set byemitter.setMaxListeners(n)
or defaults to defaultMaxListeners.Returns number
Since
v1.0.0
-listener Count
Returns the number of listeners listening for the event named
eventName
. +listener Count
Returns the number of listeners listening for the event named
eventName
. Iflistener
is provided, it will return how many times the listener is found in the list of the listeners of the event.Parameters
eventName: string | symbol
The name of the event being listened for
Optional
listener: FunctionThe event handler function
Returns number
Since
v3.2.0
-listeners
Returns a copy of the array of listeners for the event named
+eventName
.listeners
Returns a copy of the array of listeners for the event named
eventName
.Parameters
eventName: string | symbol
Returns Function[]
Since
v0.1.26
-off
Alias for
+emitter.removeListener()
.off
Alias for
emitter.removeListener()
.Parameters
eventName: string | symbol
listener: ((...args) => void)
Parameters
Rest
...args: any[]Returns void
Returns IWorkerNode<Worker, Data>
Since
v10.0.0
-on
Adds the
listener
function to the end of the listeners array for the +on
Adds the
@@ -115,7 +115,7 @@ event listener to the beginning of the listeners array.listener
function to the end of the listeners array for the event namedeventName
. No checks are made to see if thelistener
has already been added. Multiple calls passing the same combination ofeventName
andlistener
will result in thelistener
being added, and called, multiple times.Parameters
eventName: string | symbol
The name of the event.
listener: ((...args) => void)
The callback function
Parameters
Rest
...args: any[]Returns void
Returns IWorkerNode<Worker, Data>
Since
v0.1.101
-once
Adds a one-time
listener
function for the event namedeventName
. The +once
Adds a one-time
@@ -127,7 +127,7 @@ event listener to the beginning of the listeners array.listener
function for the event namedeventName
. The next timeeventName
is triggered, this listener is removed and then invoked.Parameters
eventName: string | symbol
The name of the event.
listener: ((...args) => void)
The callback function
Parameters
Rest
...args: any[]Returns void
Returns IWorkerNode<Worker, Data>
Since
v0.3.0
-prepend Listener
Adds the
listener
function to the beginning of the listeners array for the +prepend Listener
Adds the
@@ -137,7 +137,7 @@ times.listener
function to the beginning of the listeners array for the event namedeventName
. No checks are made to see if thelistener
has already been added. Multiple calls passing the same combination ofeventName
andlistener
will result in thelistener
being added, and called, multiple times.Parameters
eventName: string | symbol
The name of the event.
listener: ((...args) => void)
The callback function
Parameters
Rest
...args: any[]Returns void
Returns IWorkerNode<Worker, Data>
Since
v6.0.0
-prepend Once Listener
Adds a one-time
listener
function for the event namedeventName
to the beginning of the listeners array. The next timeeventName
is triggered, this +prepend Once Listener
Adds a one-time
@@ -145,18 +145,18 @@ listener is removed, and then invoked.listener
function for the event namedeventName
to the beginning of the listeners array. The next timeeventName
is triggered, this listener is removed, and then invoked.Parameters
eventName: string | symbol
The name of the event.
listener: ((...args) => void)
The callback function
Parameters
Rest
...args: any[]Returns void
Returns IWorkerNode<Worker, Data>
Since
v6.0.0
-raw Listeners
Returns a copy of the array of listeners for the event named
eventName
, +raw Listeners
Returns a copy of the array of listeners for the event named
eventName
, including any wrappers (such as those created by.once()
).Parameters
eventName: string | symbol
Returns Function[]
Since
v9.4.0
-remove All Listeners
Removes all listeners, or those of the specified
+eventName
.remove All Listeners
Removes all listeners, or those of the specified
eventName
.It is bad practice to remove listeners added elsewhere in the code, particularly when the
EventEmitter
instance was created by some other component or module (e.g. sockets or file streams).Returns a reference to the
EventEmitter
, so that calls can be chained.Parameters
Optional
event: string | symbolReturns IWorkerNode<Worker, Data>
Since
v0.1.26
-remove Listener
Removes the specified
+listener
from the listener array for the event namedeventName
.remove Listener
Removes the specified
listener
from the listener array for the event namedeventName
.removeListener()
will remove, at most, one instance of a listener from the @@ -180,10 +180,10 @@ recently added instance. In the example theonce('ping')
lisReturns a reference to the
EventEmitter
, so that calls can be chained.Parameters
eventName: string | symbol
listener: ((...args) => void)
Parameters
Rest
...args: any[]Returns void
Returns IWorkerNode<Worker, Data>
Since
v0.1.26
-set Max Listeners
By default
EventEmitter
s will print a warning if more than10
listeners are +set Max Listeners
By default
EventEmitter
s will print a warning if more than10
listeners are added for a particular event. This is a useful default that helps finding memory leaks. Theemitter.setMaxListeners()
method allows the limit to be modified for this specificEventEmitter
instance. The value can be set toInfinity
(or0
) to indicate an unlimited number of listeners.Returns a reference to the
EventEmitter
, so that calls can be chained.Parameters
n: number
Returns IWorkerNode<Worker, Data>
Since
v0.3.5
-Settings
Member Visibility
Theme
On This Page
Generated using TypeDoc
Settings
Member Visibility
Theme
On This Page
Generated using TypeDoc