X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=docs%2Fclasses%2FDynamicThreadPool.html;h=62d4967497f54546e914007767913f7abfc1ca0c;hb=b881e803f1a32ce8d8218d3ba3638ad317ae87bc;hp=ef6f99179ad7ed3560fff7c4dbf4aa95614beb18;hpb=aba8d9bd41f1bd46f3cc3863c0c2e74bdfacb7b6;p=poolifier.git diff --git a/docs/classes/DynamicThreadPool.html b/docs/classes/DynamicThreadPool.html index ef6f9917..62d49674 100644 --- a/docs/classes/DynamicThreadPool.html +++ b/docs/classes/DynamicThreadPool.html @@ -1,4 +1,4 @@ -
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.
Protected
workerThe listener function to execute when a message is received from a worker.
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,9 @@ When the maximum number of threads is reached and workers are busy, an event is info max Size
min Size
+ready
type
+utilization
worker
Properties
Emitter on which events can be listened to.
Events that can currently be listened to:
-
-
+
+
+
@@ -159,7 +166,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 +261,7 @@ When the maximum number of threads is reached and workers are busy, an event is
info
@@ -266,7 +273,7 @@ When the maximum number of threads is reached and workers are busy, an event is
Protected
max@@ -278,7 +285,7 @@ When the maximum number of threads is reached and workers are busy, an event is
Protected
min@@ -290,7 +297,16 @@ When the maximum number of threads is reached and workers are busy, an event is
+Private
ready+- get ready(): boolean
+-
+
Returns boolean
Protected
type@@ -303,7 +319,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 +344,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,58 +419,74 @@ Can be overridden.
Dynamic Pool Size
+Protected
check+- check
Dynamic Pool Size(min, max): void
+-
+
+
+
Parameters
++-
+
+-
+
min: number
max: number
Returns void
Protected
create-- create
And Setup Dynamic Worker(): ThreadWorkerWithMessageChannel
+- create
And Setup Dynamic Worker(): Worker
-
-
Creates a new dynamic worker and sets it up completely in the pool worker nodes.
Returns ThreadWorkerWithMessageChannel
New, completely set up dynamic worker.
+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
-
-
Creates a new worker.
Returns ThreadWorkerWithMessageChannel
Newly created worker.
+Returns Worker
Newly created worker.
destroy
Terminate every current worker in this pool.
+Terminates every current worker in this pool.
Returns Promise<void>
+Protected
destroy@@ -453,7 +498,7 @@ Can be overridden.-
-
Parameters
worker: ThreadWorkerWithMessageChannel
+worker: Worker
A worker within
workerNodes
.enable Tasks Queue
@@ -486,7 +531,7 @@ Can be overridden.
execute
@@ -499,7 +544,7 @@ Can be overridden.-
-
@@ -512,7 +557,51 @@ Can be overridden.
+- Defined in src/pools/abstract-pool.ts:616
+
+
+
+
Busy
+- Defined in src/pools/abstract-pool.ts:607
Main
+- Defined in src/pools/thread/fixed.ts:54
Worker Message Listener
+
-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.
Worker Info By Worker
+Protected
get+- get
Worker Info By Worker(worker): WorkerInfo
+-
+
+
+
+
+
Gets the worker information from the given worker.
+Parameters
++-
+
+
worker: Worker
+The worker.
+Returns WorkerInfo
The worker information.
+ +Throws
https://nodejs.org/api/errors.html#class-error If the worker is not found.
+ Worker Node Key
+Protected
get+- get
Worker Node Key(worker): number
+-
+
+
+
+
Gets the given worker its worker node key.
+Parameters
++-
+
+
worker: Worker
+The worker.
+Returns number
The worker node key if found in the pool worker nodes,
+ +-1
otherwise.Protected
internal@@ -525,7 +614,7 @@ Can be overridden.
Protected
is@@ -537,7 +626,7 @@ Can be overridden.
Protected
register@@ -554,7 +643,7 @@ Can be overridden.-
-
@@ -572,13 +661,33 @@ Can be overridden.
-
-
Parameters
worker: ThreadWorkerWithMessageChannel
+worker: Worker
The worker which should register a listener.
Parameters
message: MessageValue<Message, unknown, Worker | MessagePort>
message: MessageValue<Message, unknown>
Returns void
Returns void
Startup Message To Worker
+Protected
send+- send
Startup Message To Worker(worker): void
+-
+
+
+
+
Sends the startup message to the given worker.
+Parameters
++-
+
+
worker: Worker
+The worker which should receive the startup message.
+Returns void
+Protected
send@@ -590,12 +699,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.