X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FFixedClusterPool.html;h=047b3fc19bb9cb529ff97fa003ded05527c455de;hb=bb379737d9bdc595e5265c63c327260b9d15a201;hp=5c59e9ab1c21b766ec76624e2937eeee502c0189;hpb=a15339d10554e3130fa1d8957163cb29a8eb2c41;p=poolifier.git diff --git a/docs/classes/FixedClusterPool.html b/docs/classes/FixedClusterPool.html index 5c59e9ab..047b3fc1 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:
-
+
+- '
@@ -157,7 +163,7 @@ +'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.'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.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
workerReadonly
workerAccessors
Protected
full@@ -244,7 +250,7 @@
info
@@ -256,93 +262,87 @@
Protected
maxPool maximum size.
+The pool maximum size.
Returns number
+Protected
minPool minimum size.
+The pool minimum size.
Returns number
+Private
readyReturns boolean
-Private
starting-- get starting(): boolean
--
-
-
Returns boolean
Inherited from AbstractPool.starting
--- Defined in src/pools/abstract-pool.ts:408
Protected
typePool type.
+The pool type.
If it is
'dynamic'
, it provides themax
property.Returns "fixed" | "dynamic"
Overrides AbstractPool.type
-- Defined in src/pools/cluster/fixed.ts:82
Private
utilizationGets the approximate pool utilization.
+The approximate pool utilization.
Returns number
The pool utilization.
Inherited from AbstractPool.utilization
-- Defined in src/pools/abstract-pool.ts:428
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"
Overrides AbstractPool.worker
-- Defined in src/pools/cluster/fixed.ts:87
Methods
Protected
after-- after
Task Execution Hook(worker, message): void
+- after
Task Execution Hook(workerNodeKey, message): void
-
-
-
-
@@ -364,28 +364,28 @@ Can be overridden.
-
-- Defined in src/pools/abstract-pool.ts:793
+
+ Worker Node Setup
Hook executed after the worker task execution. Can be overridden.
@@ -351,8 +351,8 @@ Can be overridden.Parameters
worker: Worker
-The worker.
+workerNodeKey: number
+The worker node key.
Inherited from AbstractPool.afterTaskExecutionHook
-- Defined in src/pools/abstract-pool.ts:692
Worker Setup
+Protected
afterProtected
after-- after
Worker Setup(worker): void
+- after
Worker Node Setup(workerNodeKey): void
-
-
-
-
-
+- Defined in src/pools/abstract-pool.ts:1026
Task Execution Hook
+- Defined in src/pools/abstract-pool.ts:772
Dynamic Pool Size
-
-- Defined in src/pools/abstract-pool.ts:180
+
+ And Setup Dynamic Worker Node
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
Inherited from AbstractPool.afterWorkerSetup
+Inherited from AbstractPool.afterWorkerNodeSetup
-- Defined in src/pools/abstract-pool.ts:927
Protected
before@@ -411,7 +411,7 @@ Can be overridden.
Inherited from AbstractPool.beforeTaskExecutionHook
-- Defined in src/pools/abstract-pool.ts:671
Protected
check@@ -427,33 +427,33 @@ Can be overridden.
Returns void
Inherited from AbstractPool.checkDynamicPoolSize
-- Defined in src/pools/abstract-pool.ts:164
And Setup Dynamic Worker
+Protected
createProtected
create-- create
And Setup Dynamic Worker(): Worker
+- create
And Setup Dynamic Worker Node(): number
-
-
-
-
-
-- Defined in src/pools/abstract-pool.ts:973
+
+ And Setup Worker Node
Creates a new dynamic worker and sets it up completely in the pool worker nodes.
+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.
Inherited from AbstractPool.createAndSetupDynamicWorker
+Inherited from AbstractPool.createAndSetupDynamicWorkerNode
-- Defined in src/pools/abstract-pool.ts:1010
And Setup Worker
+Protected
createProtected
create-- create
And Setup Worker(): Worker
+- create
And Setup Worker Node(): number
-
-
-
-
+- Defined in src/pools/abstract-pool.ts:933
Worker
+- Defined in src/pools/cluster/fixed.ts:105
- destroy(): Promise<void>
-
-
-
-- Defined in src/pools/abstract-pool.ts:718
+
+ 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.
Inherited from AbstractPool.createAndSetupWorker
+Inherited from AbstractPool.createAndSetupWorkerNode
-- Defined in src/pools/abstract-pool.ts:944
Protected
create@@ -466,39 +466,39 @@ Can be overridden.
Overrides AbstractPool.createWorker
-- Defined in src/pools/cluster/fixed.ts:77
destroy
Terminates every current worker in this pool.
+Terminates all workers in this pool.
Returns Promise<void>
Inherited from AbstractPool.destroy
-- Defined in src/pools/abstract-pool.ts:626
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:578
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>
Overrides AbstractPool.destroyWorker
+Overrides AbstractPool.destroyWorkerNode
-- Defined in src/pools/cluster/fixed.ts:63
enable Tasks Queue
@@ -523,11 +523,11 @@ Can be overridden.
Inherited from AbstractPool.enableTasksQueue
-- Defined in src/pools/abstract-pool.ts:531
execute
-- execute(data?, name?): Promise<Response>
+- execute(data?, name?, transferList?): Promise<Response>
-
@@ -536,12 +536,17 @@ Can be overridden.
-
-
+
+-
+
+- Defined in src/pools/abstract-pool.ts:659
+
+
+
+
Busy
- internal
Busy(): boolean
-
-
+- Defined in src/pools/abstract-pool.ts:629
Main
+- Defined in src/pools/cluster/fixed.ts:58
+
+
+
+
+
+
+
+
To Worker
Executes the specified function in the worker constructor with the task data input parameter.
-Optional
data: DataThe task input data for the specified worker 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 worker function to execute. If not specified, the default worker 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.
@@ -549,20 +554,55 @@ Can be overridden.Inherited from AbstractPool.execute
-- Defined in src/pools/abstract-pool.ts:591
Tasks Queue
+Protected
flush+- flush
Tasks Queue(workerNodeKey): void
+-
+
+
+
+
Parameters
++-
+
workerNodeKey: number
Returns void
Inherited from AbstractPool.flushTasksQueue
++- Defined in src/pools/abstract-pool.ts:1241
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.
+ +Inherited from AbstractPool.getWorkerInfo
++- Defined in src/pools/abstract-pool.ts:1180
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.
Inherited from AbstractPool.internalBusy
-- Defined in src/pools/abstract-pool.ts:582
Protected
is@@ -574,20 +614,110 @@ Can be overridden.
Overrides AbstractPool.isMain
-- Defined in src/pools/cluster/fixed.ts:58
list Task Functions
++- list
Task Functions(): string[]
+-
+
+
+
Lists the names of task function available in this pool.
+Returns string[]
The names of task function available in this pool.
+ +Inherited from AbstractPool.listTaskFunctions
++- Defined in src/pools/abstract-pool.ts:650
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
+Overrides AbstractPool.registerWorkerMessageListener
++- Defined in src/pools/cluster/fixed.ts:97
Kill Message To Worker
+Protected
send+- send
Kill Message To Worker(workerNodeKey, workerId): Promise<void>
+-
+
+
+
+
Parameters
++-
+
+-
+
workerNodeKey: number
workerId: number
Returns Promise<void>
Inherited from AbstractPool.sendKillMessageToWorker
++- Defined in src/pools/abstract-pool.ts:727
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
+Overrides AbstractPool.sendStartupMessageToWorker
++- Defined in src/pools/cluster/fixed.ts:89
Protected
send-- send
To Worker(worker, message): void
+- send
To Worker(workerNodeKey, message): void
-
-
-
-
-
@@ -599,7 +729,7 @@ Can be overridden.
+- Defined in src/pools/cluster/fixed.ts:81
+- Defined in src/pools/abstract-pool.ts:590
+- Defined in src/pools/abstract-pool.ts:548
+- Defined in src/pools/abstract-pool.ts:567
Hook
+- Defined in src/pools/cluster/fixed.ts:53
Listener
- worker
Listener(): ((message) => void)
-
-
- (message): void
-
-
+- Defined in src/pools/abstract-pool.ts:1109
@@ -739,23 +869,28 @@ Can be overridden.
- max
Size
- min
Size
- ready
-- starting
- type
- utilization
- worker
- after
Task Execution Hook
-- after
Worker Setup
+- after
Worker Node Setup
- before
Task Execution Hook
- check
Dynamic Pool Size
-- create
And Setup Dynamic Worker
-- create
And Setup Worker
+- 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
+- list
Task Functions
+- register
Worker Message Listener
+- send
Kill Message To Worker
+- send
Startup Message To Worker
- send
To Worker
- set
Tasks Queue Options
- set
Worker Choice Strategy
@@ -763,7 +898,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.
Overrides AbstractPool.sendToWorker
-- Defined in src/pools/cluster/fixed.ts:72
set Tasks Queue Options
@@ -619,7 +749,7 @@ Can be overridden.
Inherited from AbstractPool.setTasksQueueOptions
-- Defined in src/pools/abstract-pool.ts:543
set Worker Choice Strategy
@@ -644,7 +774,7 @@ Can be overridden.
Inherited from AbstractPool.setWorkerChoiceStrategy
-- Defined in src/pools/abstract-pool.ts:501
set Worker Choice Strategy Options
@@ -664,7 +794,7 @@ Can be overridden.
Inherited from AbstractPool.setWorkerChoiceStrategyOptions
-- Defined in src/pools/abstract-pool.ts:520
Protected
setup@@ -677,13 +807,13 @@ Can be overridden.
Overrides AbstractPool.setupHook
-- Defined in src/pools/cluster/fixed.ts:53
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.
@@ -692,7 +822,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
@@ -705,7 +835,7 @@ Can be overridden.Inherited from AbstractPool.workerListener
-- Defined in src/pools/abstract-pool.ts:1041