Removed dependency to TriggerManager
introduces Messanger class which allows to send messages directly to
subscribed targets, which allows to break dependencies between classes.
Testes:
- All unit tests are passing
- Links are correctly updated
- Report is correctly updated by Trigger Action
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
Change-Id: I32d3aaba22f9ec07e611f53fe553bd27e1c04c6d
diff --git a/src/report.hpp b/src/report.hpp
index 3e649fd..5ac6fd0 100644
--- a/src/report.hpp
+++ b/src/report.hpp
@@ -10,6 +10,7 @@
#include "types/report_updates.hpp"
#include "types/reporting_type.hpp"
#include "utils/circular_vector.hpp"
+#include "utils/messanger.hpp"
#include <boost/asio/io_context.hpp>
#include <boost/asio/steady_timer.hpp>
@@ -31,8 +32,7 @@
interfaces::ReportManager& reportManager,
interfaces::JsonStorage& reportStorage,
std::vector<std::shared_ptr<interfaces::Metric>> metrics,
- const bool enabled, std::unique_ptr<interfaces::Clock> clock,
- const std::vector<std::string>& triggerIds);
+ const bool enabled, std::unique_ptr<interfaces::Clock> clock);
Report(const Report&) = delete;
Report(Report&&) = delete;
@@ -49,11 +49,6 @@
return reportDir + id;
}
- void updateReadings() override;
- void updateTriggerIds(const std::string& triggerId,
- TriggerIdUpdate updateType) override;
- bool storeConfiguration() const;
-
private:
std::unique_ptr<sdbusplus::asio::dbus_interface> makeReportInterface();
static void timerProc(boost::system::error_code, Report& self);
@@ -66,6 +61,10 @@
static uint64_t getSensorCount(
std::vector<std::shared_ptr<interfaces::Metric>>& metrics);
interfaces::JsonStorage::FilePath fileName() const;
+ std::unordered_set<std::string>
+ collectTriggerIds(boost::asio::io_context& ioc) const;
+ bool storeConfiguration() const;
+ void updateReadings();
std::string id;
std::string name;
@@ -90,6 +89,7 @@
interfaces::JsonStorage& reportStorage;
bool enabled;
std::unique_ptr<interfaces::Clock> clock;
+ utils::Messanger messanger;
public:
static constexpr const char* reportIfaceName =