X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FFixedClusterPool.html;h=f9dfcb3931ff6e9456eb709d474b12fb2b9b622d;hb=b2ec8632edaea1f4ee24a532e61ca6e5619b7bfb;hp=e6ab2343f375843223fe97b5d32311ed9df75d6d;hpb=52f4e8137eab5d72c663eb9ae9289c08d804e559;p=poolifier.git diff --git a/docs/classes/FixedClusterPool.html b/docs/classes/FixedClusterPool.html index e6ab2343..f9dfcb39 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
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
workerReadonly
Internal
workerPool worker nodes.
Accessors
Protected
full@@ -244,7 +270,7 @@
info
@@ -256,93 +282,118 @@
Size
-Protected
max+- get maxSize(): number
-
-
+- Defined in src/pools/abstract-pool.ts:486
+
Pool maximum size.
+The pool maximum size.
Returns number
- Size
-Protected
min+- get minSize(): number
-
-
- Defined in src/pools/abstract-pool.ts:479
- get ready(): boolean
-
-
-
-
+- Defined in src/pools/abstract-pool.ts:431
- get type(): "fixed" | "dynamic"
-
-
+- Defined in src/pools/cluster/fixed.ts:130
- get utilization(): number
-
-
+- Defined in src/pools/abstract-pool.ts:448
Pool 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:405
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:425
Protected
worker-- get worker(): "cluster" | "thread"
+- get worker(): "thread" | "cluster"
-
-
-
+- Defined in src/pools/cluster/fixed.ts:135
+
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
+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.Inherited from AbstractPool.addTaskFunction
++- Defined in src/pools/abstract-pool.ts:805
Protected
after-- after
Task Execution Hook(worker, message): void
+- after
Task Execution Hook(workerNodeKey, message): void
-
-
-
-
@@ -364,28 +415,28 @@ Can be overridden.
-
-- Defined in src/pools/abstract-pool.ts:1043
+
+ Worker Node Setup
Hook executed after the worker task execution. Can be overridden.
@@ -351,8 +402,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:689
Worker Setup
+Protected
afterProtected
after-- after
Worker Setup(worker): void
+- after
Worker Node Setup(workerNodeKey): void
-
-
-
-
-
+- Defined in src/pools/abstract-pool.ts:1356
Task Execution Hook
-
-
-
-- Defined in src/pools/abstract-pool.ts:1013
+
+ 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:924
Protected
before@@ -411,49 +462,33 @@ Can be overridden.
Inherited from AbstractPool.beforeTaskExecutionHook
-- Defined in src/pools/abstract-pool.ts:668
Dynamic Pool Size
-Protected
check-- check
Dynamic Pool Size(min, max): void
--
-
-
-
-
Parameters
---
-
--
-
min: number
max: number
Returns void
Inherited from AbstractPool.checkDynamicPoolSize
--- Defined in src/pools/abstract-pool.ts:161
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:1260
+
+ 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:1007
And Setup Worker
+Protected
createProtected
create-- create
And Setup Worker(): Worker
+- create
And Setup Worker Node(): number
-
-
-
-
+- Defined in src/pools/abstract-pool.ts:1216
Worker
+- Defined in src/pools/cluster/fixed.ts:125
+
+
- destroy(): Promise<void>
-
-
-
-- Defined in src/pools/abstract-pool.ts:949
+
+ 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:941
Protected
create@@ -466,68 +501,109 @@ Can be overridden.
Overrides AbstractPool.createWorker
-- Defined in src/pools/cluster/fixed.ts:77
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
+Overrides AbstractPool.deregisterWorkerMessageListener
++- Defined in src/pools/cluster/fixed.ts:117
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:623
Worker
+Protected
destroyProtected
destroy-- destroy
Worker(worker): void
+- destroy
Worker Node(workerNodeKey): Promise<void>
-
-
-
-
-
-
+- Defined in src/pools/cluster/fixed.ts:63
- enable
Tasks Queue(enable, tasksQueueOptions?): void
-
-
-
-
+- Defined in src/pools/abstract-pool.ts:564
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
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
Inherited from AbstractPool.enableTasksQueue
-- Defined in src/pools/abstract-pool.ts:528
execute
-- execute(data?, name?): Promise<Response>
+- execute(data?, name?, transferList?): Promise<Response>
-
@@ -536,12 +612,17 @@ Can be overridden.
-
-
+
+-
+
+- Defined in src/pools/abstract-pool.ts:879
+
+
+
+
+
+
+
+
+
+
Busy
- internal
Busy(): boolean
-
-
+- Defined in src/pools/abstract-pool.ts:676
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 +630,111 @@ Can be overridden.Inherited from AbstractPool.execute
-- Defined in src/pools/abstract-pool.ts:588
Worker Node As Not Ready
+Protected
flag+- flag
Worker Node As Not Ready(workerNodeKey): void
+-
+
+
+
+
Parameters
++-
+
workerNodeKey: number
Returns void
Inherited from AbstractPool.flagWorkerNodeAsNotReady
++- Defined in src/pools/abstract-pool.ts:1649
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:1696
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:1608
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.Inherited from AbstractPool.hasTaskFunction
++- Defined in src/pools/abstract-pool.ts:792
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.Inherited from AbstractPool.hasWorkerNodeBackPressure
++- Defined in src/pools/abstract-pool.ts:1654
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:579
Protected
is@@ -574,20 +746,170 @@ Can be overridden.
Overrides AbstractPool.isMain
-- Defined in src/pools/cluster/fixed.ts:58
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.
+ +Inherited from AbstractPool.listTaskFunctionNames
++- Defined in src/pools/abstract-pool.ts:844
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
+Overrides AbstractPool.registerOnceWorkerMessageListener
++- Defined in src/pools/cluster/fixed.ts:109
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:101
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.Inherited from AbstractPool.removeTaskFunction
++- Defined in src/pools/abstract-pool.ts:828
Kill Message To Worker
+Protected
send+- send
Kill Message To Worker(workerNodeKey): Promise<void>
+-
+
+
+
+
Parameters
++-
+
workerNodeKey: number
Returns Promise<void>
Inherited from AbstractPool.sendKillMessageToWorker
++- Defined in src/pools/abstract-pool.ts:960
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:94
Protected
send-- send
To Worker(worker, message): void
+- send
To Worker(workerNodeKey, message): void
-
-
-
-
-
@@ -599,27 +921,48 @@ Can be overridden.
+- Defined in src/pools/cluster/fixed.ts:83
+
+
- set
Tasks Queue Options(tasksQueueOptions): void
-
-
-
+- Defined in src/pools/abstract-pool.ts:578
+- Defined in src/pools/abstract-pool.ts:531
+- Defined in src/pools/abstract-pool.ts:550
Hook
-
-
+
+
+
-
-
\ No newline at end of file
+
+
\ No newline at end of file
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 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.Inherited from AbstractPool.setDefaultTaskFunction
++- Defined in src/pools/abstract-pool.ts:857
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
Inherited from AbstractPool.setTasksQueueOptions
-- Defined in src/pools/abstract-pool.ts:540
set Worker Choice Strategy
@@ -644,7 +987,7 @@ Can be overridden.
Inherited from AbstractPool.setWorkerChoiceStrategy
-- Defined in src/pools/abstract-pool.ts:498
set Worker Choice Strategy Options
@@ -664,7 +1007,7 @@ Can be overridden.
Inherited from AbstractPool.setWorkerChoiceStrategyOptions
-- Defined in src/pools/abstract-pool.ts:517
Protected
setup@@ -677,40 +1020,41 @@ Can be overridden.
Overrides AbstractPool.setupHook
-- Defined in src/pools/cluster/fixed.ts:53
Listener
-Protected
worker-- worker
Listener(): ((message) => void)
+- Defined in src/pools/cluster/fixed.ts:53
start
++- start(): void
-
-
-
+
+- start
+- worker
Message Listener
-
This function is the listener registered for each worker message.
+Starts the minimum number of workers in this pool.
Returns ((message) => void)
The listener function to execute when a message is received from a worker.
- ---
-
+-- (message): void
+
+
Returns void
+Inherited from AbstractPool.start
++- Defined in src/pools/abstract-pool.ts:933
Message Listener
+Protected
worker+- worker
Message Listener(message): void
-
-
-
-
-
+ - Defined in src/pools/abstract-pool.ts:1518
This function is the listener registered for each worker message.
+This method is the message listener registered on each worker.
Parameters
message: MessageValue<Response, unknown>
Returns void
The listener function to execute when a message is received from a worker.
- - +Returns void
Inherited from AbstractPool.workerListener
+Inherited from AbstractPool.workerMessageListener
-- Defined in src/pools/abstract-pool.ts:1038
-
+Settings
Settings
Member Visibility
Generated using TypeDoc
Generated using TypeDoc