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

Method AffectsChildren

lib/icinga/checkable-dependency.cpp:203–220  ·  view source on GitHub ↗

* Checks whether the last check result of this Checkable affects its child dependencies. * * A Checkable affects its child dependencies if it runs into a non-OK state and results in any of its child * Checkables to become unreachable. Though, that unavailable dependency may not necessarily cause the child * Checkable to be in unreachable state as it might have some other dependencies that are

Source from the content-addressed store, hash-verified

201 * @return bool - Returns true if the Checkable affects its child dependencies, otherwise false.
202 */
203bool Checkable::AffectsChildren() const
204{
205 if (!GetLastCheckResult() || !IsReachable()) {
206 // If there is no check result, or the Checkable is not reachable, we can't safely determine whether
207 // the Checkable affects its child dependencies.
208 return false;
209 }
210
211 for (auto& dep : GetReverseDependencies()) {
212 if (!dep->IsAvailable(DependencyState)) {
213 // If one of the child dependency is not available, then it's definitely due to the
214 // current Checkable state, so we don't need to verify the remaining ones.
215 return true;
216 }
217 }
218
219 return false;
220}
221
222std::set<Checkable::Ptr> Checkable::GetParents() const
223{

Callers 1

SerializeStateMethod · 0.80

Calls 1

IsAvailableMethod · 0.80

Tested by

no test coverage detected