X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FAbstractPool.html;h=2377e5ef16fdc1a416ee8a3b6d1c857875680190;hb=396360a789e4806699533ddf899c79dc2b7ae868;hp=3369cea5901f6a284d7d22a457d08172a5593a7c;hpb=3bd6a82e43e11294af91bbd19647944ac740169e;p=poolifier.git
diff --git a/docs/classes/AbstractPool.html b/docs/classes/AbstractPool.html
index 3369cea5..2377e5ef 100644
--- a/docs/classes/AbstractPool.html
+++ b/docs/classes/AbstractPool.html
@@ -18,11 +18,11 @@
Constructs a new poolifier pool. Path to the worker file. Options for the pool. Emitter on which events can be listened to. Events that can currently be listened to: Implementation of IPool.emitter Path to the worker file.Type Parameters
-Implements
-
@@ -95,7 +95,6 @@
enqueue
constructor
-
-Type Parameters
-Data = unknown
opts: PoolOptions<Worker>
+opts: PoolOptions<Worker>
Returns AbstractPool<Worker, Data, Response>
Returns AbstractPool<Worker, Data, Response>
-
Properties
-
+
Optional
Readonly
emitter
@@ -166,31 +165,31 @@
-
-Readonly
file
-
Readonly
numberNumber of workers that this pool should manage.
Readonly
optsOptions for the pool.
Protected
promiseThe execution response promise map.
key
: The message id of each submitted task.When we receive a message from the worker, we get a map entry with the promise resolve/reject bound to the message id.
Protected
workerWorker choice strategy context referencing a worker choice algorithm implementation.
Default to a round robin algorithm.
Readonly
workerPool worker nodes.
Implementation of IPool.workerNodes
Protected
Abstract
fullPrivate
numberPrivate
numberAbstract
typeProtected
afterHook executed after the worker task execution. Can be overridden.
@@ -290,16 +289,16 @@ Can be overridden.The worker.
The received message.
Protected
Abstract
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 the main-worker
<->worker
connection if not bind by default.
Protected
beforeHook executed before the worker task execution. Can be overridden.
@@ -331,32 +330,32 @@ Can be overridden.Private
buildPrivate
checkPrivate
checkPrivate
checkPrivate
checkPrivate
checkPrivate
checkProtected
chooseChooses a worker node for the next task.
The default uses a round robin algorithm to distribute the load.
- -[worker node key, worker node].
[worker node key, worker node].
+Protected
createCreates a new worker and sets it up completely in the pool worker nodes.
- -New, completely set up worker.
New, completely set up worker.
+Protected
Abstract
createReturns a newly created worker.
Private
dequeueShutdowns every current worker in this pool.
Implementation of IPool.destroy
Protected
Abstract
destroyShutdowns the given worker.
Enables/disables the worker tasks queue in this pool.
Whether to enable or disable the worker tasks queue.
Optional
tasksQueueOptions: TasksQueueOptionsOptional
tasksQueueOptions: TasksQueueOptionsThe worker tasks queue options.
Implementation of IPool.enableTasksQueue
Private
enqueueExecutes the function specified in the worker constructor with the task data input parameter.
- -Promise that will be fulfilled when the task is completed.
Optional
data: DataThe task input data for the specified worker function. This can only be serializable data.
Promise that will be fulfilled when the task is completed.
+Implementation of IPool.execute
Private
executeFinds a free worker node key based on the number of tasks the worker has applied.
-If a worker is found with 0
running tasks, it is detected as free and its worker node key is returned.
If no free worker is found, -1
is returned.
A worker node key if there is one, -1
otherwise.
Implementation of IPool.findFreeWorkerNodeKey
-Private
flushPrivate
flushPrivate
flushPrivate
getGets the given worker its worker node key.
- -The worker node key if the worker is found in the pool worker nodes, -1
otherwise.
The worker.
The worker node key if the worker is found in the pool worker nodes, -1
otherwise.
Private
getGets the given worker its tasks usage in the pool.
Error if the worker is not found in the pool worker nodes.
- -The worker tasks usage.
The worker.
The worker tasks usage.
+Protected
internalProtected
Abstract
isShould return whether the worker is the main worker or not.
Private
pushPushes the given worker in the pool worker nodes.
- -The worker nodes length.
The worker.
The worker nodes length.
+Protected
Abstract
registerRegisters a listener callback on the given worker.
Private
removeRemoves the given worker from the pool worker nodes.
Protected
Abstract
sendSends a message to the given worker.
The worker which should receive the message.
The message.
Sets the worker tasks queue options in this pool.
The worker tasks queue options.
Implementation of IPool.setTasksQueueOptions
Sets the worker choice strategy in this pool.
The worker choice strategy.
Optional
workerChoiceStrategyOptions: WorkerChoiceStrategyOptionsOptional
workerChoiceStrategyOptions: WorkerChoiceStrategyOptionsThe worker choice strategy options.
Implementation of IPool.setWorkerChoiceStrategy
Sets the worker choice strategy options in this pool.
The worker choice strategy options.
Implementation of IPool.setWorkerChoiceStrategyOptions
Private
setSets the given worker in the pool worker nodes.
The worker.
The worker tasks usage.
The worker task queue.
Private
setSets the given worker node its tasks usage in the pool.
The worker node.
The worker node tasks usage.
Protected
setupSetup hook to execute code before worker node are created in the abstract constructor. Can be overridden
Private
tasksProtected
workerThis function is the listener registered for each worker message.
- -The listener function to execute when a message is received from a worker.
The listener function to execute when a message is received from a worker.
+This function is the listener registered for each worker message.
- -The listener function to execute when a message is received from a worker.
The listener function to execute when a message is received from a worker.
+
Base class that implements some shared logic for all poolifier pools.