Kea  2.1.7-git
isc::data::StampedElement Class Reference

This class represents configuration element which is associated with database identifier, modification timestamp and servers. More...

#include <stamped_element.h>

+ Inheritance diagram for isc::data::StampedElement:

Public Member Functions

 StampedElement ()
 Constructor. More...
 
void delServerTag (const std::string &server_tag)
 Deletes server tag. More...
 
isc::data::ElementPtr getMetadata () const
 Returns an object representing metadata to be returned with objects from the configuration backend. More...
 
std::set< ServerTaggetServerTags () const
 Returns server tags. More...
 
bool hasAllServerTag () const
 Checks if the element has 'all' server tag. More...
 
bool hasServerTag (const ServerTag &server_tag) const
 Checks if the element has the given server tag. More...
 
void setServerTag (const std::string &server_tag)
 Adds new server tag. More...
 
- Public Member Functions inherited from isc::data::BaseStampedElement
 BaseStampedElement ()
 Constructor. More...
 
uint64_t getId () const
 Returns element's database identifier. More...
 
boost::posix_time::ptime getModificationTime () const
 Returns timestamp. More...
 
void setId (const uint64_t id)
 Sets element's database identifier. More...
 
void setModificationTime (const boost::posix_time::ptime &timestamp)
 Sets timestamp to the explicitly provided value. More...
 
void updateModificationTime ()
 Sets timestamp to the current time. More...
 

Additional Inherited Members

- Protected Attributes inherited from isc::data::BaseStampedElement
uint64_t id_
 Database identifier of the configuration element. More...
 
boost::posix_time::ptime timestamp_
 Holds timestamp value. More...
 

Detailed Description

This class represents configuration element which is associated with database identifier, modification timestamp and servers.

Classes storing Kea configuration should derive from this object to track ids and modification times of the configuration objects. This is specifically required by the Kea Configuration Backend feature which stores and fetches configuration from the database. The configuration elements must be accessible by their database identifiers and modification times.

Note
This class is not derived from Element and should not be confused with the classes being derived from Element class. Those classes are used to represent JSON structures, whereas this class represents data fetched from the database.
Todo:
Find a better name for StampedElement.

Definition at line 34 of file stamped_element.h.

Constructor & Destructor Documentation

◆ StampedElement()

isc::data::StampedElement::StampedElement ( )

Constructor.

Sets timestamp to the current time.

Definition at line 14 of file stamped_element.cc.

Member Function Documentation

◆ delServerTag()

void isc::data::StampedElement::delServerTag ( const std::string &  server_tag)

Deletes server tag.

Remove the first occurrence of the given server tag.

Parameters
server_tagserver tag to delete.
Exceptions
NotFoundif the server tag cannot be found.

Definition at line 24 of file stamped_element.cc.

References isc_throw.

Referenced by setServerTag().

◆ getMetadata()

ElementPtr isc::data::StampedElement::getMetadata ( ) const

Returns an object representing metadata to be returned with objects from the configuration backend.

Returns
Pointer to the metadata element.

Definition at line 37 of file stamped_element.cc.

References isc::data::Element::create(), isc::data::Element::createList(), and isc::data::Element::createMap().

Referenced by getServerTags().

+ Here is the call graph for this function:

◆ getServerTags()

std::set<ServerTag> isc::data::StampedElement::getServerTags ( ) const
inline

Returns server tags.

Returns
Server tags.

Definition at line 61 of file stamped_element.h.

References getMetadata(), hasAllServerTag(), and hasServerTag().

+ Here is the call graph for this function:

◆ hasAllServerTag()

bool isc::data::StampedElement::hasAllServerTag ( ) const

Checks if the element has 'all' server tag.

Returns
true if the server tag was found, false otherwise.

Definition at line 31 of file stamped_element.cc.

References isc::data::ServerTag::ALL, and hasServerTag().

Referenced by getServerTags().

+ Here is the call graph for this function:

◆ hasServerTag()

bool isc::data::StampedElement::hasServerTag ( const ServerTag server_tag) const

Checks if the element has the given server tag.

Parameters
server_tagServer tag to be found.
Returns
true if the server tag was found, false otherwise.

Definition at line 19 of file stamped_element.cc.

Referenced by getServerTags(), and hasAllServerTag().

◆ setServerTag()

void isc::data::StampedElement::setServerTag ( const std::string &  server_tag)
inline

Adds new server tag.

Parameters
server_tagnew server tag.
Exceptions
BadValueif the server tag length exceeds 256 characters.

Definition at line 46 of file stamped_element.h.

References delServerTag().

+ Here is the call graph for this function:

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