mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 14:44:32 +02:00
Introduce IcingaDB::AddKvsToMap()
This commit is contained in:
parent
ce994d8135
commit
f9155a2d5f
@ -230,18 +230,7 @@ void IcingaDB::UpdateAllConfigObjects()
|
|||||||
"HSCAN", configCheckSum, cursor, "COUNT", "1000"
|
"HSCAN", configCheckSum, cursor, "COUNT", "1000"
|
||||||
}, Prio::Config);
|
}, Prio::Config);
|
||||||
|
|
||||||
Array::Ptr kvs = res->Get(1);
|
AddKvsToMap(res->Get(1), redisCheckSums);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cursor = res->Get(0);
|
cursor = res->Get(0);
|
||||||
} while (cursor != "0");
|
} while (cursor != "0");
|
||||||
|
@ -45,6 +45,22 @@ public:
|
|||||||
|
|
||||||
String GetEnvironmentId() const override;
|
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:
|
protected:
|
||||||
void ValidateTlsProtocolmin(const Lazy<String>& lvalue, const ValidationUtils& utils) override;
|
void ValidateTlsProtocolmin(const Lazy<String>& lvalue, const ValidationUtils& utils) override;
|
||||||
void ValidateConnectTimeout(const Lazy<double>& lvalue, const ValidationUtils& utils) override;
|
void ValidateConnectTimeout(const Lazy<double>& lvalue, const ValidationUtils& utils) override;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user