Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 3ec2f885 authored by Micha Mueller's avatar Micha Mueller
Browse files

Add skipConstVal flag: Enable or disable if constant values should be stored

parent 9783db2e
......@@ -28,8 +28,9 @@ group temp {
default def1
path /sys/devices/virtual/thermal/thermal_zone1/temp
sensor temp1 {
mqttsuffix 01
sensor temp1 {
skipConstVal on
mqttsuffix 01
}
}
......
......@@ -340,6 +340,8 @@ protected:
BOOST_FOREACH(boost::property_tree::iptree::value_type &val, config) {
if (boost::iequals(val.first, "mqttsuffix")) {
sBase.setMqtt(val.second.data());
} else if (boost::iequals(val.first, "skipConstVal")) {
sBase.setSkipConstVal(val.second.data());
}
}
sensorBase(sBase, config);
......
......@@ -22,6 +22,7 @@ public:
SensorBase(const std::string& name) :
_name(name),
_mqtt(""),
_skipConstVal(false),
_cache(nullptr),
_readingQueue(nullptr) {
......@@ -32,6 +33,7 @@ public:
SensorBase(const SensorBase& other) :
_name(other._name),
_mqtt(other._mqtt),
_skipConstVal(other._skipConstVal),
_cache(nullptr),
_latestValue(other._latestValue),
_readingQueue(nullptr) {}
......@@ -51,11 +53,19 @@ public:
const std::string& getName() const { return _name; }
const std::string& getMqtt() const { return _mqtt; }
bool getSkipConstVal() const { return _skipConstVal; }
const reading_t * const getCache() const { return _cache.get(); }
const reading_t getLatestValue() const { return _latestValue; }
void setName(const std::string& name) { _name = name; }
void setMqtt(const std::string& mqtt) { _mqtt = mqtt; }
void setName(const std::string& name) { _name = name; }
void setMqtt(const std::string& mqtt) { _mqtt = mqtt; }
void setSkipConstVal(const std::string& skipConstVal) {
if (skipConstVal == "on") {
_skipConstVal = true;
} else {
_skipConstVal = false;
}
}
const std::size_t getSizeOfReadingQueue() const { return _readingQueue->read_available(); }
std::size_t popReadingQueue(reading_t *reads, std::size_t max) const { return _readingQueue->pop(reads, max); }
......@@ -74,7 +84,9 @@ public:
}
virtual void storeReading(reading_t reading, unsigned cacheIndex) {
_readingQueue->push(reading);
if (!(_skipConstVal && (reading.value == _latestValue.value))) {
_readingQueue->push(reading);
}
_cache[cacheIndex] = reading;
_latestValue.value = reading.value;
_latestValue.timestamp = reading.timestamp;
......@@ -84,6 +96,7 @@ protected:
std::string _name;
std::string _mqtt;
bool _skipConstVal;
std::unique_ptr<reading_t[]> _cache;
reading_t _latestValue;
std::unique_ptr<boost::lockfree::spsc_queue<reading_t>> _readingQueue;
......
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