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

Additional Inherited Members

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

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.

◆ 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().

+ 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.

◆ 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().

+ 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 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.


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