7 #ifndef RECONNECT_CTL_H 8 #define RECONNECT_CTL_H 11 #include <boost/shared_ptr.hpp> 39 ReconnectCtl(
const std::string& backend_type,
const std::string& timer_name,
40 unsigned int max_retries,
unsigned int retry_interval,
42 backend_type_(backend_type), timer_name_(timer_name),
43 max_retries_(max_retries), retries_left_(max_retries),
44 retry_interval_(retry_interval), action_(action) {}
48 return (backend_type_);
63 return (retries_left_ ? --retries_left_ :
false);
68 return (max_retries_);
73 return (retries_left_);
78 return (max_retries_ - retries_left_);
83 return (retry_interval_);
88 retries_left_ = max_retries_;
108 static std::string onFailActionToText(
OnFailAction action);
114 static OnFailAction onFailActionFromText(
const std::string& text);
119 const std::string backend_type_;
122 std::string timer_name_;
125 unsigned int max_retries_;
128 unsigned int retries_left_;
131 unsigned int retry_interval_;
143 #endif // RECONNECT_CTL_H
boost::shared_ptr< ReconnectCtl > ReconnectCtlPtr
Pointer to an instance of ReconnectCtl.
Warehouses reconnect control values.
unsigned int maxRetries() const
Returns the maximum number of retries allowed.
unsigned int retryIndex() const
Returns an index of current retry.
OnFailAction
Type of action to take on connection loss.
std::string timerName() const
Returns the associated timer name.
unsigned int retryInterval() const
Returns the amount of time to wait between reconnect attempts.
Defines the logger used by the top-level component of kea-lfc.
bool checkRetries()
Decrements the number of retries remaining.
void resetRetries()
Resets the retries count.
std::string backendType() const
Returns the type of the caller backend.
bool exitOnFailure() const
Return true if the connection recovery mechanism should shut down the server on failure, false otherwise.
ReconnectCtl(const std::string &backend_type, const std::string &timer_name, unsigned int max_retries, unsigned int retry_interval, OnFailAction action)
Constructor.
unsigned int retriesLeft() const
Returns the number for retries remaining.
bool alterServiceState() const
Return true if the connection loss should affect the service, false otherwise.