control: Don't cache non-group properties
The code was previously adding every single D-Bus
path/interface/property of a service when Manager::addObjects() was
being used to cache D-Bus property values. This was resulting in a lot
of extra items in the cache that fan control would never use.
To fix this, create a single static set of all of the D-Bus paths from
all of the Group objects, which would be the master list of all the
D-Bus paths fan control would ever care about. Then, only add a
path/interface/property to the cache if that path is in that set.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I787c9c36b88d003fe9fe7ac1d517fbb5aa510e4e
diff --git a/control/json/group.hpp b/control/json/group.hpp
index dd5c6a0..4057914 100644
--- a/control/json/group.hpp
+++ b/control/json/group.hpp
@@ -19,6 +19,8 @@
#include <nlohmann/json.hpp>
+#include <set>
+
namespace phosphor::fan::control::json
{
@@ -150,6 +152,14 @@
return _value;
}
+ /**
+ * @brief Get the set of all configured group members
+ */
+ static const std::set<std::string>& getAllMembers()
+ {
+ return _allMembers;
+ }
+
private:
/* Members of the group */
std::vector<std::string> _members;
@@ -169,6 +179,9 @@
/* Optional property value for all the members */
std::optional<PropertyVariantType> _value;
+ /* Single set of all group members across all groups */
+ static std::set<std::string> _allMembers;
+
/**
* @brief Parse and set the members list
*