Kea 2.7.5
|
Application Process Interface. More...
#include <d_process.h>
Public Member Functions | |
DProcessBase (const char *app_name, asiolink::IOServicePtr io_service, DCfgMgrBasePtr cfg_mgr) | |
Constructor. | |
virtual | ~DProcessBase () |
Destructor. | |
virtual isc::data::ConstElementPtr | configure (isc::data::ConstElementPtr config_set, bool check_only=false)=0 |
Processes the given configuration. | |
const std::string | getAppName () const |
Fetches the application name. | |
DCfgMgrBasePtr & | getCfgMgr () |
Fetches the process's configuration manager. | |
asiolink::IOServicePtr & | getIOService () |
Fetches the controller's IOService. | |
virtual void | init ()=0 |
May be used after instantiation to perform initialization unique to application. | |
virtual void | run ()=0 |
Implements the process's event loop. | |
void | setShutdownFlag (bool value) |
Sets the process shut down flag to the given value. | |
bool | shouldShutdown () const |
Checks if the process has been instructed to shut down. | |
virtual isc::data::ConstElementPtr | shutdown (isc::data::ConstElementPtr args)=0 |
Initiates the process's shutdown process. | |
void | stopIOService () |
Convenience method for stopping IOservice processing. | |
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 75 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 87 of file d_process.h.
References isc_throw.
|
inlinevirtual |
Destructor.
Definition at line 148 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::agent::CtrlAgentProcess, isc::d2::D2Process, and isc::netconf::NetconfProcess.
|
inline |
Fetches the application name.
Definition at line 169 of file d_process.h.
|
inline |
Fetches the process's configuration manager.
Definition at line 191 of file d_process.h.
Referenced by isc::agent::CtrlAgentProcess::configure(), isc::d2::D2Process::configure(), isc::netconf::NetconfProcess::configure(), isc::agent::CtrlAgentProcess::getCtrlAgentCfgMgr(), isc::d2::D2Process::getD2CfgMgr(), and isc::netconf::NetconfProcess::getNetconfCfgMgr().
|
inline |
Fetches the controller's IOService.
Definition at line 176 of file d_process.h.
Referenced by isc::d2::D2Process::D2Process(), isc::d2::D2Process::~D2Process(), isc::agent::CtrlAgentProcess::configure(), isc::d2::D2Process::configure(), isc::d2::D2Process::init(), 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::agent::CtrlAgentProcess, isc::d2::D2Process, 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::agent::CtrlAgentProcess, isc::d2::D2Process, 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 162 of file d_process.h.
Referenced by isc::agent::CtrlAgentProcess::shutdown(), isc::d2::D2Process::shutdown(), and isc::netconf::NetconfProcess::shutdown().
|
inline |
Checks if the process has been instructed to shut down.
Definition at line 155 of file d_process.h.
Referenced by isc::d2::D2Process::canShutdown(), isc::d2::D2Process::checkQueueStatus(), isc::agent::CtrlAgentProcess::run(), and isc::netconf::NetconfProcess::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::agent::CtrlAgentProcess, isc::d2::D2Process, 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 184 of file d_process.h.
Referenced by isc::agent::CtrlAgentProcess::run(), and isc::netconf::NetconfProcess::run().