Kea 2.7.4
isc::util::ReconnectCtl Class Reference

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)
 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 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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ReconnectCtl()

isc::util::ReconnectCtl::ReconnectCtl ( const std::string & backend_type,
const std::string & timer_name,
unsigned int max_retries,
unsigned int retry_interval,
OnFailAction action )
inline

Constructor.

Parameters
backend_typetype of the caller backend.
timer_nametimer associated to this object.
max_retriesmaximum number of reconnect attempts to make.
retry_intervalamount of time to between reconnect attempts.
actionwhich should be taken on connection loss.

Definition at line 39 of file reconnect_ctl.h.

Member Function Documentation

◆ alterServiceState()

bool isc::util::ReconnectCtl::alterServiceState ( ) const
inline

Return true if the connection loss should affect the service, false otherwise.

Definition at line 93 of file reconnect_ctl.h.

References isc::util::STOP_RETRY_EXIT.

◆ backendType()

std::string isc::util::ReconnectCtl::backendType ( ) const
inline

Returns the type of the caller backend.

Definition at line 47 of file reconnect_ctl.h.

◆ checkRetries()

bool isc::util::ReconnectCtl::checkRetries ( )
inline

Decrements the number of retries remaining.

Each call decrements the number of retries by one until zero is reached.

Returns
true the number of retries remaining is greater than zero.

Definition at line 62 of file reconnect_ctl.h.

◆ exitOnFailure()

bool isc::util::ReconnectCtl::exitOnFailure ( ) const
inline

Return true if the connection recovery mechanism should shut down the server on failure, false otherwise.

Definition at line 99 of file reconnect_ctl.h.

References isc::util::SERVE_RETRY_EXIT, and isc::util::STOP_RETRY_EXIT.

◆ maxRetries()

unsigned int isc::util::ReconnectCtl::maxRetries ( ) const
inline

Returns the maximum number of retries allowed.

Definition at line 67 of file reconnect_ctl.h.

◆ onFailActionFromText()

OnFailAction isc::util::ReconnectCtl::onFailActionFromText ( const std::string & text)
static

Convert string to action.

Parameters
textThe text to be converted to action type.
Returns
The action type corresponding to the text representation.

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().

◆ onFailActionToText()

std::string isc::util::ReconnectCtl::onFailActionToText ( OnFailAction action)
static

Convert action to string.

Parameters
actionThe action type to be converted to text.
Returns
The text representation of the action type.

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.

◆ resetRetries()

void isc::util::ReconnectCtl::resetRetries ( )
inline

Resets the retries count.

Definition at line 87 of file reconnect_ctl.h.

◆ retriesLeft()

unsigned int isc::util::ReconnectCtl::retriesLeft ( ) const
inline

Returns the number for retries remaining.

Definition at line 72 of file reconnect_ctl.h.

◆ retryIndex()

unsigned int isc::util::ReconnectCtl::retryIndex ( ) const
inline

Returns an index of current retry.

Definition at line 77 of file reconnect_ctl.h.

◆ retryInterval()

unsigned int isc::util::ReconnectCtl::retryInterval ( ) const
inline

Returns the amount of time to wait between reconnect attempts.

Definition at line 82 of file reconnect_ctl.h.

◆ timerName()

std::string isc::util::ReconnectCtl::timerName ( ) const
inline

Returns the associated timer name.

Returns
the associated timer.

Definition at line 54 of file reconnect_ctl.h.


The documentation for this class was generated from the following files: