X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=docs%2Fclasses%2FFixedClusterPool.html;h=87d99e57ff83987cf3ad5445a3cf7eddc9eacdab;hb=1cc6e9ef64f399f4ca58da8079ef72a011ac4227;hp=c7fc9ed3696045d1b8ae767000e084404c76a84a;hpb=6b83e544b1827a8a04898c3032dab73fe19687e6;p=poolifier.git diff --git a/docs/classes/FixedClusterPool.html b/docs/classes/FixedClusterPool.html index c7fc9ed3..87d99e57 100644 --- a/docs/classes/FixedClusterPool.html +++ b/docs/classes/FixedClusterPool.html @@ -1,13 +1,13 @@ -
Optional
Readonly
emitter
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:
-
-
+
+
+
+
'full'
: Emitted when the pool is dynamic and the number of workers created has reached the maximum size expected.'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.'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 >= maximum queue size).Protected
Readonly
file
+Protected
Optional
Readonly
maxDynamic pool maximum size property placeholder.
+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
worker Nodes
+Readonly
workerReadonly
Internal
workerPool worker nodes.
Accessors
Protected
full@@ -247,7 +269,7 @@
info
@@ -259,31 +281,31 @@
Size
-Protected
max+- get maxSize(): number
-
The pool maximum size.
Returns number
Size
-Protected
min+- get minSize(): number
-
The pool minimum size.
Returns number
Private
ready@@ -295,7 +317,7 @@
Protected
type@@ -308,7 +330,7 @@
Private
utilization@@ -321,7 +343,7 @@
Protected
worker@@ -333,9 +355,40 @@
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@@ -361,7 +414,7 @@ Can be overridden.
Protected
after@@ -382,7 +435,7 @@ Can be overridden.
Protected
before@@ -408,23 +461,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@@ -437,7 +474,7 @@ Can be overridden.
Protected
create@@ -450,7 +487,7 @@ Can be overridden.
Protected
create@@ -463,7 +500,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
@@ -475,7 +553,7 @@ Can be overridden.
Protected
destroy@@ -495,36 +573,36 @@ 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
-- execute(data?, name?): Promise<Response>
+- execute(data?, name?, transferList?): Promise<Response>
-
@@ -533,12 +611,17 @@ Can be overridden.
-
-
+
+-
+
+- Defined in src/pools/abstract-pool.ts:870
Tasks Queue
+- Defined in src/pools/abstract-pool.ts:1667
Worker Info
+- Defined in src/pools/abstract-pool.ts:1583
+
+
+
+
Busy
+- Defined in src/pools/abstract-pool.ts:667
Main
+- Defined in src/pools/cluster/fixed.ts:58
+
+
+
+
Worker Message Listener
+- Defined in src/pools/cluster/fixed.ts:100
+
+
+
+
Startup Message To Worker
+- Defined in src/pools/cluster/fixed.ts:93
To Worker
+- Defined in src/pools/cluster/fixed.ts:82
+
+
- set
Tasks Queue Options(tasksQueueOptions): void
-
-
-
+- Defined in src/pools/abstract-pool.ts:579
+- Defined in src/pools/abstract-pool.ts:532
+- Defined in src/pools/abstract-pool.ts:551
Hook
+- Defined in src/pools/cluster/fixed.ts:53
+
+
Listener
+- Defined in src/pools/abstract-pool.ts:1495
+
+
+
+
-
Executes the specified function in the worker constructor with the task data input parameter.
-Optional
data: DataThe task input data for the specified task function. This can only be structured-cloneable data.
+The optional task input data for the specified task function. This can only be structured-cloneable data.
-Optional
name: stringThe name of the task function to execute. If not specified, the default task function will be executed.
+The optional name of the task function to execute. If not specified, the default task function will be executed.
+
+Optional
transferList: TransferListItem[]An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the pool's worker_threads worker and they should not be used in the main thread afterwards.
Returns Promise<Response>
Promise that will be fulfilled when the task is completed.
@@ -546,7 +629,7 @@ Can be overridden.Protected
flush@@ -560,7 +643,7 @@ Can be overridden.
Returns void
Protected
get@@ -581,7 +664,49 @@ 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
++- has
Worker Node Back Pressure(workerNodeKey): boolean
+
+
+
+
Internal
+Whether the worker node has back pressure (i.e. its tasks queue is full).
+Parameters
++-
+
+
workerNodeKey: number
+The worker node key.
+Returns boolean
+ +true
if the worker node has back pressure,false
otherwise.Protected
internal@@ -594,7 +719,7 @@ Can be overridden.
Protected
is@@ -606,7 +731,61 @@ Can be overridden.
list Task Function Names
++- 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@@ -647,7 +826,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. Kill Message To Worker
+Protected
send+- send
Kill Message To Worker(workerNodeKey): Promise<void>
+-
+
+
+
Parameters
++-
+
workerNodeKey: number
Returns Promise<void>
Protected
send@@ -667,7 +881,7 @@ Can be overridden.
Protected
send@@ -692,27 +906,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
@@ -737,7 +972,7 @@ Can be overridden.
set Worker Choice Strategy Options
@@ -757,7 +992,7 @@ Can be overridden.
Protected
setup@@ -770,7 +1005,19 @@ Can be overridden.
start
++- start(): void
+-
+
+
Starts the minimum number of workers in this pool.
+Returns void
+Protected
worker@@ -798,20 +1045,20 @@ Can be overridden.
-
+Settings
Settings
Member Visibility
Theme
@@ -821,6 +1068,7 @@ Can be overridden.- constructor
- emitter
- file
Path
+- max
- number
Of Workers
- opts
- promise
Response Map
@@ -829,97 +1077,69 @@ Can be overridden.
- busy
- full
- info
-- max
Size
-- min
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 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
Generated using TypeDoc
Generated using TypeDoc