Kea 2.7.6
isc::perfmon::MonitoredDurationStore Class Reference

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ MonitoredDurationStore()

isc::perfmon::MonitoredDurationStore::MonitoredDurationStore ( uint16_t family,
const Duration & interval_duration )
explicit

Constructor.

Parameters
familyprotocol family AF_INET or AF_INET6
interval_durationthe interval duration

Definition at line 21 of file monitored_duration_store.cc.

References isc_throw, and isc::perfmon::DurationDataInterval::ZERO_DURATION().

+ Here is the call graph for this function:

◆ ~MonitoredDurationStore()

isc::perfmon::MonitoredDurationStore::~MonitoredDurationStore ( )
default

Destructor.

Member Function Documentation

◆ addDuration()

MonitoredDurationPtr isc::perfmon::MonitoredDurationStore::addDuration ( DurationKeyPtr key)

Creates a new duration and adds it to the store.

Parameters
keykey value of the duration to create.
Returns
pointer to the newly created duration.
Exceptions
DuplicateDurationif 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().

+ Here is the call graph for this function:

◆ addDurationSample()

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.

Parameters
keykey value of the duration to which to add.
sampleduration value to add
Returns
A copy of the updated duration if it should be reported, an empty pointer otherwise.

Definition at line 52 of file monitored_duration_store.cc.

References isc_throw.

◆ clear()

void isc::perfmon::MonitoredDurationStore::clear ( )

Removes all durations from the store.

Definition at line 199 of file monitored_duration_store.cc.

◆ deleteDuration()

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.

Parameters
keykey value of the duration to delete.

Definition at line 166 of file monitored_duration_store.cc.

◆ getAll()

MonitoredDurationCollectionPtr isc::perfmon::MonitoredDurationStore::getAll ( )

Fetches all of the durations (in order by target)

Returns
a collection of all durations in the store.

Definition at line 187 of file monitored_duration_store.cc.

◆ getDuration()

MonitoredDurationPtr isc::perfmon::MonitoredDurationStore::getDuration ( DurationKeyPtr key)

Fetches a duration from the store for a given key.

Parameters
keykey value of the duration to fetch.
Returns
Pointer the desired duration or an empty pointer.

Definition at line 129 of file monitored_duration_store.cc.

◆ getFamily()

uint16_t isc::perfmon::MonitoredDurationStore::getFamily ( )
inline

Get protocol family.

Returns
uint16_t containing the family (AF_INET or AF_INET6)

Definition at line 189 of file monitored_duration_store.h.

◆ getOverdueReports()

MonitoredDurationCollectionPtr isc::perfmon::MonitoredDurationStore::getOverdueReports ( const Timestamp & since = dhcp::PktEvent::now())

Fetches all durations that are overdue to report.

Parameters
sincetimestamp to search by. Defaults to current time.
Returns
a collection of the matching durations, ordered by current interval start time.

Definition at line 215 of file monitored_duration_store.cc.

References isc::dhcp::PktEvent::MIN_TIME().

+ Here is the call graph for this function:

◆ getReportsNext()

MonitoredDurationPtr isc::perfmon::MonitoredDurationStore::getReportsNext ( )

Fetches the duration which is due to report next.

Returns
pointer to the matching duration or an empty pointer if not found.

Definition at line 205 of file monitored_duration_store.cc.

References isc::dhcp::PktEvent::now().

+ Here is the call graph for this function:

◆ updateDuration()

void isc::perfmon::MonitoredDurationStore::updateDuration ( MonitoredDurationPtr & duration)

Updates a duration in the store.

The duration is assumed to already exist in the store.

Parameters
durationduration to update.
Exceptions
InvalidOperationif duration does not exist in the store.

Definition at line 145 of file monitored_duration_store.cc.

References isc_throw.


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