fwRPC
|
Functions | |
void | fwRPC_workerManager_initialize (int workerCount=-1, int maxWorkers=-1, string workerDeathCB) |
int | fwRPC_workerManager_notifyHeartbeat (int id) synchronized(g_fwRPC_workerManager_workers) |
int | fwRPC_workerManager_findSuitableWorker (bool exclusiveExec, dyn_mixed &worker) synchronized(g_fwRPC_workerManager_workers) |
int | fwRPC_workerManager_registerWorker (dyn_mixed worker) synchronized(g_fwRPC_workerManager_workers) |
int | fwRPC_workerManager_deleteWorker (int workerId) synchronized(g_fwRPC_workerManager_workers) |
void | fwRPC_workerManager_updateState (dyn_mixed worker) synchronized(g_fwRPC_workerManager_workers) |
int | fwRPC_workerManager_getWorkerCount () |
bool | fwRPC_workerManager_pendWorkerRestart (bool immediateRestart) synchronized(g_fwRPC_workerManager_workers) |
bool | fwRPC_workerManager_isWorkerPendingRestart (dyn_mixed worker) |
bool | fwRPC_workerManager_isAnyWorkerPendingRestart () |
void | fwRPC_workerManager_restartWorker (dyn_mixed worker) synchronized(g_fwRPC_workerManager_workers) |
private void | _fwRPC_workerManager_balanceWorkerInstances (int min, int max, int starting) |
private void | _fwRPC_workerManager_workerPostMortem (int workerId) |
private void | _fwRPC_workerManager_heartmonitor (dyn_mixed worker) |
private int | _fwRPC_workerManager_workersIterator_nextKey () synchronized(g_fwRPC_workerManager_workers) |
Variables | |
private global mapping | g_fwRPC_workerManager_workers |
private global int | g_fwRPC_workerManager_workersIterator |
private global string | g_fwRPC_workerManager_workerDeathCB |
This library contains the set of functions that handles worker management.
Part of the server-side RPC library.
int fwRPC_workerManager_deleteWorker | ( | int | workerId | ) |
Delete a worker from the worker collection and it's DP.
workerId | (IN, int) worker to delete |
nothing |
int fwRPC_workerManager_findSuitableWorker | ( | bool | exclusiveExec, |
dyn_mixed & | worker | ||
) |
Attempt to find a worker which is able to execute a function under the given exclusivity option.
exclusiveExec | (IN, bool) whether the request requires exclusive execution |
worker | (OUT, worker) a suitable worker, if found |
nothing |
int fwRPC_workerManager_getWorkerCount | ( | ) |
Return the total number of registered workers in the local system.
nothing |
void fwRPC_workerManager_initialize | ( | int | workerCount = -1 , |
int | maxWorkers = -1 , |
||
string | workerDeathCB | ||
) |
Ensures that the system starts with workerCount workers, and is bound to maxWorkers, unless workerCount is -1, in which case no worker ctrl manager management is performed (and maxWorkers is therefore ignored). Starts any stopped workers.
workerCount | (IN, int) starting number of workers |
maxWorkers | (IN, int) max number of workers allowed |
workerDeathCB | (IN, string) callback to be executed on worker update event |
on | PMON error |
bool fwRPC_workerManager_isAnyWorkerPendingRestart | ( | ) |
Return whether or not any workers are pending restart.
nothing |
bool fwRPC_workerManager_isWorkerPendingRestart | ( | dyn_mixed | worker | ) |
Return whether or not a given worker is pending restart.
worker | (IN, dyn_mixed) worker object to check |
nothing |
int fwRPC_workerManager_notifyHeartbeat | ( | int | id | ) |
Notify a heartbeat event for a given worker by it's ID. This function should be called whenever a heartbeat message is received from the worker itself.
id | (IN, int) worker id |
nothing |
bool fwRPC_workerManager_pendWorkerRestart | ( | bool | immediateRestart | ) |
Set all workers to a pending restart state.
The worker manager will attempt to restart the workers immediately. If this is done, then the function will return false to indicate that the worker manager is not pending restart. If this is not the case then the function will return true, indicating that the worker manager is still pending restart on at least one worker.
immediateRestart | (IN, bool) whether we can try to restart immediately if a worker is idle |
nothing |
int fwRPC_workerManager_registerWorker | ( | dyn_mixed | worker | ) |
Add a worker to the worker collection if it's not already present. If the worker already exists in the collection then it will not be replaced, and this function will return -1.
worker | (IN, dyn_mixed) worker to register |
nothing |
void fwRPC_workerManager_restartWorker | ( | dyn_mixed | worker | ) |
Restart a given worker.
worker | (IN, dyn_mixed) worker to restart |
nothing |
void fwRPC_workerManager_updateState | ( | dyn_mixed | worker | ) |
Update a specific worker with a new state.
Only status, job count and locked status will be changed.
If the worker does not currently exist, it will be added to the pool as an active worker.
worker | (IN, dyn_mixed) New worker state |
nothing |
private global string g_fwRPC_workerManager_workerDeathCB |
Callback function to call when a worker is declared dead
private global mapping g_fwRPC_workerManager_workers |
Mapping of workers. Structure: key = worker id value = worker object (see fwRPC_workerModel.ctl)
private global int g_fwRPC_workerManager_workersIterator |
Worker iterator for round-robin load balancing value is 0 if no workers exist.