X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=inline;f=docs%2Finterfaces%2FIWorkerNode.html;h=ad1eeae136794f67d72f097c777765f7d44f9288;hb=d37f63bb1786e18571d4abf63b8f0c0b01d9a519;hp=8412566a8db469b85de4fb952372dcc14e161a22;hpb=926bdbf304ff660de1360e348517038a837c505f;p=poolifier.git diff --git a/docs/interfaces/IWorkerNode.html b/docs/interfaces/IWorkerNode.html index 8412566a..ad1eeae1 100644 --- a/docs/interfaces/IWorkerNode.html +++ b/docs/interfaces/IWorkerNode.html @@ -1,7 +1,7 @@ -
Internal
Generated using TypeDoc
Generated using TypeDoc
Worker node interface.
+- Preparing search index...
- The search index is not available
poolifier - v3.1.20Interface 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): 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
Index
Properties
Hierarchy
Index
Properties
Properties
Readonly
clearClears tasks queue.
Type declaration
Clears tasks queue.
-Returns void
Readonly
deleteDeletes task function worker usage statistics.
+Returns void
Readonly
deleteDeletes task function worker usage statistics.
Type 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.Param: name
The task function name.
Returns
-true
if the task function worker usage statistics were deleted,false
otherwise.Readonly
dequeueDequeue task.
+Readonly
dequeueDequeue task.
Type declaration
Dequeue task.
Returns undefined | Task<Data>
The dequeued task.
Returns
The dequeued task.
-Readonly
enqueueEnqueue task.
+Readonly
enqueueEnqueue task.
Type declaration
Enqueue task.
Parameters
task: Task<Data>
The task to queue.
Returns number
The tasks queue size.
Param: task
The task to queue.
Returns
The tasks queue size.
-Readonly
getGets task function worker usage statistics.
+Readonly
getGets task function worker usage statistics.
Type 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.Param: name
The task function name.
Returns
The task function worker usage statistics if the task function worker usage statistics are initialized,
-undefined
otherwise.Readonly
hasWhether the worker node has back pressure (i.e. its tasks queue is full).
+Readonly
hasWhether the worker node has back pressure (i.e. its tasks queue is full).
Type 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.Returns
-true
if the worker node has back pressure,false
otherwise.Readonly
infoWorker info.
-Optional
Readonly
messageMessage channel (worker thread only).
-Readonly
popPops a task from the tasks queue.
+Readonly
infoWorker info.
+Optional
Readonly
messageMessage channel (worker thread only).
+Readonly
popPops a task from the tasks queue.
Type declaration
Pops a task from the tasks queue.
Returns undefined | Task<Data>
The popped task.
Returns
The popped task.
-Readonly
registerRegisters once a worker event handler.
+Readonly
registerRegisters once a worker event handler.
Type declaration
Registers once a worker event handler.
Parameters
event: string
The event.
-handler: EventHandler<Worker>
The event handler.
+handler: EventHandler<Worker>
The event handler.
Returns void
Param: event
The event.
Param: handler
The event handler.
-Readonly
registerRegisters a worker event handler.
+Readonly
registerRegisters a worker event handler.
Type declaration
Registers a worker event handler.
Parameters
event: string
The event.
-handler: EventHandler<Worker>
The event handler.
+handler: EventHandler<Worker>
The event handler.
Returns void
Param: event
The event.
Param: handler
The event handler.
-Readonly
resetResets usage statistics.
+Readonly
resetResets usage statistics.
Type declaration
Resets usage statistics.
-Returns void
Optional
strategyWorker choice strategy data. +
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
tasksTasks queue size.
+Readonly
tasksTasks queue size.
Type declaration
Tasks queue size.
Returns number
The tasks queue size.
Returns
The tasks queue size.
-Readonly
terminateTerminates the worker node.
+Readonly
terminateTerminates the worker node.
Type declaration
Terminates the worker node.
-Returns Promise<void>
Readonly
unshiftPrepends a task to the tasks queue.
+Returns Promise<void>
Readonly
unshiftPrepends a task to the tasks queue.
Type declaration
Prepends a task to the tasks queue.
Parameters
task: Task<Data>
The task to prepend.
Returns number
The tasks queue size.
Param: task
The task to prepend.
Returns
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 this
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 this
Since
v10.0.0
-on
Adds the
listener
function to the end of the listeners array for the +on
Adds the
@@ -144,7 +144,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 this
Since
v0.1.101
-once
Adds a one-time
listener
function for the event namedeventName
. The +once
Adds a one-time
@@ -156,7 +156,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 this
Since
v0.3.0
-prepend Listener
Adds the
listener
function to the beginning of the listeners array for the +prepend Listener
Adds the
@@ -166,7 +166,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 this
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
@@ -174,18 +174,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 this
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 this
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 @@ -209,10 +209,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 this
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 this
Since
v0.3.5
-Settings
Member Visibility
Theme
On This Page