Commit e46fc4cf authored by Micha Mueller's avatar Micha Mueller
Browse files

Rename cooldown to TTL (time to live)

parent 08545b16
......@@ -280,8 +280,8 @@ SensorTemplate {
pdus {
pdu rack1 {
networkAdr ?
cooldown 500
host example.com
TTL 500
sensors {
sensors pcs1 {
......@@ -308,8 +308,8 @@ Explanation of the values specific for the PDU plugin:
| Value | Explanation |
|:----- |:----------- |
| networkAdr | Work in progress...
| cooldown | To avoid requesting a current XML-file every time a sensor wants to read his value, one can define a cooldown here. A new XML-file is requested at the earliest if the cooldown has expired.
| host | Hostname where to fetch the XML-file with sensor data from. The plugin requests the file via HTTPS (one does not need to specify the port; 443 is used automatically)
| TTL | To avoid requesting a current XML-file every time a sensor wants to read his value, one can define a time to live (TTL) for the file here. A new XML-file is requested at the earliest if the TTL has expired. Default value is 1000[ms].
| clustsafeID | ID of the clustsafe instance the sensor should read from.
| outletID | ID of the outlet within the clustsafe the sensor should read.
......
......@@ -12,8 +12,8 @@ SensorTemplate {
pdus {
pdu rack1 {
; host testHorst ;port 443 for https will automatically be added
cooldown 500 ;Time interval at which the energy.xml is refreshed. If empty use smallest sensor-interval
host testHorst ;port 443 for https will automatically be added
TTL 500
; total {
; interval 500
......
......@@ -75,8 +75,8 @@ std::vector<Sensor*>& PDUConfigurator::readConfig(std::string cfgPath) {
//read PDU-values
BOOST_FOREACH(boost::property_tree::iptree::value_type &val, pdu.second) {
if (boost::iequals(val.first, "cooldown")) {
pduUnit.setCooldown(stoull(val.second.data()));
if (boost::iequals(val.first, "TTL")) {
pduUnit.setTTL(stoull(val.second.data()));
} else if (boost::iequals(val.first, "host")) {
pduUnit.setHost(val.second.data() + ":443");
} else if (boost::iequals(val.first, "sensors")) {
......
......@@ -19,7 +19,7 @@
#include <openssl/bio.h>
PDUUnit::PDUUnit() {
_cooldown = 1000;
_ttl = 1000;
_lastRefresh = 0;
_host = "";
_strand = NULL;
......@@ -32,7 +32,7 @@ PDUUnit::~PDUUnit() {
uint64_t PDUUnit::findValue(unsigned clustsafeID, unsigned outletID) {
//TODO use appropriate lock
uint64_t now = getTimestamp();
if (now >= _lastRefresh + MS_TO_NS(_cooldown)) {
if (now >= _lastRefresh + MS_TO_NS(_ttl)) {
refresh();
#ifdef DEBUG
std::cout << "[" << prettyPrintTimestamp(now) << "] " << "Refreshed XML-file" << std::endl;
......
......@@ -16,12 +16,12 @@ public:
PDUUnit();
virtual ~PDUUnit();
void setCooldown(unsigned cooldown) {
_cooldown = cooldown;
void setTTL(unsigned ttl) {
_ttl = ttl;
}
unsigned getCooldown() const {
return _cooldown;
unsigned getTTL() const {
return _ttl;
}
void setHost(const std::string& host) {
......@@ -52,7 +52,7 @@ private:
void refresh();
uint64_t _lastRefresh;
unsigned int _cooldown;
unsigned int _ttl;
std::string _host;
boost::property_tree::ptree _ptree;
boost::asio::io_service::strand* _strand;
......
Supports Markdown
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