X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=inline;f=docs%2Fclasses%2FDynamicThreadPool.html;h=26888edf983bf541ba41afeb19c1e467914fac66;hb=296cba79ddbf15e2fd8510a4ba1ef0079ef77ee1;hp=9f0a4654cc89de0ae8ab7f0b2b13786edd4f14de;hpb=aac8863d208eadcb0ecb33dc44d045c26f5a444f;p=poolifier.git diff --git a/docs/classes/DynamicThreadPool.html b/docs/classes/DynamicThreadPool.html index 9f0a4654..26888edf 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.
@@ -73,7 +73,10 @@ When the maximum number of threads is reached and workers are busy, an event is info max Size
min Size
+ready
+starting
type
+utilization
worker
Properties
Emitter on which events can be listened to.
Events that can currently be listened to:
-
-
+
+
+
@@ -159,7 +163,7 @@ When the maximum number of threads is reached and workers are busy, an event is +'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
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.
Nodes
-Readonly
workerPool worker nodes.
Accessors
Protected
full@@ -254,7 +258,7 @@ When the maximum number of threads is reached and workers are busy, an event is
info
@@ -266,7 +270,7 @@ When the maximum number of threads is reached and workers are busy, an event is
Protected
max@@ -278,7 +282,7 @@ When the maximum number of threads is reached and workers are busy, an event is
Protected
min@@ -290,7 +294,25 @@ When the maximum number of threads is reached and workers are busy, an event is
+Private
ready+- get ready(): boolean
+-
+
Returns boolean
+Private
starting+- get starting(): boolean
+-
+
Returns boolean
Protected
type@@ -303,7 +325,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@@ -315,7 +350,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, unknown, 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@@ -390,70 +425,86 @@ Can be overridden.
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:1010
And Setup Worker
+- Defined in src/pools/abstract-pool.ts:944
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:68
- destroy(): Promise<void>
-
-
- Defined in src/pools/abstract-pool.ts:626
Worker
- destroy
Worker(worker): Promise<void>
-
-
-
-
@@ -461,7 +512,7 @@ Can be overridden.
+- Defined in src/pools/thread/fixed.ts:57
+- Defined in src/pools/abstract-pool.ts:531
+- Defined in src/pools/thread/fixed.ts:63
+- Defined in src/pools/abstract-pool.ts:543
+- Defined in src/pools/abstract-pool.ts:501
+- Defined in src/pools/abstract-pool.ts:520
Hook
- setup
Hook(): void
-
-
+- Defined in src/pools/abstract-pool.ts:655
Listener
+
+ - Defined in src/pools/abstract-pool.ts:1041
@@ -739,12 +753,16 @@ Can be overridden
- info
- max
Size
- min
Size
+- ready
+- starting
- type
+- utilization
- worker
- after
Task Execution Hook
- 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
@@ -753,7 +771,6 @@ Can be overridden
- execute
- internal
Busy
- is
Main
-- register
Worker Message Listener
- send
To Worker
- set
Tasks Queue Options
- set
Worker Choice Strategy
@@ -761,7 +778,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
@@ -486,7 +537,7 @@ Can be overridden.
execute
@@ -499,7 +550,7 @@ Can be overridden.-
-
@@ -512,16 +563,20 @@ Can be overridden.
+- Defined in src/pools/abstract-pool.ts:591
Busy
- internal
Busy(): boolean
-
-
+- Defined in src/pools/abstract-pool.ts:582
Main
-
-
+- Defined in src/pools/thread/fixed.ts:52
To Worker
@@ -599,7 +613,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@@ -533,48 +588,7 @@ Can be overridden.
Inherited from FixedThreadPool.isMain
-- Defined in src/pools/thread/fixed.ts:65
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, unknown, Worker | MessagePort>
Returns void
Returns void
-Inherited from FixedThreadPool.registerWorkerMessageListener
--- Defined in src/pools/thread/fixed.ts:86
Protected
send@@ -586,12 +600,12 @@ Can be overridden.-
-
-
-
Parameters
worker: ThreadWorkerWithMessageChannel
+worker: Worker
The worker which should receive the message.
message: MessageValue<Data, unknown, Worker | MessagePort>
+message: MessageValue<Data, unknown>
The message.
Inherited from FixedThreadPool.sendToWorker
-- Defined in src/pools/thread/fixed.ts:78
set Tasks Queue Options
@@ -619,7 +633,7 @@ Can be overridden.
Inherited from FixedThreadPool.setTasksQueueOptions
-- Defined in src/pools/abstract-pool.ts:348
set Worker Choice Strategy
@@ -644,7 +658,7 @@ Can be overridden.
Inherited from FixedThreadPool.setWorkerChoiceStrategy
-- Defined in src/pools/abstract-pool.ts:303
set Worker Choice Strategy Options
@@ -664,20 +678,20 @@ Can be overridden.
Inherited from FixedThreadPool.setWorkerChoiceStrategyOptions
-- Defined in src/pools/abstract-pool.ts:325
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:449
Protected
worker@@ -698,14 +712,14 @@ Can be overridden-
-
Parameters
message: MessageValue<Response, unknown, 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:716