Kea
1.9.9-git
|
Application Process Interface. More...
#include <d_process.h>
Public Member Functions | |
DProcessBase (const char *app_name, asiolink::IOServicePtr io_service, DCfgMgrBasePtr cfg_mgr) | |
Constructor. More... | |
virtual | ~DProcessBase () |
Destructor. More... | |
virtual isc::data::ConstElementPtr | configure (isc::data::ConstElementPtr config_set, bool check_only=false)=0 |
Processes the given configuration. More... | |
const std::string | getAppName () const |
Fetches the application name. More... | |
DCfgMgrBasePtr & | getCfgMgr () |
Fetches the process's configuration manager. More... | |
asiolink::IOServicePtr & | getIoService () |
Fetches the controller's IOService. More... | |
virtual void | init ()=0 |
May be used after instantiation to perform initialization unique to application. More... | |
virtual void | run ()=0 |
Implements the process's event loop. More... | |
void | setShutdownFlag (bool value) |
Sets the process shut down flag to the given value. More... | |
bool | shouldShutdown () const |
Checks if the process has been instructed to shut down. More... | |
virtual isc::data::ConstElementPtr | shutdown (isc::data::ConstElementPtr args)=0 |
Initiates the process's shutdown process. More... | |
void | stopIOService () |
Convenience method for stopping IOservice processing. More... | |
Application Process Interface.
DProcessBase is an abstract class represents the primary "application" level object in a "managed" asynchronous application. It provides a uniform interface such that a managing layer can construct, initialize, and start the application's event loop. The event processing is centered around the use of isc::asiolink::io_service. The io_service is shared between the managing layer and the DProcessBase. This allows management layer IO such as directives to be sensed and handled, as well as processing IO activity specific to the application. In terms of management layer IO, there are methods shutdown, configuration updates, and commands unique to the application.
Definition at line 81 of file d_process.h.
|
inline |
Constructor.
app_name | is a text label for the process. Generally used in log statements, but otherwise arbitrary. |
io_service | is the io_service used by the caller for asynchronous event handling. |
cfg_mgr | the configuration manager instance that handles configuration parsing. |
DProcessBaseError | is io_service is NULL. |
Definition at line 93 of file d_process.h.
References isc_throw.
|
inlinevirtual |
Destructor.
Definition at line 154 of file d_process.h.
|
pure virtual |
Processes the given configuration.
This method may be called multiple times during the process lifetime. Certainly once during process startup, and possibly later if the user alters configuration. This method must not throw, it should catch any processing errors and return a success or failure answer as described below. On success the last commit timestamp must be updated.
config_set | a new configuration (JSON) for the process |
check_only | true if configuration is to be verified only, not applied |
Implemented in isc::d2::D2Process, isc::agent::CtrlAgentProcess, and isc::netconf::NetconfProcess.
|
inline |
Fetches the application name.
Definition at line 173 of file d_process.h.
|
inline |
Fetches the process's configuration manager.
Definition at line 195 of file d_process.h.
Referenced by isc::netconf::NetconfProcess::configure(), isc::agent::CtrlAgentProcess::configure(), isc::d2::D2Process::configure(), isc::agent::CtrlAgentProcess::getCtrlAgentCfgMgr(), isc::d2::D2Process::getD2CfgMgr(), and isc::netconf::NetconfProcess::getNetconfCfgMgr().
|
inline |
Fetches the controller's IOService.
Definition at line 180 of file d_process.h.
Referenced by isc::agent::CtrlAgentProcess::configure(), isc::d2::D2Process::configure(), isc::d2::D2Process::D2Process(), isc::d2::D2Process::init(), isc::netconf::NetconfProcess::run(), and isc::d2::D2Process::runIO().
|
pure virtual |
May be used after instantiation to perform initialization unique to application.
It must be invoked prior to invoking run. This would likely include the creation of additional IO sources and their integration into the io_service.
DProcessBaseError | if the initialization fails. |
Implemented in isc::d2::D2Process, isc::agent::CtrlAgentProcess, and isc::netconf::NetconfProcess.
|
pure virtual |
Implements the process's event loop.
In its simplest form it would an invocation io_service_->run(). This method should not exit until the process itself is exiting due to a request to shutdown or some anomaly is forcing an exit.
DProcessBaseError | if an operational error is encountered. |
Implemented in isc::d2::D2Process, isc::agent::CtrlAgentProcess, and isc::netconf::NetconfProcess.
|
inline |
Sets the process shut down flag to the given value.
value | is the new value to assign the flag. |
Definition at line 166 of file d_process.h.
Referenced by isc::netconf::NetconfProcess::shutdown(), isc::agent::CtrlAgentProcess::shutdown(), and isc::d2::D2Process::shutdown().
|
inline |
Checks if the process has been instructed to shut down.
Definition at line 159 of file d_process.h.
Referenced by isc::d2::D2Process::canShutdown(), isc::d2::D2Process::checkQueueStatus(), isc::netconf::NetconfProcess::run(), and isc::agent::CtrlAgentProcess::run().
|
pure virtual |
Initiates the process's shutdown process.
This is last step in the shutdown event callback chain, that is intended to notify the process it is to begin its shutdown process.
args | an Element set of shutdown arguments (if any) that are supported by the process derivation. |
DProcessBaseError | if an operational error is encountered. |
Implemented in isc::d2::D2Process, isc::agent::CtrlAgentProcess, and isc::netconf::NetconfProcess.
|
inline |
Convenience method for stopping IOservice processing.
Invoking this will cause the process to exit any blocking IOService method such as run(). No further IO events will be processed.
Definition at line 188 of file d_process.h.
Referenced by isc::netconf::NetconfProcess::run(), and isc::agent::CtrlAgentProcess::run().