15 #include <boost/date_time/posix_time/posix_time.hpp>
16 #include <boost/date_time/gregorian/gregorian.hpp>
79 template<
typename ConfigBackendMgrType>
138 if (!config_ctl || config_ctl->getConfigDatabases().empty()) {
144 for (
auto db : config_ctl->getConfigDatabases()) {
146 .arg(db.redactedAccessString());
147 getMgr().addBackend(db.getAccessString());
156 getMgr().delAllBackends();
188 std::string server_tag = srv_cfg->getServerTag();
209 audit_entries =
getMgr().getPool()->getRecentAuditEntries(backend_selector,
211 lb_modification_time,
220 audit_entries.clear();
230 lb_modification_time, audit_entries);
263 const std::string& object_type)
const {
266 auto range = index.equal_range(object_type);
267 for (
auto it = range.first; it != range.second; ++it) {
305 const boost::posix_time::ptime& lb_modification_time,
313 return (ConfigBackendMgrType::instance());
321 static boost::posix_time::ptime
322 initial_time(boost::gregorian::date(2000, boost::gregorian::Jan, 1));
323 return (initial_time);
336 if (audit_entries.empty()) {
365 const uint64_t& object_id) {
367 return (object_id_idx.count(object_id) > 0);
CBControlBase()
Constructor.
void updateLastAuditRevisionTimeId(const db::AuditEntryCollection &audit_entries)
Updates timestamp of the most recent audit entry fetched from the database.
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
bool hasObjectId(const db::AuditEntryCollection &audit_entries, const uint64_t &object_id)
Checks if an object is in a collection od audit entries.
ConfigBackendMgrType & getMgr() const
Returns the instance of the Config Backend Manager used by this object.
Base class for implementing server specific mechanisms to control the use of the Configuration Backen...
FetchMode
Fetch mode used in invocations to databaseConfigFetch.
isc::log::Logger dctl_logger("dctl")
Defines the logger used within libkea-process library.
db::AuditEntryCollection fetchConfigElement(const db::AuditEntryCollection &audit_entries, const std::string &object_type) const
Returns audit entries for new or updated configuration elements of specific type to be fetched from t...
static ServerSelector ONE(const std::string &server_tag)
Factory returning selector of one server.
Tag used to access index by modification time.
Tag used to access index by object id.
virtual void databaseConfigApply(const db::BackendSelector &backend_selector, const db::ServerSelector &server_selector, const boost::posix_time::ptime &lb_modification_time, const db::AuditEntryCollection &audit_entries)=0
Server specific method to fetch and apply back end configuration into the local configuration.
const isc::log::MessageID DCTL_CONFIG_FETCH
Server selector for associating objects in a database with specific servers.
void databaseConfigDisconnect()
Disconnects from the configuration backends.
Defines the logger used by the top-level component of kea-dhcp-ddns.
const isc::log::MessageID DCTL_OPEN_CONFIG_DB
bool databaseConfigConnect(const ConfigPtr &srv_cfg)
(Re)connects to the specified configuration backends.
static ServerSelector ALL()
Factory returning "all servers" selector.
uint64_t last_audit_revision_id_
Stores the most recent audit revision identifier.
void reset()
Resets the state of this object.
virtual void databaseConfigFetch(const ConfigPtr &srv_cfg, const FetchMode &fetch_mode=FetchMode::FETCH_ALL)
Fetches the entire or partial configuration from the database.
virtual ~CBControlBase()
Virtual destructor.
boost::multi_index_container< AuditEntryPtr, boost::multi_index::indexed_by< boost::multi_index::ordered_non_unique< boost::multi_index::tag< AuditEntryObjectTypeTag >, boost::multi_index::composite_key< AuditEntry, boost::multi_index::const_mem_fun< AuditEntry, std::string,&AuditEntry::getObjectType >, boost::multi_index::const_mem_fun< AuditEntry, AuditEntry::ModificationType,&AuditEntry::getModificationType > > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< AuditEntryModificationTimeIdTag >, boost::multi_index::composite_key< AuditEntry, boost::multi_index::const_mem_fun< AuditEntry, boost::posix_time::ptime,&AuditEntry::getModificationTime >, boost::multi_index::const_mem_fun< AuditEntry, uint64_t,&AuditEntry::getRevisionId > > >, boost::multi_index::hashed_non_unique< boost::multi_index::tag< AuditEntryObjectIdTag >, boost::multi_index::const_mem_fun< AuditEntry, uint64_t,&AuditEntry::getObjectId > > >> AuditEntryCollection
Multi index container holding AuditEntry instances.
Tag used to access index by object type.
boost::posix_time::ptime last_audit_revision_time_
Stores the most recent audit revision timestamp.
static boost::posix_time::ptime getInitialAuditRevisionTime()
Convenience method returning initial timestamp to set the last_audit_revision_time_ to...
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the ConfigBase.
boost::shared_ptr< const ConfigControlInfo > ConstConfigControlInfoPtr
Defines a pointer to a const ConfigControlInfo.