mirror of https://github.com/Icinga/icinga2.git
Introduce IcingaDB::AddKvsToMap()
This commit is contained in:
parent
2c3d2f8b87
commit
8eef51afeb
|
@ -230,18 +230,7 @@ void IcingaDB::UpdateAllConfigObjects()
|
|||
"HSCAN", configCheckSum, cursor, "COUNT", "1000"
|
||||
}, Prio::Config);
|
||||
|
||||
Array::Ptr kvs = res->Get(1);
|
||||
Value* key = nullptr;
|
||||
ObjectLock oLock (kvs);
|
||||
|
||||
for (auto& kv : kvs) {
|
||||
if (key) {
|
||||
redisCheckSums.emplace(std::move(*key), std::move(kv));
|
||||
key = nullptr;
|
||||
} else {
|
||||
key = &kv;
|
||||
}
|
||||
}
|
||||
AddKvsToMap(res->Get(1), redisCheckSums);
|
||||
|
||||
cursor = res->Get(0);
|
||||
} while (cursor != "0");
|
||||
|
|
|
@ -45,6 +45,22 @@ public:
|
|||
|
||||
String GetEnvironmentId() const override;
|
||||
|
||||
template<class T>
|
||||
static void AddKvsToMap(const Array::Ptr& kvs, T& map)
|
||||
{
|
||||
Value* key = nullptr;
|
||||
ObjectLock oLock (kvs);
|
||||
|
||||
for (auto& kv : kvs) {
|
||||
if (key) {
|
||||
map.emplace(std::move(*key), std::move(kv));
|
||||
key = nullptr;
|
||||
} else {
|
||||
key = &kv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
void ValidateTlsProtocolmin(const Lazy<String>& lvalue, const ValidationUtils& utils) override;
|
||||
void ValidateConnectTimeout(const Lazy<double>& lvalue, const ValidationUtils& utils) override;
|
||||
|
|
Loading…
Reference in New Issue