Warehouses reconnect control values. More...
#include <reconnect_ctl.h>
Public Member Functions | |
ReconnectCtl (const std::string &backend_type, const std::string &timer_name, unsigned int max_retries, unsigned int retry_interval, OnFailAction action, unsigned int id) | |
Constructor. | |
bool | alterServiceState () const |
Return true if the connection loss should affect the service, false otherwise. | |
std::string | backendType () const |
Returns the type of the caller backend. | |
bool | checkRetries () |
Decrements the number of retries remaining. | |
bool | exitOnFailure () const |
Return true if the connection recovery mechanism should shut down the server on failure, false otherwise. | |
unsigned int | id () const |
Returns the ID of the manager. | |
unsigned int | maxRetries () const |
Returns the maximum number of retries allowed. | |
void | resetRetries () |
Resets the retries count. | |
unsigned int | retriesLeft () const |
Returns the number for retries remaining. | |
unsigned int | retryIndex () const |
Returns an index of current retry. | |
unsigned int | retryInterval () const |
Returns the amount of time to wait between reconnect attempts. | |
std::string | timerName () const |
Returns the associated timer name. | |
Static Public Member Functions | |
static OnFailAction | onFailActionFromText (const std::string &text) |
Convert string to action. | |
static std::string | onFailActionToText (OnFailAction action) |
Convert action to string. | |
Warehouses reconnect control values.
When any connection loses connectivity to its backend, it creates an instance of this class based on its configuration parameters and passes the instance into connection's lost callback. This allows the layer(s) above the connection to know how to proceed.
Definition at line 30 of file reconnect_ctl.h.
|
inline |
Constructor.
backend_type | type of the caller backend. |
timer_name | timer associated to this object. |
max_retries | maximum number of reconnect attempts to make. |
retry_interval | amount of time to between reconnect attempts. |
action | which should be taken on connection loss. |
id | the ID of the manager. |
Definition at line 40 of file reconnect_ctl.h.
|
inline |
Return true if the connection loss should affect the service, false otherwise.
Definition at line 100 of file reconnect_ctl.h.
References isc::util::STOP_RETRY_EXIT.
|
inline |
Returns the type of the caller backend.
Definition at line 49 of file reconnect_ctl.h.
|
inline |
Decrements the number of retries remaining.
Each call decrements the number of retries by one until zero is reached.
Definition at line 69 of file reconnect_ctl.h.
|
inline |
Return true if the connection recovery mechanism should shut down the server on failure, false otherwise.
Definition at line 106 of file reconnect_ctl.h.
References isc::util::SERVE_RETRY_EXIT, and isc::util::STOP_RETRY_EXIT.
|
inline |
Returns the ID of the manager.
Definition at line 54 of file reconnect_ctl.h.
|
inline |
Returns the maximum number of retries allowed.
Definition at line 74 of file reconnect_ctl.h.
|
static |
Convert string to action.
text | The text to be converted to action type. |
Definition at line 28 of file reconnect_ctl.cc.
References isc_throw, isc::util::SERVE_RETRY_CONTINUE, isc::util::SERVE_RETRY_EXIT, and isc::util::STOP_RETRY_EXIT.
Referenced by isc::db::DatabaseConnection::makeReconnectCtl(), and isc::dhcp::LegalLogMgr::parseDatabase().
|
static |
Convert action to string.
action | The action type to be converted to text. |
Definition at line 15 of file reconnect_ctl.cc.
References isc::util::SERVE_RETRY_CONTINUE, isc::util::SERVE_RETRY_EXIT, and isc::util::STOP_RETRY_EXIT.
Referenced by isc::dhcp::LegalLogMgr::parseDatabase().
|
inline |
Resets the retries count.
Definition at line 94 of file reconnect_ctl.h.
|
inline |
Returns the number for retries remaining.
Definition at line 79 of file reconnect_ctl.h.
|
inline |
Returns an index of current retry.
Definition at line 84 of file reconnect_ctl.h.
|
inline |
Returns the amount of time to wait between reconnect attempts.
Definition at line 89 of file reconnect_ctl.h.
|
inline |
Returns the associated timer name.
Definition at line 61 of file reconnect_ctl.h.