13#include <boost/multi_index/indexed_by.hpp>
14#include <boost/multi_index/member.hpp>
15#include <boost/multi_index/mem_fun.hpp>
16#include <boost/multi_index/ordered_index.hpp>
17#include <boost/multi_index_container.hpp>
18#include <boost/multi_index/composite_key.hpp>
19#include <boost/multi_index/sequenced_index.hpp>
20#include <boost/multi_index/identity.hpp>
21#include <boost/scoped_ptr.hpp>
48typedef boost::multi_index_container<
51 boost::multi_index::indexed_by<
54 boost::multi_index::ordered_unique<
55 boost::multi_index::tag<AlarmPrimaryKeyTag>,
56 boost::multi_index::identity<DurationKey>
116 const Duration& high_water,
bool enabled =
true);
169 void validateKey(
const std::string& label,
DurationKeyPtr key)
const;
178 const boost::scoped_ptr<std::mutex> mutex_;
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Maintains an in-memory store of alarms.
AlarmStore(uint16_t family)
Constructor.
~AlarmStore()=default
Destructor.
AlarmPtr checkDurationSample(DurationKeyPtr key, const Duration &sample, const Duration &report_interval)
Checks a sample against an alarm.
void updateAlarm(AlarmPtr &alarm)
Updates an alarm in the store.
void deleteAlarm(DurationKeyPtr key)
Removes the alarm from the store.
AlarmCollectionPtr getAll()
Fetches all of the alarms (in order by target)
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 getAlarm(DurationKeyPtr key)
Fetches a duration from the store for a given key.
void clear()
Removes all alarms from the store.
uint16_t getFamily()
Get protocol family.
Exception thrown when an attempt was made to add a duplicate key to either the duration or alarm stor...
DuplicateAlarm(const char *file, size_t line, const char *what)
boost::posix_time::time_duration Duration
boost::shared_ptr< DurationKey > DurationKeyPtr
Defines a pointer to a DurationKey instance.
std::vector< AlarmPtr > AlarmCollection
Type for a collection of AlarmPtrs.
boost::shared_ptr< AlarmCollection > AlarmCollectionPtr
Type for a pointer to a collection of AlarmPtrs.
boost::shared_ptr< AlarmStore > AlarmStorePtr
boost::shared_ptr< Alarm > AlarmPtr
Defines a pointer to an Alarm instance.
boost::multi_index_container< AlarmPtr, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< AlarmPrimaryKeyTag >, boost::multi_index::identity< DurationKey > > > > AlarmContainer
A multi index container holding pointers to alarms.
Defines the logger used by the top-level component of kea-lfc.
Tag for index by primary key (DurationKey).