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

Method VersionChangedHandler

lib/icingadb/icingadb-objects.cpp:2945–2965  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2943}
2944
2945void IcingaDB::VersionChangedHandler(const ConfigObject::Ptr& object)
2946{
2947 Type::Ptr type = object->GetReflectionType();
2948 auto it = std::find_if(std::begin(l_SyncableTypes), std::end(l_SyncableTypes), [&type](const auto& pair) {
2949 return pair.first == type;
2950 });
2951 if (it == std::end(l_SyncableTypes)) {
2952 return;
2953 }
2954
2955 if (object->IsActive()) {
2956 for (const IcingaDB::Ptr& rw : ConfigType::GetObjectsByType<IcingaDB>()) {
2957 // A runtime config change triggers also a full state update as well as next update event.
2958 rw->EnqueueConfigObject(object, icingadb::task_queue::ConfigUpdate | icingadb::task_queue::FullState | icingadb::task_queue::NextUpdate);
2959 }
2960 } else if (!object->IsActive() && object->GetExtension("ConfigObjectDeleted")) { // same as in apilistener-configsync.cpp
2961 for (const IcingaDB::Ptr& rw : ConfigType::GetObjectsByType<IcingaDB>()) {
2962 rw->SendConfigDelete(object);
2963 }
2964 }
2965}
2966
2967void IcingaDB::DowntimeStartedHandler(const Downtime::Ptr& downtime)
2968{

Callers

nothing calls this directly

Calls 7

beginFunction · 0.85
endFunction · 0.85
IsActiveMethod · 0.80
EnqueueConfigObjectMethod · 0.80
GetExtensionMethod · 0.80
SendConfigDeleteMethod · 0.80
GetReflectionTypeMethod · 0.45

Tested by

no test coverage detected