xref: /openbmc/telemetry/src/interfaces/report_factory.hpp (revision 493e62eb2f2ff6cbf3282b9cb98ebe6e520b88fc)
1 #pragma once
2 
3 #include "interfaces/json_storage.hpp"
4 #include "interfaces/metric.hpp"
5 #include "interfaces/report.hpp"
6 #include "interfaces/report_manager.hpp"
7 #include "types/readings.hpp"
8 #include "types/report_action.hpp"
9 #include "types/report_types.hpp"
10 #include "types/report_updates.hpp"
11 #include "types/reporting_type.hpp"
12 
13 #include <boost/asio/spawn.hpp>
14 
15 #include <chrono>
16 #include <memory>
17 #include <optional>
18 
19 namespace interfaces
20 {
21 
22 class ReportFactory
23 {
24   public:
25     virtual ~ReportFactory() = default;
26 
27     virtual std::vector<LabeledMetricParameters>
28         convertMetricParams(boost::asio::yield_context& yield,
29                             const ReadingParameters& metricParams) const = 0;
30     virtual std::vector<LabeledMetricParameters>
31         convertMetricParams(const ReadingParameters& metricParams) const = 0;
32 
33     virtual void
34         updateMetrics(std::vector<std::shared_ptr<interfaces::Metric>>& metrics,
35                       bool enabled,
36                       const ReadingParameters& metricParams) const = 0;
37 
38     virtual std::unique_ptr<interfaces::Report>
39         make(const std::string& id, const std::string& name,
40              const ReportingType reportingType,
41              const std::vector<ReportAction>& reportActions,
42              Milliseconds period, uint64_t appendLimit,
43              const ReportUpdates reportUpdates, ReportManager& reportManager,
44              JsonStorage& reportStorage,
45              std::vector<LabeledMetricParameters> labeledMetricParams,
46              bool enabled, Readings) const = 0;
47 };
48 
49 } // namespace interfaces
50