Commit 48088cdb authored by Francis Dupont's avatar Francis Dupont
Browse files

[5533] Prepared rebase before adding tests

parent d2bad4f7
premium @ 7eae81e9
Subproject commit 16181d80e33bab062dcd22c523be3676659a38cc
Subproject commit 7eae81e92f9ea28349f0c933a5123c20483bc078
......@@ -14,7 +14,7 @@ namespace dhcp {
/// @brief Abstract interface extending base simple data source for host
/// reservations to host cache.
/// Only the insert() method is required to use the cache.
class CacheHostDataSource : public BaseHostDataSource {
class CacheHostDataSource : public virtual BaseHostDataSource {
public:
/// @brief Default destructor implementation.
......
......@@ -62,7 +62,7 @@ CfgDbAccess::createManagers() const {
}
// Check for a host cache.
HostMgr::checkCacheSource();
HostMgr::checkCacheSource(true);
}
std::string
......
......@@ -65,7 +65,7 @@ HostMgr::getHostDataSource() const {
}
bool
HostMgr::checkCacheSource() {
HostMgr::checkCacheSource(bool logging) {
if (getHostMgrPtr()->cache_ptr_) {
return (true);
}
......@@ -77,6 +77,10 @@ HostMgr::checkCacheSource() {
boost::dynamic_pointer_cast<CacheHostDataSource>(sources[0]);
if (cache_ptr) {
getHostMgrPtr()->cache_ptr_ = cache_ptr;
if (logging) {
LOG_INFO(hosts_logger, HOSTS_CFG_CACHE_HOST_DATA_SOURCE)
.arg(cache_ptr->getType());
}
return (true);
}
return (false);
......
......@@ -86,7 +86,10 @@ public:
///
/// Checks if the first host data source implements
/// the cache abstract class and sets cache_ptr_.
static bool checkCacheSource();
///
/// @param logging When true (not the default) emit an informational log.
/// @return true if the first host data source is a cache.
static bool checkCacheSource(bool logging = false);
/// @brief Returns a sole instance of the @c HostMgr.
///
......
......@@ -11,6 +11,10 @@ This debug message is issued when new host (with reservations) is added to
the server's configuration. The argument describes the host and its
reservations in detail.
% HOSTS_CFG_CACHE_HOST_DATA_SOURCE get host cache data source: %1
This informational message is issued when a host cache data source is
detected by the host manager.
% HOSTS_CFG_CLOSE_HOST_DATA_SOURCE Closing host data source: %1
This is a normal message being printed when the server closes host data
source connection.
......
......@@ -21,7 +21,7 @@ namespace test {
/// It used vector<HostPtr> as a storage and iterates through all hosts when
/// conducting operations. Most operations are skeleton methods that don't
/// work, just several are implemented. Those are used in the tests.
class MemHostDataSource : public BaseHostDataSource {
class MemHostDataSource : public virtual BaseHostDataSource {
public:
/// @brief Destructor.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment