fwRPC
 All Files Functions Variables
fwRPC_core.ctl File Reference

Functions

void fwRPC_core_initialize (int startingWorkers=-1, int maxWorkers=-1, bool distributed=false, string coreName="")
 
private void _fwRPC_core_restartRequest_cb (string dp, bool restart)
 
private void _fwRPC_core_dbg_reportCB ()
 
void fwRPC_core_shutdown ()
 
private void _fwRPC_core_workerDeathCB (int workerId)
 
void _fwRPC_core_clearQueue ()
 
private void _fwRPC_core_hdlNewClient (string project, string name)
 
private void _fwRPC_core_hdlStatus (string project, string name, anytype msg) synchronized(g_fwRPC_core_requests)
 
private void _fwRPC_core_hdl_c_request (anytype ctx, string project, string name, anytype msg)
 
private void _fwRPC_core_hdl_c_getResult (anytype ctx, string project, string name, anytype msg)
 
private void _fwRPC_core_hdl_c_acknowledge (anytype ctx, string project, string name, anytype msg)
 
private void _fwRPC_core_hdl_c_cancel (anytype ctx, string project, string name, anytype msg)
 
private void _fwRPC_core_hdl_c_recover (anytype ctx, string project, string name, anytype msg)
 
private void _fwRPC_core_hdl_c_listSvc (anytype ctx, string project, string name, anytype msg)
 
private void _fwRPC_core_hdlRequest (string project, string name, anytype msg) synchronized(g_fwRPC_core_requests)
 
private void _fwRPC_core_hdlGetResult (string senderProject, string senderName, anytype msg)
 
private void _fwRPC_core_hdlResult (string senderProject, string senderName, anytype msg) synchronized(g_fwRPC_core_requests)
 
private void _fwRPC_core_hdlListSvc (string project, string name, anytype msg)
 
private void _fwRPC_core_hdlAcknowledge (string project, string name, anytype msg) synchronized(g_fwRPC_core_requests)
 
private void _fwRPC_core_hdlCancel (string project, string name, anytype msg) synchronized(g_fwRPC_core_requests)
 
private void _fwRPC_core_hdlRecover (string project, string name, anytype msg) synchronized(g_fwRPC_core_requests)
 
private void _fwRPC_core_hdlWorkerHeartbeat (string project, string name, anytype msg)
 
private void _fwRPC_core_hdlWorkerState (string project, string name, anytype msg)
 
private synchronized bool _fwRPC_core_processPendingRestart (dyn_mixed updatedWorker)
 
private void _fwRPC_core_hdlWorkerDisconnect (string project, string name, anytype msg)
 
private void _fwRPC_core_resetRequests (int workerId) synchronized(g_fwRPC_core_requests)
 
private bool _fwRPC_core_requestNeedsExclusive (dyn_mixed request)
 
private int _fwRPC_core_dispatchToWorkerOrEnqueue (dyn_mixed &request)
 
private int _fwRPC_core_validateRequestedFunction (dyn_mixed &request)
 
private void _fwRPC_core_enqueueRequest (dyn_mixed &request) synchronized(g_fwRPC_core_requestQueue)
 
private void _fwRPC_core_processQueue () synchronized(g_fwRPC_core_requestQueue)
 
private int _fwRPC_core_assignRequest (dyn_mixed worker, dyn_mixed &request)
 
private int _fwRPC_core_sendStatusUpdate (dyn_mixed request)
 

Variables

private global const int fwRPC_CORE_E_SUCCESS = 0
 
private global const int fwRPC_CORE_E_ERROR = -1
 
private global const int fwRPC_CORE_E_REQ_NOT_FOUND = -2
 
private global dyn_dyn_mixed g_fwRPC_core_requestQueue
 
private global mapping g_fwRPC_core_requests
 
private global mixed g_fwRPC_core_last_queued_since_restart
 
private global bool g_fwRPC_core_distributed
 
private global const string _fwRPC_CORE_DEFAULT_NAME = "fwRPC_core"
 
private global bool g_fwRPC_core_pendingRestart
 
private global anytype g_fwRPC_core_msgClientCtx = ""
 

Detailed Description

This library contains the set of functions that handles the RPC core, responsible for initializing worker management and request distribution/dispatch modules. Part of the server-side RPC library.

Should be ran in it's own CTRL Manager. Only one instance should be running at any given time.

Author
Victor Rodrigues (CERN, BE-ICS-SDS)

Function Documentation

private int _fwRPC_core_validateRequestedFunction ( dyn_mixed &  request)

Check if the requested function is registered, and if not, set the request's status and result value to a suitable error object.

Parameters
request(IN|OUT, dyn_mixed) request object
Returns
fwRPC_CORE_E_SUCCESS if the requested function is registered fwRPC_CORE_E_ERROR otherwise
Exceptions
nothing
void fwRPC_core_initialize ( int  startingWorkers = -1,
int  maxWorkers = -1,
bool  distributed = false,
string  coreName = "" 
)

Initialize and run the core module. There should only be one instance of the core running per project.

If startingWorkers and maxWorkers are set to values other than -1, then the core will automatically balance the current number of worker scrip WCCOActrl managers running on the current project to the bounds specified.

If distributed is set to true, the core will listen for messages from clients in connected projects through the fwRPC_broker module.

The msgClient name is automatically set to a default constant, however this may be overwritten for testing purposes.

Parameters
startingWorkers(IN, int) Number of workers to initialize with
maxWorkers(IN, int) Max number of workers at any given time
distributed(IN, bool) Whether or not this core is part of a non local RPC system.
coreName(IN, string) Manual specification of core name
Returns
nothing
Exceptions
onPMON error if clientName is empty
void fwRPC_core_shutdown ( )

Perform a clean up before stopping the core.

Returns
nothing
Exceptions
nothing

Variable Documentation

private global const string _fwRPC_CORE_DEFAULT_NAME = "fwRPC_core"

Default msgClient name

private global const int fwRPC_CORE_E_SUCCESS = 0

Error codes

private global bool g_fwRPC_core_distributed

Whether the core is running in distributed or local mode. If distributed mode is on, then the core will communicate with fwRPC systems running in other WCCOA systems.

private global mixed g_fwRPC_core_last_queued_since_restart

The hdl of the last queued request since a restart was requested. This is to protect against requests failing when made immediately before a restart was initiated and their function definitions change.

An empty string indicates that no legacy requests are waiting and we can restart the workers.

private global bool g_fwRPC_core_pendingRestart

Defines whether or not the core is pending a function definition restart. If this value is true, then all new requests will be enqueued until all workers have performed a restart.

private global dyn_dyn_mixed g_fwRPC_core_requestQueue

End error codes Request queue. Requests are enqueued here when a suitable worker has not been found yet.

Structure: [x]: request model (see fwRPC_requestModel.ctl)

private global mapping g_fwRPC_core_requests

Mapping of requests currently in progress. Structure: key = requesst handle value = request object (see fwRPC_requestModel.ctl)