X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=inline;f=docs%2Fclasses%2FAbstractPool.html;h=13d1951e8eaac2067433f45d10fb1b694d24a741;hb=9d96ba4ea0e2e4b06216657cb1641551b59f58ee;hp=e498d41b0f1f8d59f0b6943430e09fe606faadc6;hpb=aac8863d208eadcb0ecb33dc44d045c26f5a444f;p=poolifier.git diff --git a/docs/classes/AbstractPool.html b/docs/classes/AbstractPool.html index e498d41b..13d1951e 100644 --- a/docs/classes/AbstractPool.html +++ b/docs/classes/AbstractPool.html @@ -1,13 +1,13 @@ -
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.
-
+Index
Index
Constructors
-Properties
-Accessors
-Methods
-Constructors
constructor
+constructor
Type Parameters
Worker extends IWorker<Worker>
Worker extends IWorker
Data = unknown
Returns AbstractPool<Worker, Data, Response>
Properties
-Optional
Readonly
emitterEmitter 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 full.'busy'
: Emitted when the pool is busy.'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 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. Timestamp
+Private
Readonly
startThe start timestamp of the pool.
+
+Private
startedWhether the pool is started or not.
+
+Private
startingWhether the pool is starting or not.
+ Functions
+Private
Readonly
taskThe task functions added at runtime map:
++
+
+
+key
: The task function name.value
: The task function itself.Protected
worker Nodes
-Readonly
worker Nodes
+Readonly
Internal
workerPool worker nodes.
Accessors
Returns boolean
Protected
full@@ -263,7 +348,7 @@
Returns boolean
info
@@ -275,58 +360,134 @@
Size
+Protected
Abstract
maxProtected
maxPool maximum size.
+The pool maximum size.
Returns number
+ Size
+Protected
Abstract
minProtected
minPool minimum size.
+The pool minimum size.
Returns number
+
+Private
ready+- get ready(): boolean
+-
+
+
The pool readiness boolean status.
+Returns boolean
+Protected
Abstract
typePool type.
+The pool type.
If it is
'dynamic'
, it provides themax
property.Returns "fixed" | "dynamic"
+
+Private
utilization+- get utilization(): number
+-
+
+
The approximate pool utilization.
+Returns number
The pool utilization.
+ +Protected
Abstract
worker-- get worker(): "cluster" | "thread"
+- get worker(): "thread" | "cluster"
-
-
-- Defined in src/pools/abstract-pool.ts:472
+
+
+
Task Execution Hook
-
-- Defined in src/pools/abstract-pool.ts:170
+
+ Pool Options
Gets the worker type.
+The worker type.
Returns "cluster" | "thread"
+Returns "thread" | "cluster"
+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. Worker Node
+Private
add+- add
Worker Node(worker): number
+-
+
+
+
+
+
Adds the given worker in the pool worker nodes.
+Parameters
++-
+
+
worker: Worker
+The worker.
+Returns number
The added worker node key.
+ +Throws
https://nodejs.org/api/errors.html#class-error If the added worker node is not found.
+Protected
after-- after
Task Execution Hook(worker, message): void
+- after
Task Execution Hook(workerNodeKey, message): void
-
-
-
-
-
-
-- Defined in src/pools/abstract-pool.ts:1035
+
+ Worker Node Setup
-
-- Defined in src/pools/abstract-pool.ts:494
+
+ Number Of Workers
Hook executed after the worker task execution. Can be overridden.
@@ -335,39 +496,39 @@ Can be overridden.Parameters
worker: Worker
-The worker.
+workerNodeKey: number
+The worker node key.
message: MessageValue<Response, unknown, Worker | MessagePort>
+message: MessageValue<Response, unknown>
The received message.
Returns void
Worker Setup
+Protected
Abstract
afterProtected
after-- after
Worker Setup(worker): void
+- after
Worker Node Setup(workerNodeKey): void
-
-
-
-
+- Defined in src/pools/abstract-pool.ts:1346
Task Execution Hook
+- Defined in src/pools/abstract-pool.ts:1005
Tasks Queue Options
-- Defined in src/pools/abstract-pool.ts:600
+
+ And Emit Dynamic Worker Creation Events
-
-- Defined in src/pools/abstract-pool.ts:1571
+
+ And Emit Task Execution Events
-
-- Defined in src/pools/abstract-pool.ts:1559
+
+ And Emit Task Queuing Events
-
-- Defined in src/pools/abstract-pool.ts:1565
+
+ Message Worker Id
+
+
Function 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.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
Protected
before@@ -392,7 +553,7 @@ Can be overridden.
Returns void
Private
build@@ -405,80 +566,78 @@ Can be overridden.
tasksQueueOptions: TasksQueueOptions
Returns TasksQueueOptions
- And Emit Events
+Private
checkPrivate
check-- check
And Emit Events(): void
+- check
And Emit Dynamic Worker Creation Events(): void
-
Returns void
File Path
+Private
checkPrivate
check-- check
File Path(filePath): void
+- check
And Emit Task Execution Events(): void
-
-
-
Parameters
---
-
filePath: string
Returns void
Number Of Workers
+Private
checkPrivate
check-- check
Number Of Workers(numberOfWorkers): void
+- check
And Emit Task Queuing Events(): void
-
-
-
Parameters
---
-
numberOfWorkers: number
Returns void
Pool Options
+Private
checkPrivate
check-- check
Pool Options(opts): void
+- check
Message Worker Id(message): void
-
+
-
-
-
Checks if the worker id sent in the received message from a worker is valid.
+Parameters
opts: PoolOptions<Worker>
Returns void
Returns void
+Throws
https://nodejs.org/api/errors.html#class-error If the worker id is invalid.
+ Valid Tasks Queue Options
+Private
checkPrivate
check-- check
Valid Tasks Queue Options(tasksQueueOptions): void
+- check
Number Of Workers(numberOfWorkers): void
-
-
-
+
Parameters
tasksQueueOptions: TasksQueueOptions
numberOfWorkers: number
Returns void
Valid Worker Choice Strategy
+Private
checkPrivate
check-- check
Valid Worker Choice Strategy(workerChoiceStrategy): void
+- check
Pool Options(opts): void
-
-
-
+
Parameters
workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
opts: PoolOptions<Worker>
Returns void
Private
check@@ -491,43 +650,69 @@ Can be overridden.
workerChoiceStrategyOptions: WorkerChoiceStrategyOptions
Returns void
Worker Node
-Protected
choose+- Defined in src/pools/abstract-pool.ts:217
Worker Node
+Private
chooseChooses a worker node for the next task.
-The default worker choice strategy uses a round robin algorithm to distribute the load.
+The default worker choice strategy uses a round robin algorithm to distribute the tasks.
+Returns number
The chosen worker node key
+ + And Setup Dynamic Worker Node
+Protected
create+- create
And Setup Dynamic Worker Node(): number
+-
+
-
Creates a new, completely set up dynamic worker node.
Returns number
The worker node key
+Returns number
New, completely set up dynamic worker node key.
And Setup Worker
+Protected
createProtected
create-- create
And Setup Worker(): Worker
+- create
And Setup Worker Node(): number
-
-
-- Defined in src/pools/abstract-pool.ts:1208
Worker
- create
Worker(): Worker
-
-
-- Defined in src/pools/abstract-pool.ts:1201
+
+
Task
+- Defined in src/pools/abstract-pool.ts:1661
+
+
- destroy(): Promise<void>
-
-
-- Defined in src/pools/abstract-pool.ts:940
+
+ Worker Node
+
+
+- Defined in src/pools/abstract-pool.ts:1410
Wait Time Worker Usage
+- Defined in src/pools/abstract-pool.ts:1109
Listener
- worker
Listener(): ((message) => void)
-
-
- (message): void
-
-
-
-
+
+ - Defined in src/pools/abstract-pool.ts:1497
+
+
+
+
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.
+Protected
Abstract
createReturns a newly created worker.
+Creates a new worker.
Returns Worker
+Returns Worker
Newly created worker.
+ + Task Function Worker Usages
+Private
delete+- delete
Task Function Worker Usages(name): void
+-
+
+
+
Parameters
++-
+
name: string
Returns void
Private
dequeue@@ -540,63 +725,103 @@ Can be overridden.
workerNodeKey: number
Returns undefined | Task<Data>
Worker Message Listener
+Protected
Abstract
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
+destroy
Shutdowns every current worker in this pool.
+Terminates all workers in this pool.
Returns Promise<void>
- Worker
+Protected
Abstract
destroyProtected
Abstract
destroy-- destroy
Worker(worker): void | Promise<void>
+- destroy
Worker Node(workerNodeKey): Promise<void>
-
-
-
-
-
+- Defined in src/pools/abstract-pool.ts:981
- enable
Tasks Queue(enable, tasksQueueOptions?): void
-
-
-
-
+- Defined in src/pools/abstract-pool.ts:565
Task
+- Defined in src/pools/abstract-pool.ts:1655
-
-
+
+- flush
Tasks Queue(workerNodeKey): void
-
@@ -665,7 +904,7 @@ Can be overridden.
+- Defined in src/pools/abstract-pool.ts:1669
Tasks Queues
-
-
+
+
+
-- Defined in src/pools/abstract-pool.ts:1585
+
+ Worker Node Key By Worker
-
+
+
-
-- Defined in src/pools/abstract-pool.ts:525
+
+
+
+
+
+ Back Pressure
+
+
+- Defined in src/pools/abstract-pool.ts:783
+
+
+
+
Busy
- internal
Busy(): boolean
-
-
+- Defined in src/pools/abstract-pool.ts:667
Main
-
-- Defined in src/pools/abstract-pool.ts:996
+
+
+
+ Queued Tasks
+
+
+- Defined in src/pools/abstract-pool.ts:1307
+
+
Worker Node
+- Defined in src/pools/abstract-pool.ts:1618
+
+
+
+
+
+
+
+
+
+
To Worker
+
+
Shutdowns 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 | Promise<void>
+Returns Promise<void>
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
Private
enqueue@@ -611,11 +836,11 @@ Can be overridden.
task: Task<Data>
Returns number
execute
-- execute(data?, name?): Promise<Response>
+- execute(data?, name?, transferList?): Promise<Response>
-
@@ -624,12 +849,17 @@ Can be overridden.
-
-
+
+-
+
+- Defined in src/pools/abstract-pool.ts:870
Task
- execute
Task(workerNodeKey, task): void
-
+
-
-
+
+
-
-
-
+
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 serializable 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.
@@ -637,25 +867,34 @@ Can be overridden.Private
executeExecutes the given task on the worker given its worker node key.
+Parameters
workerNodeKey: number
workerNodeKey: number
+The worker node key.
+task: Task<Data>
Returns void
Returns void
+ Tasks Queue
-Private
flush+- Defined in src/pools/abstract-pool.ts:1649
Tasks Queue
+Protected
flushworkerNodeKey: number
Returns void
Private
flush@@ -673,24 +912,31 @@ Can be overridden.-
Returns void
Task Statistics
-Private
get-- get
Task Statistics(worker): TaskStatistics
+- Defined in src/pools/abstract-pool.ts:1679
Worker Info
+Protected
get+- get
Worker Info(workerNodeKey): WorkerInfo
-
+
-
-
-
Gets the worker information given its worker node key.
+Parameters
worker: Worker
Returns TaskStatistics
Returns WorkerInfo
The worker information.
+ + - Worker Node Key
+Private
getPrivate
get-- get
Worker Node Key(worker): number
+- get
Worker Node Key By Worker(worker): number
-
@@ -702,32 +948,127 @@ Can be overridden.
Gets the given worker its worker node key.
The worker.
Returns number
The worker node key if the worker is found in the pool worker nodes,
+-1
otherwise.Returns number
The worker node key if found in the pool worker nodes,
+ +-1
otherwise. Worker Node Key By Worker Id
+Private
get+- get
Worker Node Key By Worker Id(workerId): number
+-
+
+
+
+
Gets the worker node key given its worker id.
+Parameters
++-
+
+
workerId: undefined | number
+The worker id.
+Returns number
The worker node key if the worker id is found in the pool worker nodes,
-1
otherwise. Worker Usage
+Private
get Task Execution Response
+Private
handle+- handle
Task Execution Response(message): void
+-
+
+
+
Parameters
++-
+
message: MessageValue<Response, unknown>
Returns void
Worker Ready Response
+Private
handle+- handle
Worker Ready Response(message): void
+-
+
+
+
Parameters
++-
+
message: MessageValue<Response, unknown>
Returns void
Private
has-- get
Worker Usage(worker): WorkerUsage
+- has
Back Pressure(): boolean
+-
+
Returns boolean
has Task Function
++- has
Task Function(name): boolean
-
+
-
-
-
Whether the specified task function exists in this pool.
+Parameters
worker: Worker
Returns WorkerUsage
Returns boolean
+ + +true
if the task function exists,false
otherwise.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. Event Emitter
+Private
initialize+- initialize
Event Emitter(): void
+-
+
Returns void
Protected
internalReturns boolean
Protected
Abstract
is@@ -738,33 +1079,79 @@ Can be overridden.
Returns boolean
-- Defined in src/pools/abstract-pool.ts:456
Worker Node
+Private
pushlist 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.
+ +Implementation of IPool.listTaskFunctionNames
++- Defined in src/pools/abstract-pool.ts:835
Private
redistribute-- push
Worker Node(worker): number
+- redistribute
Queued Tasks(workerNodeKey): void
+-
+
+
+
+
Parameters
++-
+
workerNodeKey: number
Returns void
+- Defined in src/pools/abstract-pool.ts:1389
Once Worker Message Listener
+Protected
Abstract
register+- register
Once Worker Message Listener<Message>(workerNodeKey, listener): void
-
-
+
+
-
-
-
-
+-
+
+
+
+
+- Defined in src/pools/abstract-pool.ts:1320
Worker Message Listener
Pushes the given worker in the pool worker nodes.
+Registers once a listener callback on the worker given its worker node key.
Type Parameters
++-
+
Message
Parameters
worker: Worker
-The worker.
+workerNodeKey: number
+The worker node key.
Returns number
The worker nodes length.
- +listener: ((message) => void)
+The message listener callback.
++-
+
+- (message): void
+-
+
+
+
Parameters
++-
+
message: MessageValue<Message, unknown>
Returns void
Returns void
-- Defined in src/pools/abstract-pool.ts:777
Protected
Abstract
register-- register
Worker Message Listener<Message>(worker, listener): void
+- register
Worker Message Listener<Message>(workerNodeKey, listener): void
-
-
-
-
-
@@ -793,12 +1180,33 @@ Can be overridden.
-
-
+
Registers a listener callback on the given worker.
+Registers a listener callback on the worker given its worker node key.
Type Parameters
@@ -775,8 +1162,8 @@ Can be overridden.Parameters
worker: Worker
-The worker which should register a listener.
+workerNodeKey: number
+The worker node key.
Parameters
message: MessageValue<Message, unknown, Worker | MessagePort>
message: MessageValue<Message, unknown>
Returns void
Returns void
-- Defined in src/pools/abstract-pool.ts:658
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.Implementation of IPool.removeTaskFunction
++- Defined in src/pools/abstract-pool.ts:819
Private
remove@@ -817,51 +1225,185 @@ Can be overridden.
Returns void
-- Defined in src/pools/abstract-pool.ts:811
Kill Message To Worker
+Protected
send+- send
Kill Message To Worker(workerNodeKey): Promise<void>
+-
+
+
+
+
Parameters
++-
+
workerNodeKey: number
Returns Promise<void>
+- Defined in src/pools/abstract-pool.ts:953
Startup Message To Worker
+Protected
Abstract
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
++- Defined in src/pools/abstract-pool.ts:1370
Statistics Message To Worker
+Private
send+- send
Statistics Message To Worker(workerNodeKey): void
+-
+
+
+
+
+
Sends the statistics message to worker given its worker node key.
+Parameters
++-
+
+
workerNodeKey: number
+The worker node key.
+Returns void
++- Defined in src/pools/abstract-pool.ts:1377
Task Function Operation To Worker
+Private
send+- send
Task Function Operation To Worker(workerNodeKey, message): Promise<boolean>
+-
+
+
+
+
Parameters
++-
+
+-
+
workerNodeKey: number
message: MessageValue<Data, unknown>
Returns Promise<boolean>
+- Defined in src/pools/abstract-pool.ts:686
Task Function Operation To Workers
+Private
send+- send
Task Function Operation To Workers(message): Promise<boolean>
+-
+
+
+
+
Parameters
++-
+
message: MessageValue<Data, unknown>
Returns Promise<boolean>
+- Defined in src/pools/abstract-pool.ts:727
Protected
Abstract
send-- send
To Worker(worker, message): void
+- send
To Worker(workerNodeKey, message, transferList?): void
-
-
-
-
-
-
+
+-
+
+- Defined in src/pools/abstract-pool.ts:1190
+
+
+
+
- set
Tasks Queue Options(tasksQueueOptions): void
-
-
-
+- Defined in src/pools/abstract-pool.ts:579
+
+
+
+
+- Defined in src/pools/abstract-pool.ts:532
-
-- Defined in src/pools/abstract-pool.ts:551
+
+
+
+ Create Dynamic Worker
+- Defined in src/pools/abstract-pool.ts:1122
Run Time Worker Usage
+
+- Defined in src/pools/abstract-pool.ts:1095
Task Statistics Worker Usage
+
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.
message: MessageValue<Data, unknown, Worker | MessagePort>
+message: MessageValue<Data, unknown>
The message.
+Optional
transferList: TransferListItem[]The optional array of transferable objects.
+Returns void
-- Defined in src/pools/abstract-pool.ts:647
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.Implementation of IPool.setDefaultTaskFunction
++- Defined in src/pools/abstract-pool.ts:848
Task Stealing
+Private
set+- set
Task Stealing(): void
+-
+
+
Returns void
+- Defined in src/pools/abstract-pool.ts:620
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
Implementation of IPool.setTasksQueueOptions
-- Defined in src/pools/abstract-pool.ts:348
Tasks Queue Size
+Private
set+- set
Tasks Queue Size(size): void
+-
+
+
+
+
Parameters
++-
+
size: number
Returns void
+- Defined in src/pools/abstract-pool.ts:614
Tasks Stealing On Back Pressure
+Private
set+- set
Tasks Stealing On Back Pressure(): void
+-
+
+
Returns void
+- Defined in src/pools/abstract-pool.ts:633
set Worker Choice Strategy
@@ -886,7 +1428,7 @@ Can be overridden.
Implementation of IPool.setWorkerChoiceStrategy
-- Defined in src/pools/abstract-pool.ts:303
set Worker Choice Strategy Options
@@ -906,56 +1448,89 @@ Can be overridden.
Implementation of IPool.setWorkerChoiceStrategyOptions
-- Defined in src/pools/abstract-pool.ts:325
Worker Node Tasks Usage
+Private
set Hook
+Protected
setup+- setup
Hook(): void
+-
+
+
+
Setup hook to execute code before worker nodes are created in the abstract constructor. +Can be overridden.
+Returns void
++- Defined in src/pools/abstract-pool.ts:989
Private
shall-- set
Worker Node Tasks Usage(workerNode, workerUsage): void
+- shall
Create Dynamic Worker(): boolean
-
-
+
+
+
+
+- Defined in src/pools/abstract-pool.ts:1665
+
+
+
+
+
+
Elu Worker Usage
+
Sets the given worker node its tasks usage in the pool.
+Conditions for dynamic worker creation.
Returns boolean
Whether to create a dynamic worker or not.
+ ++- Defined in src/pools/abstract-pool.ts:1179
Execute Task
+Private
shall+- shall
Execute Task(workerNodeKey): boolean
+-
-
-
+
+
+
+
-
-
+- Defined in src/pools/abstract-pool.ts:1429
Queue Size
Parameters
workerNode: WorkerNode<Worker, Data>
-The worker node.
+workerNodeKey: number
Returns boolean
+- Defined in src/pools/abstract-pool.ts:861
Update Task Function Worker Usage
+Private
shall+- shall
Update Task Function Worker Usage(workerNodeKey): boolean
+-
+
-
+
+-
-
+
+
+
+
-
-- Defined in src/pools/abstract-pool.ts:924
+
+ Stealing On Empty Queue
Whether the worker node shall update its task function worker usage or not.
Parameters
+workerUsage: WorkerUsage
-The worker usage.
+workerNodeKey: number
+The worker node key.
Returns boolean
+ +true
if the worker node shall update its task function worker usage,false
otherwise.+- Defined in src/pools/abstract-pool.ts:1068
start
++- start(): void
+-
+
+
Starts the minimum number of workers in this pool.
+Returns void
Implementation of IPool.start
-- Defined in src/pools/abstract-pool.ts:764
Worker Statistics
+Private
setPrivate
task-- set
Worker Statistics(worker): void
+- task
Stealing On Empty Queue(workerId): void
-
-
-
+
Parameters
worker: Worker
workerId: number
Returns void
-- Defined in src/pools/abstract-pool.ts:853
Hook
-Protected
setup-- setup
Hook(): void
--
-
-
-
Setup hook to execute code before worker node are created in the abstract constructor. -Can be overridden
-Returns void
--- Defined in src/pools/abstract-pool.ts:449
Private
tasks@@ -968,7 +1543,36 @@ Can be overridden
workerNodeKey: number
Returns number
-- Defined in src/pools/abstract-pool.ts:832
Stealing On Back Pressure
+Private
tasks+- tasks
Stealing On Back Pressure(workerId): void
+-
+
+
+
+
Parameters
++-
+
workerId: number
Returns void
+- Defined in src/pools/abstract-pool.ts:1457
Task Stealing
+Private
unset+- unset
Task Stealing(): void
+-
+
+
Returns void
+- Defined in src/pools/abstract-pool.ts:627
Tasks Stealing On Back Pressure
+Private
unset+- unset
Tasks Stealing On Back Pressure(): void
+-
+
+
Returns void
+- Defined in src/pools/abstract-pool.ts:640
Private
update@@ -980,10 +1584,10 @@ Can be overridden-
-
-
workerUsage: WorkerUsage
message: MessageValue<Response, unknown, Worker | MessagePort>
message: MessageValue<Response, unknown>
Returns void
-- Defined in src/pools/abstract-pool.ts:564
Private
update@@ -995,10 +1599,10 @@ Can be overridden-
-
-
workerUsage: WorkerUsage
message: MessageValue<Response, unknown, Worker | MessagePort>
message: MessageValue<Response, unknown>
Returns void
-- Defined in src/pools/abstract-pool.ts:504
Private
update@@ -1010,10 +1614,25 @@ Can be overridden-
-
-
workerUsage: WorkerUsage
message: MessageValue<Response, unknown, Worker | MessagePort>
message: MessageValue<Response, unknown>
Returns void
+- Defined in src/pools/abstract-pool.ts:1077
Task Stolen Statistics Worker Usage
+Private
update+- update
Task Stolen Statistics Worker Usage(workerNodeKey, taskName): void
+-
+
+
Parameters
++-
+
+-
+
workerNodeKey: number
taskName: string
Returns void
-- Defined in src/pools/abstract-pool.ts:492
Private
update@@ -1028,13 +1647,13 @@ Can be overridden
task: Task<Data>
Returns void
-- Defined in src/pools/abstract-pool.ts:533
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.
@@ -1043,32 +1662,32 @@ Can be overriddenThis function is the listener registered for each worker message.
+This method is the listener registered for each worker message.
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.
-- Defined in src/pools/abstract-pool.ts:716
-
+Settings
Settings
Member Visibility
Theme
@@ -1078,9 +1697,14 @@ Can be overridden- constructor
- emitter
- file
Path
+- max
- number
Of Workers
- opts
- promise
Response Map
+- start
Timestamp
+- started
+- starting
+- task
Functions
- worker
Choice Strategy Context
- worker
Nodes
- busy
@@ -1088,113 +1712,109 @@ Can be overridden
- info
- max
Size
- min
Size
+- ready
- type
+- utilization
- worker
+- add
Task Function
+- add
Worker Node
- after
Task Execution Hook
-- after
Worker Setup
+- after
Worker Node Setup
- before
Task Execution Hook
- build
Tasks Queue Options
-- check
And Emit Events
-- check
File Path
+- check
And Emit Dynamic Worker Creation Events
+- check
And Emit Task Execution Events
+- check
And Emit Task Queuing Events
+- check
Message Worker Id
- check
Number Of Workers
- check
Pool Options
-- check
Valid Tasks Queue Options
-- check
Valid Worker Choice Strategy
- check
Valid Worker Choice Strategy Options
-- choose
Worker Node
-- create
And Setup Worker
+- choose
Worker Node
+- create
And Setup Dynamic Worker Node
+- create
And Setup Worker Node
- create
Worker
+- delete
Task Function Worker Usages
- dequeue
Task
+- deregister
Worker Message Listener
- destroy
-- destroy
Worker
+- destroy
Worker Node
- enable
Tasks Queue
- enqueue
Task
- execute
- execute
Task
-- flush
Tasks Queue
+- flush
Tasks Queue
- flush
Tasks Queues
-- get
Task Statistics
-- get
Worker Node Key
-- get
Worker Usage
+- get
Worker Info
+- get
Worker Node Key By Worker
+- get
Worker Node Key By Worker Id
+- handle
Task Execution Response
+- handle
Worker Ready Response
+- has
Back Pressure
+- has
Task Function
+- has
Worker Node Back Pressure
+- initialize
Event Emitter
- internal
Busy
- is
Main
-- push
Worker Node
+- list
Task Function Names
+- redistribute
Queued Tasks
+- register
Once Worker Message Listener
- register
Worker Message Listener
+- remove
Task Function
- remove
Worker Node
+- send
Kill Message To Worker
+- send
Startup Message To Worker
+- send
Statistics Message To Worker
+- send
Task Function Operation To Worker
+- send
Task Function Operation To Workers
- send
To Worker
+- set
Default Task Function
+- set
Task Stealing
- set
Tasks Queue Options
+- set
Tasks Queue Size
+- set
Tasks Stealing On Back Pressure
- set
Worker Choice Strategy
- set
Worker Choice Strategy Options
-- set
Worker Node Tasks Usage
-- set
Worker Statistics
- setup
Hook
+- shall
Create Dynamic Worker
+- shall
Execute Task
+- shall
Update Task Function Worker Usage
+- start
+- task
Stealing On Empty Queue
- tasks
Queue Size
+- tasks
Stealing On Back Pressure
+- unset
Task Stealing
+- unset
Tasks Stealing On Back Pressure
- update
Elu Worker Usage
- update
Run Time Worker Usage
- update
Task Statistics Worker Usage
+- update
Task Stolen Statistics Worker Usage
- update
Wait Time Worker Usage
- worker
Listener