Commit 51a47278 authored by Francis Dupont's avatar Francis Dupont Committed by Marcin Siodelski
Browse files

[#1041] Checkpoint: added reload, doc to do

parent 15a9c887
......@@ -587,7 +587,11 @@ ControlledDhcpv4Srv::commandStatusGetHandler(const string&,
auto uptime = now - start_;
status->set("uptime", Element::create(uptime.total_seconds()));
// todo: duration since last config commit.
auto last_commit = CfgMgr::instance().getCurrentCfg()->getLastCommitTime();
if (!last_commit.is_not_a_date_time()) {
auto reload = now - last_commit;
status->set("reload", Element::create(reload.total_seconds()));
}
// todo: number of service threads.
......
......@@ -587,7 +587,11 @@ ControlledDhcpv6Srv::commandStatusGetHandler(const string&,
auto uptime = now - start_;
status->set("uptime", Element::create(uptime.total_seconds()));
// todo: duration since last config commit.
auto last_commit = CfgMgr::instance().getCurrentCfg()->getLastCommitTime();
if (!last_commit.is_not_a_date_time()) {
auto reload = now - last_commit;
status->set("reload", Element::create(reload.total_seconds()));
}
// todo: number of service threads.
......
......@@ -108,6 +108,10 @@ CfgMgr::commit() {
}
}
// Set the last commit timestamp.
auto now = boost::posix_time::second_clock::universal_time();
configuration_->setLastCommitTime(now);
// Now we need to set the statistics back.
configuration_->updateStatistics();
}
......
......@@ -30,6 +30,7 @@
#include <cc/user_context.h>
#include <cc/simple_parser.h>
#include <boost/shared_ptr.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <vector>
#include <stdint.h>
......@@ -679,6 +680,18 @@ public:
/// @param srv_elem server top level map to alter
static void moveDdnsParams(isc::data::ElementPtr srv_elem);
/// @brief Returns the last commit timestamp.
/// @return the last commit timestamp.
boost::posix_time::ptime getLastCommitTime() const {
return (last_commit_time_);
}
/// @brief Sets the last commit timestamp.
/// @param last_commit_time last commit timestamp.
void setLastCommitTime(const boost::posix_time::ptime& last_commit_time) {
last_commit_time_ = last_commit_time;
}
/// @brief Unparse a configuration object
///
/// @return a pointer to unparsed configuration
......@@ -832,6 +845,9 @@ private:
/// @brief Pointer to the configuration consistency settings
CfgConsistencyPtr cfg_consist_;
/// @brief Stores the last commit timestamp.
boost::posix_time::ptime last_commit_time_;
};
/// @name Pointers to the @c SrvConfig object.
......
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