MCPcopy Create free account
hub / github.com/Icinga/icinga2 / SendCustomVarsChanged

Method SendCustomVarsChanged

lib/icingadb/icingadb-objects.cpp:2778–2796  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2776}
2777
2778void IcingaDB::SendCustomVarsChanged(const ConfigObject::Ptr& object, const Dictionary::Ptr& oldValues, const Dictionary::Ptr& newValues) {
2779 const auto& type = object->GetReflectionType();
2780 std::string_view customvarKey = GetRedisCustomVarKey(type);
2781 if (customvarKey.empty()) {
2782 return;
2783 }
2784
2785 if (!m_RconWorker || !m_RconWorker->IsConnected() || oldValues == newValues) {
2786 return;
2787 }
2788
2789 Dictionary::Ptr oldVars = SerializeVars(oldValues);
2790 Dictionary::Ptr newVars = SerializeVars(newValues);
2791
2792 for (const auto& varId : GetDictionaryDeletedKeys(oldVars, newVars)) {
2793 String id = HashValue(new Array({m_EnvironmentId, varId, object->GetName()}));
2794 EnqueueRelationsDeletion(id, {{customvarKey, ""}});
2795 }
2796}
2797
2798Dictionary::Ptr IcingaDB::SerializeState(const Checkable::Ptr& checkable)
2799{

Callers 1

Calls 5

GetRedisCustomVarKeyFunction · 0.85
IsConnectedMethod · 0.80
GetReflectionTypeMethod · 0.45
emptyMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected