Kea 2.7.5
|
Maintains an in-memory store of durations. More...
#include <monitored_duration_store.h>
Public Member Functions | |
MonitoredDurationStore (uint16_t family, const Duration &interval_duration) | |
Constructor. | |
~MonitoredDurationStore ()=default | |
Destructor. | |
MonitoredDurationPtr | addDuration (DurationKeyPtr key) |
Creates a new duration and adds it to the store. | |
MonitoredDurationPtr | addDurationSample (DurationKeyPtr key, const Duration &sample) |
Adds a sample to a duration in-place. | |
void | clear () |
Removes all durations from the store. | |
void | deleteDuration (DurationKeyPtr key) |
Removes the duration from the store. | |
MonitoredDurationCollectionPtr | getAll () |
Fetches all of the durations (in order by target) | |
MonitoredDurationPtr | getDuration (DurationKeyPtr key) |
Fetches a duration from the store for a given key. | |
uint16_t | getFamily () |
Get protocol family. | |
MonitoredDurationCollectionPtr | getOverdueReports (const Timestamp &since=dhcp::PktEvent::now()) |
Fetches all durations that are overdue to report. | |
MonitoredDurationPtr | getReportsNext () |
Fetches the duration which is due to report next. | |
void | updateDuration (MonitoredDurationPtr &duration) |
Updates a duration in the store. | |
Maintains an in-memory store of durations.
Provides essential CRUD functions for managing a collection of durations. 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 102 of file monitored_duration_store.h.
|
explicit |
Constructor.
family | protocol family AF_INET or AF_INET6 |
interval_duration | the interval duration |
Definition at line 21 of file monitored_duration_store.cc.
References isc_throw, and isc::perfmon::DurationDataInterval::ZERO_DURATION().
|
default |
Destructor.
MonitoredDurationPtr isc::perfmon::MonitoredDurationStore::addDuration | ( | DurationKeyPtr | key | ) |
Creates a new duration and adds it to the store.
key | key value of the duration to create. |
DuplicateDuration | if a duration for the given key already exists in the store. |
Definition at line 101 of file monitored_duration_store.cc.
References isc_throw, and isc::Exception::what().
MonitoredDurationPtr isc::perfmon::MonitoredDurationStore::addDurationSample | ( | DurationKeyPtr | key, |
const Duration & | sample ) |
Adds a sample to a duration in-place.
If the duration exists in the store then the MonitoredDuration::addSample() is invoked on the in-store duration. If this returns true, indicating a reportable condition, then a copy of the in-store duration is returned, otherwise an empty pointer is returned.
If the duration does not exist in the store, then one is created and inserted into the store after adding the sample. An empty pointer is returned.
This function does not/must not modify any index keys.
key | key value of the duration to which to add. |
sample | duration value to add |
Definition at line 52 of file monitored_duration_store.cc.
References isc_throw.
void isc::perfmon::MonitoredDurationStore::clear | ( | ) |
Removes all durations from the store.
Definition at line 199 of file monitored_duration_store.cc.
void isc::perfmon::MonitoredDurationStore::deleteDuration | ( | DurationKeyPtr | key | ) |
Removes the duration from the store.
If the duration does not exist in the store, it simply returns.
key | key value of the duration to delete. |
Definition at line 166 of file monitored_duration_store.cc.
MonitoredDurationCollectionPtr isc::perfmon::MonitoredDurationStore::getAll | ( | ) |
Fetches all of the durations (in order by target)
Definition at line 187 of file monitored_duration_store.cc.
MonitoredDurationPtr isc::perfmon::MonitoredDurationStore::getDuration | ( | DurationKeyPtr | key | ) |
Fetches a duration from the store for a given key.
key | key value of the duration to fetch. |
Definition at line 129 of file monitored_duration_store.cc.
|
inline |
Get protocol family.
Definition at line 189 of file monitored_duration_store.h.
MonitoredDurationCollectionPtr isc::perfmon::MonitoredDurationStore::getOverdueReports | ( | const Timestamp & | since = dhcp::PktEvent::now() | ) |
Fetches all durations that are overdue to report.
since | timestamp to search by. Defaults to current time. |
Definition at line 215 of file monitored_duration_store.cc.
References isc::dhcp::PktEvent::MIN_TIME().
MonitoredDurationPtr isc::perfmon::MonitoredDurationStore::getReportsNext | ( | ) |
Fetches the duration which is due to report next.
Definition at line 205 of file monitored_duration_store.cc.
References isc::dhcp::PktEvent::now().
void isc::perfmon::MonitoredDurationStore::updateDuration | ( | MonitoredDurationPtr & | duration | ) |
Updates a duration in the store.
The duration is assumed to already exist in the store.
duration | duration to update. |
InvalidOperation | if duration does not exist in the store. |
Definition at line 145 of file monitored_duration_store.cc.
References isc_throw.