Implement Report persistency
Now Report properties are stored in non-volatile memory. It allows
to restore Report after system restart. Persistency of a report is
controlled by Persistency property in Report interface.
Tested:
- Passed unit tests
- Verified that report is stored in /var/lib/telemetry dir
- Verified that report is restored from storage after telemetry
service start
Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
Change-Id: Iccfe21603eecffc4e174a4403f699b03de320db9
diff --git a/src/report_factory.cpp b/src/report_factory.cpp
index 27e4ee7..5ac32f3 100644
--- a/src/report_factory.cpp
+++ b/src/report_factory.cpp
@@ -1,24 +1,28 @@
#include "report_factory.hpp"
#include "report.hpp"
+#include "sensor.hpp"
+#include "utils/transform.hpp"
ReportFactory::ReportFactory(
- boost::asio::io_context& ioc,
+ std::shared_ptr<sdbusplus::asio::connection> bus,
const std::shared_ptr<sdbusplus::asio::object_server>& objServer) :
- ioc(ioc),
+ bus(std::move(bus)),
objServer(objServer)
{}
std::unique_ptr<interfaces::Report> ReportFactory::make(
+ std::optional<std::reference_wrapper<boost::asio::yield_context>> yield,
const std::string& name, const std::string& reportingType,
bool emitsReadingsSignal, bool logToMetricReportsCollection,
std::chrono::milliseconds period, const ReadingParameters& metricParams,
- interfaces::ReportManager& reportManager) const
+ interfaces::ReportManager& reportManager,
+ interfaces::JsonStorage& reportStorage) const
{
std::vector<std::shared_ptr<interfaces::Metric>> metrics;
return std::make_unique<Report>(
- ioc, objServer, name, reportingType, emitsReadingsSignal,
- logToMetricReportsCollection, period, metricParams, reportManager,
- std::move(metrics));
+ bus->get_io_context(), objServer, name, reportingType,
+ emitsReadingsSignal, logToMetricReportsCollection, period, metricParams,
+ reportManager, reportStorage, std::move(metrics));
}