Kea 2.7.4
|
Maintains an in-memory store of alarms. More...
#include <alarm_store.h>
Public Member Functions | |
AlarmStore (uint16_t family) | |
Constructor. | |
~AlarmStore ()=default | |
Destructor. | |
AlarmPtr | addAlarm (AlarmPtr alarm) |
Adds an alarm to the store. | |
AlarmPtr | addAlarm (DurationKeyPtr key, const Duration &low_water, const Duration &high_water, bool enabled=true) |
Creates a new alarm and adds it to the store. | |
AlarmPtr | checkDurationSample (DurationKeyPtr key, const Duration &sample, const Duration &report_interval) |
Checks a sample against an alarm. | |
void | clear () |
Removes all alarms from the store. | |
void | deleteAlarm (DurationKeyPtr key) |
Removes the alarm from the store. | |
AlarmPtr | getAlarm (DurationKeyPtr key) |
Fetches a duration from the store for a given key. | |
AlarmCollectionPtr | getAll () |
Fetches all of the alarms (in order by target) | |
uint16_t | getFamily () |
Get protocol family. | |
void | updateAlarm (AlarmPtr &alarm) |
Updates an alarm in the store. | |
Maintains an in-memory store of alarms.
Provides essential CRUD functions for managing a collection of alarms. Additionally there are finders that can return durations by DurationKey (others are TBD). All finders return copies of the durations found, rather than the stored duration itself.
Definition at line 74 of file alarm_store.h.
|
explicit |
Constructor.
family | protocol family AF_INET or AF_INET6 |
Definition at line 19 of file alarm_store.cc.
References isc_throw.
|
default |
Destructor.
Adds an alarm to the store.
Definition at line 76 of file alarm_store.cc.
References isc_throw.
AlarmPtr isc::perfmon::AlarmStore::addAlarm | ( | DurationKeyPtr | key, |
const Duration & | low_water, | ||
const Duration & | high_water, | ||
bool | enabled = true ) |
Creates a new alarm and adds it to the store.
key | key value of the alarm to create. |
low_water | threshold below which the mean duration must fall to clear the alarm |
high_water | threshold above which the mean duration must rise to trigger the alarm. |
enabled | true sets state to CLEAR, otherwise DISABLED, defaults to true. |
DuplicateAlarm | if a duration for the given key already exists in the store. |
Definition at line 89 of file alarm_store.cc.
References addAlarm(), isc_throw, and isc::Exception::what().
Referenced by addAlarm().
AlarmPtr isc::perfmon::AlarmStore::checkDurationSample | ( | DurationKeyPtr | key, |
const Duration & | sample, | ||
const Duration & | report_interval ) |
Checks a sample against an alarm.
If the alarm exists in the store for the duration key, then Alarm::checkSample() is invoked on the in-store alarm. If this returns true, indicating an alarm state change, then a copy of the in-store alarm is returned, otherwise an empty pointer is returned.
If no alarm exists in the store, then it simply returns an empty pointer.
This function does not/must not modify any index keys.
key | key value of the alarm to check. |
sample | duration value to check. |
report_interval | amount of time that must elapse between high water reports. |
Definition at line 43 of file alarm_store.cc.
References isc_throw.
void isc::perfmon::AlarmStore::clear | ( | ) |
Removes all alarms from the store.
Definition at line 160 of file alarm_store.cc.
void isc::perfmon::AlarmStore::deleteAlarm | ( | DurationKeyPtr | key | ) |
Removes the alarm from the store.
If the alarm does not exist in the store, it simply returns.
key | key value of the alarm to delete. |
Definition at line 132 of file alarm_store.cc.
AlarmPtr isc::perfmon::AlarmStore::getAlarm | ( | DurationKeyPtr | key | ) |
Fetches a duration from the store for a given key.
key | key value of the alarm to fetch. |
Definition at line 105 of file alarm_store.cc.
AlarmCollectionPtr isc::perfmon::AlarmStore::getAll | ( | ) |
Fetches all of the alarms (in order by target)
Definition at line 148 of file alarm_store.cc.
|
inline |
Get protocol family.
Definition at line 157 of file alarm_store.h.
void isc::perfmon::AlarmStore::updateAlarm | ( | AlarmPtr & | alarm | ) |
Updates an alarm in the store.
The alarm is assumed to already exist in the store.
alarm | alarm to update. |
InvalidOperation | if the alarm does not exist in the store. |
Definition at line 116 of file alarm_store.cc.
References isc_throw.