X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=docs%2Fclasses%2FFixedClusterPool.html;h=e6ab2343f375843223fe97b5d32311ed9df75d6d;hb=3e406edee2c758263a2e8d8bbbaaeff951a3db7a;hp=ae98e9d354878450eb53b83eb4ecdf589d710956;hpb=004a8816ae9b52388de246a9c7a5184a73915ad6;p=poolifier.git diff --git a/docs/classes/FixedClusterPool.html b/docs/classes/FixedClusterPool.html index ae98e9d3..e6ab2343 100644 --- a/docs/classes/FixedClusterPool.html +++ b/docs/classes/FixedClusterPool.html @@ -1,4 +1,4 @@ -
A cluster pool with a fixed number of workers.
-It is possible to perform tasks in sync or asynchronous mode as you prefer.
-This pool selects the workers in a round robin fashion.
Author
Christopher Quadflieg
@@ -30,12 +28,12 @@Data = unknown
-Type of data sent to the worker. This can only be serializable data.
+Type of data sent to the worker. This can only be structured-cloneable data.
Response = unknown
-Type of execution response. This can only be serializable data.
+Type of execution response. This can only be structured-cloneable data.
@@ -74,15 +72,19 @@ info max Size
min Size
+ready
+starting
type
+utilization
worker
Methods
Properties
Emitter on which events can be listened to.
Events that can currently be listened to:
-
-
+
+
+
@@ -155,7 +157,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
optsProtected
promiseProtected
workerWorker choice strategy context referencing a worker choice algorithm implementation.
-Default to a round robin algorithm.
Nodes
-Readonly
workerPool worker nodes.
Accessors
Protected
full@@ -243,7 +244,7 @@
info
@@ -255,7 +256,7 @@
Protected
max@@ -267,7 +268,7 @@
Protected
min@@ -279,7 +280,25 @@
+Private
ready+- get ready(): boolean
+-
+
Returns boolean
+Private
starting+- get starting(): boolean
+-
+
Returns boolean
Protected
type@@ -292,7 +311,20 @@
+Private
utilization+- get utilization(): number
+-
+
+
Gets the approximate pool utilization.
+Returns number
The pool utilization.
+ +Protected
worker@@ -304,7 +336,7 @@
Methods
message: MessageValue<Response, Worker | MessagePort>
+message: MessageValue<Response, unknown>
The received message.
Worker Setup
-Protected
after+- after
Worker Setup(worker): void
-
-
- Defined in src/pools/abstract-pool.ts:924
Task Execution Hook
-
-- Defined in src/pools/abstract-pool.ts:668
+
+
+
+ And Setup Dynamic Worker
Function that can be hooked up when a worker has been newly created and moved to the pool worker nodes.
-Can be used to update the
+maxListeners
or binding themain-worker
<->worker
connection if not bind by default.Function that can be hooked up when a worker has been newly created and moved to the pool worker nodes. +Can be overridden.
Parameters
@@ -351,13 +383,13 @@ Can be overridden.Returns void
+Protected
before-- before
Task Execution Hook(workerNodeKey): void
+- before
Task Execution Hook(workerNodeKey, task): void
-
+
+-
+
Hook executed before the worker task execution. Can be overridden.
@@ -369,26 +401,46 @@ Can be overridden.workerNodeKey: number
The worker node key.
task: Task<Data>
+The task to execute.
+Returns void
Worker Node
+Protected
choose Dynamic Pool Size
+Protected
check+- check
Dynamic Pool Size(min, max): void
+-
+
+
+
Parameters
++-
+
+-
+
min: number
max: number
Returns void
Protected
create-- choose
Worker Node(): number
+- create
And Setup Dynamic Worker(): Worker
-
-
-- Defined in src/pools/abstract-pool.ts:1007
And Setup Worker
+- Defined in src/pools/abstract-pool.ts:941
Worker
- create
Worker(): Worker
-
-
-- Defined in src/pools/cluster/fixed.ts:77
- destroy(): Promise<void>
-
-
- Defined in src/pools/abstract-pool.ts:623
Worker
- destroy
Worker(worker): void
-
-
- Defined in src/pools/cluster/fixed.ts:63
+- Defined in src/pools/abstract-pool.ts:528
@@ -583,7 +599,7 @@ Can be overridden.
+- Defined in src/pools/cluster/fixed.ts:72
+- Defined in src/pools/abstract-pool.ts:540
+- Defined in src/pools/abstract-pool.ts:498
+- Defined in src/pools/abstract-pool.ts:517
Hook
- setup
Hook(): void
-
-
+- Defined in src/pools/cluster/fixed.ts:53
Listener
+
+ - Defined in src/pools/abstract-pool.ts:1038
@@ -722,12 +738,16 @@ Can be overridden
- info
- max
Size
- min
Size
+- ready
+- starting
- type
+- utilization
- worker
- after
Task Execution Hook
-- after
Worker Setup
+- after
Worker Setup
- before
Task Execution Hook
-- choose
Worker Node
+- check
Dynamic Pool Size
+- create
And Setup Dynamic Worker
- create
And Setup Worker
- create
Worker
- destroy
@@ -736,7 +756,6 @@ Can be overridden
- execute
- internal
Busy
- is
Main
-- register
Worker Message Listener
- send
To Worker
- set
Tasks Queue Options
- set
Worker Choice Strategy
@@ -744,7 +763,7 @@ Can be overridden
- setup
Hook
- worker
Listener
-
+ - Worker
Types
+- available
Parallelism
Chooses a worker node for the next task.
-The default worker choice strategy uses a round robin algorithm to distribute the load.
+Creates a new dynamic worker and sets it up completely in the pool worker nodes.
Returns number
The worker node key
+Returns Worker
New, completely set up dynamic worker.
+Protected
create@@ -401,37 +453,38 @@ Can be overridden.
Protected
createReturns a newly created worker.
+Creates a new worker.
Returns Worker
+Returns Worker
Newly created worker.
+ +destroy
Shutdowns every current worker in this pool.
+Terminates every current worker in this pool.
Returns Promise<void>
+Protected
destroyShutdowns the given worker.
+Terminates the given worker.
Parameters
@@ -445,7 +498,7 @@ Can be overridden. +enable Tasks Queue
@@ -470,7 +523,7 @@ Can be overridden.
execute
@@ -483,7 +536,7 @@ Can be overridden.-
-
@@ -496,16 +549,20 @@ Can be overridden.
+- Defined in src/pools/abstract-pool.ts:588
Busy
- internal
Busy(): boolean
-
-
+- Defined in src/pools/abstract-pool.ts:579
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 serializable data.
+The task input data for the specified worker function. This can only be structured-cloneable data.
Protected
internalReturns boolean
Protected
is@@ -517,48 +574,7 @@ Can be overridden.
Overrides AbstractPool.isMain
-- Defined in src/pools/cluster/fixed.ts:68
Worker Message Listener
-Protected
register-- register
Worker Message Listener<Message>(worker, listener): void
--
-
-
-
-
-
-
-
Registers a listener callback on the given worker.
-Type Parameters
---
-
Message
Parameters
---
-
-
--
-
-
-
worker: Worker
-The worker which should register a listener.
-listener: ((message) => void)
-The message listener callback.
---
-
-- (message): void
--
-
-
-
Parameters
---
-
message: MessageValue<Message, Worker | MessagePort>
Returns void
Returns void
-Overrides AbstractPool.registerWorkerMessageListener
--- Defined in src/pools/cluster/fixed.ts:84
Protected
send@@ -575,7 +591,7 @@ Can be overridden.
message: MessageValue<Data, Worker | MessagePort>
+message: MessageValue<Data, unknown>
The message.
Overrides AbstractPool.sendToWorker
-- Defined in src/pools/cluster/fixed.ts:79
set Tasks Queue Options
@@ -603,7 +619,7 @@ Can be overridden.
Inherited from AbstractPool.setTasksQueueOptions
-- Defined in src/pools/abstract-pool.ts:340
set Worker Choice Strategy
@@ -615,7 +631,7 @@ Can be overridden.-
-
@@ -628,7 +644,7 @@ Can be overridden.
Parameters
workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
+workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
The worker choice strategy.
Inherited from AbstractPool.setWorkerChoiceStrategy
-- Defined in src/pools/abstract-pool.ts:285
set Worker Choice Strategy Options
@@ -648,20 +664,20 @@ Can be overridden.
Inherited from AbstractPool.setWorkerChoiceStrategyOptions
-- Defined in src/pools/abstract-pool.ts:317
Protected
setupSetup hook to execute code before worker node are created in the abstract constructor. -Can be overridden
+Setup hook to execute code before worker nodes are created in the abstract constructor. +Can be overridden.
Returns void
Overrides AbstractPool.setupHook
-- Defined in src/pools/cluster/fixed.ts:63
Protected
worker@@ -682,14 +698,14 @@ Can be overridden-
-
Parameters
message: MessageValue<Response, Worker | MessagePort>
message: MessageValue<Response, unknown>
Returns void
The listener function to execute when a message is received from a worker.
Inherited from AbstractPool.workerListener
-- Defined in src/pools/abstract-pool.ts:653
Generated using TypeDoc