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

Method Unregister

lib/icinga/dependency-group.cpp:46–64  ·  view source on GitHub ↗

* Detach the provided child Checkable from the specified dependency group. * * Unregisters all the dependency objects the child Checkable depends on from the provided dependency group and * removes the dependency group from the global registry if it becomes empty afterward. * * @param dependencyGroup The dependency group to unregister the child Checkable from. * @param child The child Checka

Source from the content-addressed store, hash-verified

44 * and a boolean indicating whether the dependency group has been erased from the global registry.
45 */
46std::pair<std::set<Dependency::Ptr>, bool> DependencyGroup::Unregister(const DependencyGroup::Ptr& dependencyGroup, const Checkable::Ptr& child)
47{
48 std::lock_guard lock(m_RegistryMutex);
49 if (auto it(m_Registry.find(dependencyGroup)); it != m_Registry.end()) {
50 auto& existingGroup(*it);
51 auto dependencies(existingGroup->GetDependenciesForChild(child.get()));
52
53 for (const auto& dependency : dependencies) {
54 existingGroup->RemoveDependency(dependency);
55 }
56
57 bool remove = !existingGroup->HasChildren();
58 if (remove) {
59 m_Registry.erase(it);
60 }
61 return {{dependencies.begin(), dependencies.end()}, remove};
62 }
63 return {{}, false};
64}
65
66/**
67 * Retrieve the size of the global dependency group registry.

Callers

nothing calls this directly

Calls 8

findMethod · 0.80
HasChildrenMethod · 0.80
endMethod · 0.45
getMethod · 0.45
RemoveDependencyMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected