X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=inline;f=docs%2Fclasses%2FDynamicThreadPool.html;h=b3ee70eadf3e2c512471b55111dae3fd9961c71d;hb=658b9aa08266ed9a8ae3c0fc947d237fa2674f09;hp=93bbe7ee0d6b034de84e843023ff06a123f22c46;hpb=f45a3823ad04902b4c446c7c7de55ca183041953;p=poolifier.git diff --git a/docs/classes/DynamicThreadPool.html b/docs/classes/DynamicThreadPool.html index 93bbe7ee..b3ee70ea 100644 --- a/docs/classes/DynamicThreadPool.html +++ b/docs/classes/DynamicThreadPool.html @@ -1,4 +1,4 @@ -
Generated using TypeDoc
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,6 +74,7 @@ When the maximum number of threads is reached and workers are busy, an event is max Size
min Size
type
+utilization
worker
Properties
Protected
Readonly
fileProtected
Readonly
maxProtected
Readonly
numberProtected
Readonly
opts Response Map
-Protected
promiseThe execution response promise map.
key
: The message id of each submitted task. Choice Strategy Context
-Protected
workerWorker choice strategy context referencing a worker choice algorithm implementation.
-Default to a round robin algorithm.
Nodes
-Readonly
workerPool worker nodes.
Accessors
Protected
full@@ -255,7 +254,7 @@ When the maximum number of threads is reached and workers are busy, an event is
info
@@ -267,7 +266,7 @@ When the maximum number of threads is reached and workers are busy, an event is
Protected
max@@ -279,7 +278,7 @@ When the maximum number of threads is reached and workers are busy, an event is
Protected
min@@ -291,7 +290,7 @@ When the maximum number of threads is reached and workers are busy, an event is
Protected
type@@ -304,7 +303,20 @@ When the maximum number of threads is reached and workers are busy, an event is
+Private
utilization+- get utilization(): number
+-
+
+
Gets the approximate pool utilization.
+Returns number
The pool utilization.
+ +Protected
worker@@ -316,7 +328,7 @@ When the maximum number of threads is reached and workers are busy, an event is
Methods
Parameters
worker: ThreadWorkerWithMessageChannel
+worker: Worker
The worker.
message: MessageValue<Response, Worker | MessagePort>
+message: MessageValue<Response, unknown>
The received message.
Protected
afterFunction 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
worker: ThreadWorkerWithMessageChannel
+worker: Worker
The newly created worker.
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.
@@ -381,75 +393,80 @@ Can be overridden.workerNodeKey: number
The worker node key.
task: Task<Data>
+The task to execute.
+Returns void
Worker Node
+Protected
chooseProtected
create-- choose
Worker Node(): number
+- create
And Setup Dynamic Worker(): Worker
-
-
-- Defined in src/pools/abstract-pool.ts:947
And Setup Worker
+- Defined in src/pools/abstract-pool.ts:879
Worker
+ - 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-- create
And Setup Worker(): ThreadWorkerWithMessageChannel
+- create
And Setup Worker(): Worker
-
-
Creates a new worker and sets it up completely in the pool worker nodes.
Returns ThreadWorkerWithMessageChannel
New, completely set up worker.
+Returns Worker
New, completely set up worker.
Protected
create-- create
Worker(): ThreadWorkerWithMessageChannel
+- create
Worker(): Worker
-
-
-- Defined in src/pools/thread/fixed.ts:73
- destroy(): Promise<void>
-
-
- Defined in src/pools/abstract-pool.ts:580
Worker
- destroy
Worker(worker): Promise<void>
-
-
-
-
@@ -457,7 +474,7 @@ Can be overridden.
+- Defined in src/pools/thread/fixed.ts:62
+- Defined in src/pools/abstract-pool.ts:486
+- Defined in src/pools/thread/fixed.ts:68
+- Defined in src/pools/abstract-pool.ts:498
+- Defined in src/pools/abstract-pool.ts:453
+- Defined in src/pools/abstract-pool.ts:475
Hook
- setup
Hook(): void
-
-
+- Defined in src/pools/abstract-pool.ts:609
Listener
+
+ - Defined in src/pools/abstract-pool.ts:974
@@ -736,11 +716,12 @@ Can be overridden
- max
Size
- min
Size
- type
+- utilization
- worker
- after
Task Execution Hook
- after
Worker Setup
- before
Task Execution Hook
-- choose
Worker Node
+- create
And Setup Dynamic Worker
- create
And Setup Worker
- create
Worker
- destroy
@@ -749,7 +730,6 @@ Can be overridden
- execute
- internal
Busy
- is
Main
-- register
Worker Message Listener
- send
To Worker
- set
Tasks Queue Options
- set
Worker Choice Strategy
@@ -757,7 +737,7 @@ Can be overridden
- setup
Hook
- worker
Listener
-
Returns a newly created worker.
+Creates a new worker.
Returns ThreadWorkerWithMessageChannel
+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
worker: ThreadWorkerWithMessageChannel
+worker: Worker
A worker within
workerNodes
.enable Tasks Queue
@@ -482,7 +499,7 @@ Can be overridden.
execute
@@ -495,7 +512,7 @@ Can be overridden.-
-
@@ -508,16 +525,20 @@ Can be overridden.
+- Defined in src/pools/abstract-pool.ts:546
Busy
- internal
Busy(): boolean
-
-
+- Defined in src/pools/abstract-pool.ts:537
Main
-
-
+- Defined in src/pools/thread/fixed.ts:57
To Worker
@@ -595,7 +575,7 @@ Can be overridden.
-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@@ -529,48 +550,7 @@ Can be overridden.
Inherited from FixedThreadPool.isMain
-- Defined in src/pools/thread/fixed.ts:67
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: ThreadWorkerWithMessageChannel
-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
-Inherited from FixedThreadPool.registerWorkerMessageListener
--- Defined in src/pools/thread/fixed.ts:88
Protected
send@@ -582,12 +562,12 @@ Can be overridden.-
-
-
-
Parameters
worker: ThreadWorkerWithMessageChannel
+worker: Worker
The worker which should receive the message.
message: MessageValue<Data, Worker | MessagePort>
+message: MessageValue<Data, unknown>
The message.
Inherited from FixedThreadPool.sendToWorker
-- Defined in src/pools/thread/fixed.ts:80
set Tasks Queue Options
@@ -615,7 +595,7 @@ Can be overridden.
Inherited from FixedThreadPool.setTasksQueueOptions
-- Defined in src/pools/abstract-pool.ts:340
set Worker Choice Strategy
@@ -627,7 +607,7 @@ Can be overridden.-
-
@@ -640,7 +620,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 FixedThreadPool.setWorkerChoiceStrategy
-- Defined in src/pools/abstract-pool.ts:285
set Worker Choice Strategy Options
@@ -660,20 +640,20 @@ Can be overridden.
Inherited from FixedThreadPool.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
Inherited from FixedThreadPool.setupHook
-- Defined in src/pools/abstract-pool.ts:441
Protected
worker@@ -694,14 +674,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 FixedThreadPool.workerListener
-- Defined in src/pools/abstract-pool.ts:653