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/interfaces/report_factory.hpp b/src/interfaces/report_factory.hpp
index 9273d03..056c9e0 100644
--- a/src/interfaces/report_factory.hpp
+++ b/src/interfaces/report_factory.hpp
@@ -1,13 +1,15 @@
#pragma once
+#include "interfaces/json_storage.hpp"
#include "interfaces/report.hpp"
#include "interfaces/report_manager.hpp"
#include "interfaces/types.hpp"
+#include <boost/asio/spawn.hpp>
+
#include <chrono>
#include <memory>
-
-class ReportManager;
+#include <optional>
namespace interfaces
{
@@ -17,12 +19,12 @@
public:
virtual ~ReportFactory() = default;
- virtual std::unique_ptr<interfaces::Report>
- make(const std::string& name, const std::string& reportingType,
- bool emitsReadingsSignal, bool logToMetricReportsCollection,
- std::chrono::milliseconds period,
- const ReadingParameters& metricParams,
- ReportManager& reportManager) const = 0;
+ virtual std::unique_ptr<interfaces::Report> 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,
+ ReportManager& reportManager, JsonStorage& reportStorage) const = 0;
};
} // namespace interfaces