X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FDynamicClusterPool.html;h=e69f2176a75428a084fbfb08c7b041a3942b3c7b;hb=d2c0b687e4d618db173a9176eeabdd0ff0dff4ee;hp=eb07fed2ef7af48c7a9e90f65332ee15609099c4;hpb=ce9e97f17ed0d1b2928919244dce5a7887f843f5;p=poolifier.git diff --git a/docs/classes/DynamicClusterPool.html b/docs/classes/DynamicClusterPool.html index eb07fed2..e69f2176 100644 --- a/docs/classes/DynamicClusterPool.html +++ b/docs/classes/DynamicClusterPool.html @@ -1,13 +1,13 @@ -
Optional
Readonly
emitterGenerated using TypeDoc
Generated using TypeDoc
Emitter on which events can be listened to.
+
+Optional
emitterEvent emitter integrated with async resource on which events can be listened to. +The async tracking tooling identifier is
poolifier:<PoolType>-<WorkerType>-pool
.Events that can currently be listened to:
'ready'
: Emitted when the number of workers created in the pool has reached the minimum size expected and are ready.'busy'
: Emitted when the number of workers created in the pool has reached the maximum size expected and are executing at least one task.'busy'
: Emitted when the number of workers created in the pool has reached the maximum size expected and are executing concurrently their tasks quota.'full'
: Emitted when the pool is dynamic and the number of workers created has reached the maximum size expected.destroy
': Emitted when the pool is destroyed.'destroy'
: Emitted when the pool is destroyed.'error'
: Emitted when an uncaught error occurs.'taskError'
: Emitted when an error occurs while executing a task.'backPressure'
: Emitted when all worker nodes have back pressure (i.e. their tasks queue is full: queue size >= pool maximum size^2).'backPressure'
: Emitted when all worker nodes have back pressure (i.e. their tasks queue is full: queue size >= maximum queue size).Protected
Readonly
fileProtected
Readonly
maxMaximum number of workers that can be created by this pool.
Protected
Readonly
numberProtected
Readonly
optsProtected
promiseThe task execution response promise map.
+The task execution response promise map:
key
: The message id of each submitted task.value
: An object that contains the worker, the execution response promise resolve and reject callbacks.Protected
workerReadonly
Internal
workerAccessors
Protected
full@@ -266,7 +274,7 @@ When the maximum number of workers is reached and workers are busy, an event is
info
@@ -278,19 +286,19 @@ When the maximum number of workers is reached and workers are busy, an event is
Size
-Protected
max+- get maxSize(): number
-
The pool maximum size.
Returns number
Protected
min@@ -302,7 +310,7 @@ When the maximum number of workers is reached and workers are busy, an event is
Private
ready@@ -314,7 +322,7 @@ When the maximum number of workers is reached and workers are busy, an event is
Protected
type@@ -327,7 +335,7 @@ When the maximum number of workers is reached and workers are busy, an event is
Private
utilization@@ -340,7 +348,7 @@ When the maximum number of workers is reached and workers are busy, an event is
Protected
worker@@ -352,9 +360,40 @@ When the maximum number of workers is reached and workers are busy, an event is
Methods
+add Task Function
++- add
Task Function(name, fn): Promise<boolean>
+-
+
+
+
+
+
Adds a task function to this pool. +If a task function with the same name already exists, it will be overwritten.
+Parameters
++-
+
+
+-
+
+
name: string
+The name of the task function.
+fn: TaskFunction<Data, Response>
+The task function.
+Returns Promise<boolean>
+ +true
if the task function was added,false
otherwise.Throws
https://nodejs.org/api/errors.html#class-typeerror If the
+ +name
parameter is not a string or an empty string.Throws
https://nodejs.org/api/errors.html#class-typeerror If the
+fn
parameter is not a function.Protected
after@@ -380,7 +419,7 @@ Can be overridden.
Protected
after@@ -401,7 +440,7 @@ Can be overridden.
Protected
before@@ -427,23 +466,7 @@ Can be overridden.
Dynamic Pool Size
-Protected
check-- check
Dynamic Pool Size(min, max): void
--
-
-
-
Parameters
---
-
--
-
min: number
max: number
Returns void
Protected
create@@ -456,7 +479,7 @@ Can be overridden.
Protected
create@@ -469,7 +492,7 @@ Can be overridden.
Protected
create@@ -482,7 +505,48 @@ Can be overridden.
Worker Message Listener
+Protected
deregister+- deregister
Worker Message Listener<Message>(workerNodeKey, listener): void
+-
+
+
+
+
+
+
Deregisters a listener callback on the worker given its worker node key.
+Type Parameters
++-
+
Message
Parameters
++-
+
+
+-
+
+
+
workerNodeKey: number
+The worker node key.
+listener: ((message) => void)
+The message listener callback.
++-
+
+- (message): void
+-
+
+
+
Parameters
++-
+
message: MessageValue<Message, unknown>
Returns void
Returns void
+destroy
@@ -494,7 +558,7 @@ Can be overridden.
Protected
destroy@@ -514,32 +578,32 @@ Can be overridden.
enable Tasks Queue
Enables/disables the worker tasks queue in this pool.
+Enables/disables the worker node tasks queue in this pool.
Parameters
enable: boolean
-Whether to enable or disable the worker tasks queue.
+Whether to enable or disable the worker node tasks queue.
-Optional
tasksQueueOptions: TasksQueueOptionsThe worker tasks queue options.
+The worker node tasks queue options.
Returns void
execute
@@ -570,7 +634,7 @@ Can be overridden.
Protected
flush@@ -584,7 +648,7 @@ Can be overridden.
Returns void
Protected
get@@ -605,7 +669,28 @@ Can be overridden.
has Task Function
++- has
Task Function(name): boolean
+-
+
+
+
+
Whether the specified task function exists in this pool.
+Parameters
++-
+
+
name: string
+The name of the task function.
+Returns boolean
+ +true
if the task function exists,false
otherwise.has Worker Node Back Pressure
@@ -626,7 +711,7 @@ Can be overridden.
Protected
internal@@ -639,7 +724,7 @@ Can be overridden.
Protected
is@@ -651,20 +736,61 @@ Can be overridden.
list Task Functions
+list Task Function Names
-- list
Task Functions(): string[]
+- list
Task Function Names(): string[]
-
Lists the names of task function available in this pool.
Returns string[]
The names of task function available in this pool.
Once Worker Message Listener
+Protected
register+- register
Once Worker Message Listener<Message>(workerNodeKey, listener): void
+-
+
+
+
+
+
+
Registers once a listener callback on the worker given its worker node key.
+Type Parameters
++-
+
Message
Parameters
++-
+
+
+-
+
+
+
workerNodeKey: number
+The worker node key.
+listener: ((message) => void)
+The message listener callback.
++-
+
+- (message): void
+-
+
+
+
Parameters
++-
+
message: MessageValue<Message, unknown>
Returns void
Returns void
+Protected
register@@ -705,23 +831,42 @@ Can be overridden.
remove Task Function
++- remove
Task Function(name): Promise<boolean>
+-
+
+
+
+
Removes a task function from this pool.
+Parameters
++-
+
+
name: string
+The name of the task function.
+Returns Promise<boolean>
+ +true
if the task function was removed,false
otherwise.Protected
send-- send
Kill Message To Worker(workerNodeKey, workerId): Promise<void>
+- send
Kill Message To Worker(workerNodeKey): Promise<void>
-
-
-
--
-
+
Parameters
workerNodeKey: number
workerId: number
workerNodeKey: number
Returns Promise<void>
Protected
send@@ -741,7 +886,7 @@ Can be overridden.
Protected
send@@ -766,27 +911,48 @@ Can be overridden.
set Default Task Function
++- set
Default Task Function(name): Promise<boolean>
+-
+
+
+
+
Sets the default task function in this pool.
+Parameters
++-
+
+
name: string
+The name of the task function.
+Returns Promise<boolean>
+ +true
if the default task function was set,false
otherwise.set Tasks Queue Options
Sets the worker tasks queue options in this pool.
+Sets the worker node tasks queue options in this pool.
Parameters
tasksQueueOptions: TasksQueueOptions
-The worker tasks queue options.
+The worker node tasks queue options.
Returns void
set Worker Choice Strategy
@@ -811,7 +977,7 @@ Can be overridden.
set Worker Choice Strategy Options
@@ -831,7 +997,7 @@ Can be overridden.
Protected
setup@@ -844,7 +1010,19 @@ Can be overridden.
start
++- start(): void
+-
+
+
Starts the minimum number of workers in this pool.
+Returns void
+Protected
worker@@ -872,20 +1050,20 @@ Can be overridden.
-
+Settings
Settings
Member Visibility
Theme
@@ -895,7 +1073,7 @@ Can be overridden.- constructor
- emitter
- file
Path
-- max
+- max
- number
Of Workers
- opts
- promise
Response Map
@@ -904,101 +1082,69 @@ Can be overridden.
- busy
- full
- info
-- max
Size
+- max
Size
- min
Size
- ready
- type
- utilization
- worker
+- add
Task Function
- after
Task Execution Hook
- after
Worker Node Setup
- before
Task Execution Hook
-- check
Dynamic Pool Size
- create
And Setup Dynamic Worker Node
- create
And Setup Worker Node
- create
Worker
+- deregister
Worker Message Listener
- destroy
- destroy
Worker Node
- enable
Tasks Queue
- execute
- flush
Tasks Queue
- get
Worker Info
+- has
Task Function
- has
Worker Node Back Pressure
- internal
Busy
- is
Main
-- list
Task Functions
+- list
Task Function Names
+- register
Once Worker Message Listener
- register
Worker Message Listener
+- remove
Task Function
- send
Kill Message To Worker
- send
Startup Message To Worker
- send
To Worker
+- set
Default Task Function
- set
Tasks Queue Options
- set
Worker Choice Strategy
- set
Worker Choice Strategy Options
- setup
Hook
+- start
- worker
Listener