X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=inline;f=docs%2Fclasses%2FFixedClusterPool.html;h=c7fc9ed3696045d1b8ae767000e084404c76a84a;hb=c4424e52e4924efa5eef704cb5dcb82f2760e0da;hp=b00d1c78b4e76effc3ad44b4415be91947e3444d;hpb=b93080b79a5e2e5d174991d87e96c97b307df18e;p=poolifier.git diff --git a/docs/classes/FixedClusterPool.html b/docs/classes/FixedClusterPool.html index b00d1c78..c7fc9ed3 100644 --- a/docs/classes/FixedClusterPool.html +++ b/docs/classes/FixedClusterPool.html @@ -1,4 +1,4 @@ -
Emitter on which events can be listened to.
Events that can currently be listened to:
-
-
+
+
+
@@ -154,7 +160,7 @@ +'full'
: Emitted when the pool is dynamic and full.'busy'
: Emitted when the pool is busy.'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.'error'
: Emitted when an uncaught error occurs.'taskError'
: Emitted when an error occurs while executing a task.Protected
Readonly
fileProtected
Readonly
numberProtected
Readonly
opts Response Map
-Protected
promiseThe 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
workerPool worker nodes.
Accessors
Protected
full@@ -241,7 +247,7 @@
info
@@ -253,88 +259,87 @@
Protected
maxPool maximum size.
+The pool maximum size.
Returns number
+Protected
minPool minimum size.
+The pool minimum size.
Returns number
- Time
+Private
runPrivate
ready-- get runTime(): number
+- get ready(): boolean
-
-
-- Defined in src/pools/abstract-pool.ts:444
- get type(): "fixed" | "dynamic"
-
-
- Defined in src/pools/cluster/fixed.ts:110
- get utilization(): number
-
-
- Defined in src/pools/abstract-pool.ts:461
Gets the pool run time.
+The pool readiness boolean status.
Returns number
The pool run time in milliseconds.
- +Returns boolean
+Protected
typePool type.
+The pool type.
If it is
'dynamic'
, it provides themax
property.Returns "fixed" | "dynamic"
+Private
utilizationGets the approximate pool utilization.
+The approximate pool utilization.
Returns number
The pool utilization.
+Protected
worker-- get worker(): "cluster" | "thread"
+- get worker(): "thread" | "cluster"
-
-
-- Defined in src/pools/cluster/fixed.ts:115
Task Execution Hook
Gets the worker type.
+The worker type.
Returns "cluster" | "thread"
+Returns "thread" | "cluster"
+Methods
Protected
after-- after
Task Execution Hook(worker, message): void
+- after
Task Execution Hook(workerNodeKey, message): void
-
-
-
-
@@ -356,28 +361,28 @@ Can be overridden.
-
-- Defined in src/pools/abstract-pool.ts:733
+
+ Worker Node Setup
Hook executed after the worker task execution. Can be overridden.
@@ -343,8 +348,8 @@ Can be overridden.Parameters
worker: Worker
-The worker.
+workerNodeKey: number
+The worker node key.
Worker Setup
+Protected
afterProtected
after-- after
Worker Setup(worker): void
+- after
Worker Node Setup(workerNodeKey): void
-
-
-
-
+- Defined in src/pools/abstract-pool.ts:962
Task Execution Hook
-
-- Defined in src/pools/abstract-pool.ts:712
+
+ Dynamic Pool Size
Function that can be hooked up when a worker has been newly created and moved to the pool worker nodes. +
Method hooked up after a worker node has been newly created. Can be overridden.
Parameters
worker: Worker
-The newly created worker.
+workerNodeKey: number
+The newly created worker node key.
Returns void
Protected
before@@ -403,33 +408,49 @@ Can be overridden.
And Setup Dynamic Worker
+Protected
createProtected
check-- create
And Setup Dynamic Worker(): Worker
+- check
Dynamic Pool Size(min, max): void
-
-
+
+
+
-
-- Defined in src/pools/abstract-pool.ts:911
+
+ And Setup Worker Node
Creates a new dynamic worker and sets it up completely in the pool worker nodes.
+Parameters
++-
+
+-
+
min: number
max: number
Returns void
+ And Setup Dynamic Worker Node
+Protected
create+- create
And Setup Dynamic Worker Node(): number
+-
+
-
Creates a new, completely set up dynamic worker node.
Returns Worker
New, completely set up dynamic worker.
+Returns number
New, completely set up dynamic worker node key.
And Setup Worker
+Protected
createProtected
create-- create
And Setup Worker(): Worker
+- create
And Setup Worker Node(): number
-
-
-- Defined in src/pools/abstract-pool.ts:871
Worker
+- Defined in src/pools/cluster/fixed.ts:105
- destroy(): Promise<void>
-
-
-- Defined in src/pools/abstract-pool.ts:675
+
+ Worker Node
Creates a new worker and sets it up completely in the pool worker nodes.
+Creates a new, completely set up worker node.
Returns Worker
New, completely set up worker.
+Returns number
New, completely set up worker node key.
+Protected
create@@ -442,39 +463,39 @@ Can be overridden.
destroy
Terminates every current worker in this pool.
+Terminates all workers in this pool.
Returns Promise<void>
- Worker
+Protected
destroyProtected
destroy-- destroy
Worker(worker): void
+- destroy
Worker Node(workerNodeKey): Promise<void>
-
-
-
-
-
+- Defined in src/pools/cluster/fixed.ts:63
+- Defined in src/pools/abstract-pool.ts:571
Terminates the given worker.
+Terminates the worker node given its worker node key.
Parameters
worker: Worker
-A worker within
+workerNodes
.workerNodeKey: number
+The worker node key.
Returns void
+Returns Promise<void>
enable Tasks Queue
@@ -499,7 +520,7 @@ Can be overridden.
execute
@@ -512,12 +533,12 @@ Can be overridden.-
-
+- Defined in src/pools/abstract-pool.ts:643
+
+
+
+
Busy
- internal
Busy(): boolean
-
-
- Defined in src/pools/abstract-pool.ts:622
Main
+- Defined in src/pools/cluster/fixed.ts:58
+
+
+
+
To Worker
-Optional
data: DataThe task input data for the specified worker function. This can only be structured-cloneable data.
+The task input data for the specified task function. This can only be structured-cloneable data.
-Optional
name: stringThe name of the worker function to execute. If not specified, the default worker function will be executed.
+The name of the task function to execute. If not specified, the default task function will be executed.
Returns Promise<Response>
Promise that will be fulfilled when the task is completed.
@@ -525,20 +546,55 @@ Can be overridden. Tasks Queue
+Protected
flush+- flush
Tasks Queue(workerNodeKey): void
+-
+
+
+
Parameters
++-
+
workerNodeKey: number
Returns void
Worker Info
+Protected
get+- get
Worker Info(workerNodeKey): WorkerInfo
+-
+
+
+
+
Gets the worker information given its worker node key.
+Parameters
++-
+
+
workerNodeKey: number
+The worker node key.
+Returns WorkerInfo
The worker information.
+ +Protected
internalWhether worker nodes are executing at least one task.
+Whether worker nodes are executing concurrently their tasks quota or not.
Returns boolean
Worker nodes busyness boolean status.
+Protected
is@@ -550,20 +606,81 @@ Can be overridden.
Worker Message Listener
+Protected
register+- register
Worker Message Listener<Message>(workerNodeKey, listener): void
+-
+
+
+
+
+
+
Registers 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
+ Startup Message To Worker
+Protected
send+- send
Startup Message To Worker(workerNodeKey): void
+-
+
+
+
+
Sends the startup message to worker given its worker node key.
+Parameters
++-
+
+
workerNodeKey: number
+The worker node key.
+Returns void
+Protected
send-- send
To Worker(worker, message): void
+- send
To Worker(workerNodeKey, message): void
-
-
-
-
-
@@ -575,7 +692,7 @@ Can be overridden.
+- Defined in src/pools/cluster/fixed.ts:81
+- Defined in src/pools/abstract-pool.ts:583
+- Defined in src/pools/abstract-pool.ts:541
+- Defined in src/pools/abstract-pool.ts:560
Hook
+- Defined in src/pools/cluster/fixed.ts:53
Listener
- worker
Listener(): ((message) => void)
-
-
- (message): void
-
-
+- Defined in src/pools/abstract-pool.ts:1045
@@ -714,22 +831,27 @@ Can be overridden.
- info
- max
Size
- min
Size
-- run
Time
+- ready
- type
- utilization
- worker
- after
Task Execution Hook
-- after
Worker Setup
+- after
Worker Node Setup
- before
Task Execution Hook
-- create
And Setup Dynamic Worker
-- create
And Setup Worker
+- check
Dynamic Pool Size
+- create
And Setup Dynamic Worker Node
+- create
And Setup Worker Node
- create
Worker
- destroy
-- destroy
Worker
+- destroy
Worker Node
- enable
Tasks Queue
- execute
+- flush
Tasks Queue
+- get
Worker Info
- internal
Busy
- is
Main
+- register
Worker Message Listener
+- send
Startup Message To Worker
- send
To Worker
- set
Tasks Queue Options
- set
Worker Choice Strategy
@@ -737,7 +859,7 @@ Can be overridden.
- setup
Hook
- worker
Listener
-
Sends a message to the given worker.
+Sends a message to worker given its worker node key.
Parameters
worker: Worker
-The worker which should receive the message.
+workerNodeKey: number
+The worker node key.
set Tasks Queue Options
@@ -595,7 +712,7 @@ Can be overridden.
set Worker Choice Strategy
@@ -620,7 +737,7 @@ Can be overridden.
set Worker Choice Strategy Options
@@ -640,7 +757,7 @@ Can be overridden.
Protected
setup@@ -653,13 +770,13 @@ Can be overridden.
Protected
workerThis function is the listener registered for each worker message.
+This method is the listener registered for each worker message.
Returns ((message) => void)
The listener function to execute when a message is received from a worker.
@@ -668,7 +785,7 @@ Can be overridden.This function is the listener registered for each worker message.
+This method is the listener registered for each worker message.
Parameters
@@ -681,7 +798,7 @@ Can be overridden.