Revert "created AddReportFutureVersion dbus method"
This reverts commit 753e4b3c843dd5d1068949c4106a6389f0e0ffbc.
Reason for revert: Breaks bmcweb, same approach is needed for changed properties
Change-Id: Id868159df916fcf0bdd7fc5062f8c51187fcc7e2
diff --git a/src/interfaces/metric.hpp b/src/interfaces/metric.hpp
index afca8a6..deb3ed6 100644
--- a/src/interfaces/metric.hpp
+++ b/src/interfaces/metric.hpp
@@ -1,7 +1,7 @@
#pragma once
+#include "interfaces/types.hpp"
#include "metric_value.hpp"
-#include "types/types.hpp"
#include <nlohmann/json.hpp>
diff --git a/src/interfaces/report_factory.hpp b/src/interfaces/report_factory.hpp
index ae07b84..237ae7b 100644
--- a/src/interfaces/report_factory.hpp
+++ b/src/interfaces/report_factory.hpp
@@ -3,7 +3,7 @@
#include "interfaces/json_storage.hpp"
#include "interfaces/report.hpp"
#include "interfaces/report_manager.hpp"
-#include "types/types.hpp"
+#include "interfaces/types.hpp"
#include <boost/asio/spawn.hpp>
diff --git a/src/interfaces/types.hpp b/src/interfaces/types.hpp
new file mode 100644
index 0000000..a5ed0db
--- /dev/null
+++ b/src/interfaces/types.hpp
@@ -0,0 +1,31 @@
+#pragma once
+
+#include "operation_type.hpp"
+#include "utils/labeled_tuple.hpp"
+#include "utils/tstring.hpp"
+
+#include <sdbusplus/message/types.hpp>
+
+#include <string>
+#include <tuple>
+#include <type_traits>
+#include <vector>
+
+using ReadingParameters =
+ std::vector<std::tuple<sdbusplus::message::object_path, std::string,
+ std::string, std::string>>;
+
+using LabeledSensorParameters =
+ utils::LabeledTuple<std::tuple<std::string, std::string>,
+ utils::tstring::Service, utils::tstring::Path>;
+
+using LabeledMetricParameters =
+ utils::LabeledTuple<std::tuple<LabeledSensorParameters, OperationType,
+ std::string, std::string>,
+ utils::tstring::SensorPath,
+ utils::tstring::OperationType, utils::tstring::Id,
+ utils::tstring::MetricMetadata>;
+
+using Readings = std::tuple<
+ uint64_t,
+ std::vector<std::tuple<std::string, std::string, double, uint64_t>>>;
diff --git a/src/metric.cpp b/src/metric.cpp
index c088e8a..2a73536 100644
--- a/src/metric.cpp
+++ b/src/metric.cpp
@@ -1,13 +1,13 @@
#include "metric.hpp"
-#include "types/types.hpp"
+#include "interfaces/types.hpp"
#include "utils/transform.hpp"
#include <algorithm>
Metric::Metric(std::shared_ptr<interfaces::Sensor> sensor,
OperationType operationType, std::string id,
- std::string metadata, CollectionTimeScope, CollectionDuration) :
+ std::string metadata) :
sensor(std::move(sensor)),
operationType(std::move(operationType)), reading{std::move(id),
std::move(metadata), 0.,
@@ -52,6 +52,5 @@
auto sensorPath =
LabeledSensorParameters(sensor->id().service, sensor->id().path);
return LabeledMetricParameters(std::move(sensorPath), operationType,
- reading.id, reading.metadata, timeScope,
- collectionDuration);
+ reading.id, reading.metadata);
}
diff --git a/src/metric.hpp b/src/metric.hpp
index 549603f..aab4d15 100644
--- a/src/metric.hpp
+++ b/src/metric.hpp
@@ -11,8 +11,7 @@
{
public:
Metric(std::shared_ptr<interfaces::Sensor> sensor,
- OperationType operationType, std::string id, std::string metadata,
- CollectionTimeScope, CollectionDuration);
+ OperationType operationType, std::string id, std::string metadata);
void initialize() override;
const MetricValue& getReading() const override;
@@ -26,6 +25,4 @@
std::shared_ptr<interfaces::Sensor> sensor;
OperationType operationType;
MetricValue reading;
- CollectionTimeScope timeScope;
- CollectionDuration collectionDuration;
};
diff --git a/src/types/operation_type.hpp b/src/operation_type.hpp
similarity index 100%
rename from src/types/operation_type.hpp
rename to src/operation_type.hpp
diff --git a/src/report.hpp b/src/report.hpp
index 6fe4e9e..97afe03 100644
--- a/src/report.hpp
+++ b/src/report.hpp
@@ -4,7 +4,7 @@
#include "interfaces/metric.hpp"
#include "interfaces/report.hpp"
#include "interfaces/report_manager.hpp"
-#include "types/types.hpp"
+#include "interfaces/types.hpp"
#include <boost/asio/io_context.hpp>
#include <boost/asio/steady_timer.hpp>
diff --git a/src/report_factory.cpp b/src/report_factory.cpp
index 0e598f3..9dfdbb0 100644
--- a/src/report_factory.cpp
+++ b/src/report_factory.cpp
@@ -43,8 +43,7 @@
-> std::shared_ptr<interfaces::Metric> {
return std::make_shared<Metric>(
getSensor(param.at_index<0>()), param.at_index<1>(),
- param.at_index<2>(), param.at_index<3>(), param.at_index<4>(),
- param.at_index<5>());
+ param.at_index<2>(), param.at_index<3>());
});
return std::make_unique<Report>(
@@ -70,8 +69,7 @@
auto tree = utils::getSubTreeSensors(yield, bus);
return utils::transform(metricParams, [&tree](const auto& item) {
- const auto& [sensorPath, operationType, id, metadata,
- collectionTimeScope, collectionDuration] = item;
+ const auto& [sensorPath, operationType, id, metadata] = item;
auto it = std::find_if(
tree.begin(), tree.end(),
@@ -82,10 +80,7 @@
const auto& [service, ifaces] = it->second.front();
return LabeledMetricParameters(
LabeledSensorParameters(service, sensorPath),
- utils::stringToOperationType(operationType), id, metadata,
- utils::stringToCollectionTimeScope(collectionTimeScope),
- CollectionDuration(
- std::chrono::milliseconds(collectionDuration)));
+ utils::stringToOperationType(operationType), id, metadata);
}
throw sdbusplus::exception::SdBusError(
diff --git a/src/report_manager.cpp b/src/report_manager.cpp
index 38b9f16..9ea6026 100644
--- a/src/report_manager.cpp
+++ b/src/report_manager.cpp
@@ -1,7 +1,7 @@
#include "report_manager.hpp"
+#include "interfaces/types.hpp"
#include "report.hpp"
-#include "types/types.hpp"
#include "utils/conversion.hpp"
#include "utils/transform.hpp"
@@ -11,19 +11,6 @@
#include <stdexcept>
#include <system_error>
-ReadingParameters
- convertToReadingParameters(ReadingParametersPastVersion params)
-{
- return utils::transform(params, [](const auto& param) {
- using namespace std::chrono_literals;
-
- return ReadingParameters::value_type(
- std::get<0>(param), std::get<1>(param), std::get<2>(param),
- std::get<3>(param), utils::enumToString(CollectionTimeScope::point),
- 0u);
- });
-}
-
ReportManager::ReportManager(
std::unique_ptr<interfaces::ReportFactory> reportFactoryIn,
std::unique_ptr<interfaces::JsonStorage> reportStorageIn,
@@ -51,25 +38,7 @@
const bool emitsReadingsUpdate,
const bool logToMetricReportsCollection,
const uint64_t interval,
- ReadingParametersPastVersion metricParams) {
- return addReport(yield, reportName, reportingType,
- emitsReadingsUpdate,
- logToMetricReportsCollection,
- std::chrono::milliseconds(interval),
- convertToReadingParameters(
- std::move(metricParams)))
- .getPath();
- });
-
- dbusIface.register_method(
- "AddReportFutureVersion",
- [this](boost::asio::yield_context& yield,
- const std::string& reportName,
- const std::string& reportingType,
- const bool emitsReadingsUpdate,
- const bool logToMetricReportsCollection,
- const uint64_t interval,
- ReadingParameters metricParams) {
+ ReadingParameters metricParams) {
return addReport(yield, reportName, reportingType,
emitsReadingsUpdate,
logToMetricReportsCollection,
@@ -175,8 +144,7 @@
sdbusplus::message::object_path(
param.at_index<0>().at_label<Path>()),
utils::enumToString(param.at_index<1>()), param.at_index<2>(),
- param.at_index<3>(), utils::enumToString(param.at_index<4>()),
- param.at_index<5>().t.count());
+ param.at_index<3>());
});
verifyAddReport(reportName, reportingType, interval, metricParams);
diff --git a/src/trigger.cpp b/src/trigger.cpp
index d6e51bc..471ad10 100644
--- a/src/trigger.cpp
+++ b/src/trigger.cpp
@@ -1,6 +1,6 @@
#include "trigger.hpp"
-#include "types/types.hpp"
+#include "interfaces/types.hpp"
Trigger::Trigger(
boost::asio::io_context& ioc,
diff --git a/src/types/collection_duration.hpp b/src/types/collection_duration.hpp
deleted file mode 100644
index dc70d4f..0000000
--- a/src/types/collection_duration.hpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma once
-
-#include <boost/serialization/strong_typedef.hpp>
-#include <nlohmann/json.hpp>
-
-#include <chrono>
-
-BOOST_STRONG_TYPEDEF(std::chrono::milliseconds, CollectionDuration)
-
-inline void to_json(nlohmann::json& json, const CollectionDuration& value)
-{
- json = value.t.count();
-}
-
-inline void from_json(const nlohmann::json& json, CollectionDuration& value)
-{
- value = CollectionDuration(std::chrono::milliseconds(json.get<uint64_t>()));
-}
diff --git a/src/types/collection_time_scope.hpp b/src/types/collection_time_scope.hpp
deleted file mode 100644
index d2694d2..0000000
--- a/src/types/collection_time_scope.hpp
+++ /dev/null
@@ -1,46 +0,0 @@
-#pragma once
-
-#include "utils/conversion.hpp"
-
-#include <array>
-#include <cstdint>
-#include <string_view>
-#include <type_traits>
-
-enum class CollectionTimeScope : uint32_t
-{
- point,
- interval,
- startup
-};
-
-namespace utils
-{
-
-constexpr std::array<std::pair<std::string_view, CollectionTimeScope>, 3>
- convDataCollectionTimeScope = {
- {std::make_pair<std::string_view, CollectionTimeScope>(
- "Point", CollectionTimeScope::point),
- std::make_pair<std::string_view, CollectionTimeScope>(
- "Interval", CollectionTimeScope::interval),
- std::make_pair<std::string_view, CollectionTimeScope>(
- "StartupInterval", CollectionTimeScope::startup)}};
-
-inline CollectionTimeScope
- toCollectionTimeScope(std::underlying_type_t<CollectionTimeScope> value)
-{
- return toEnum<CollectionTimeScope, CollectionTimeScope::point,
- CollectionTimeScope::startup>(value);
-}
-
-inline CollectionTimeScope stringToCollectionTimeScope(const std::string& value)
-{
- return stringToEnum(convDataCollectionTimeScope, value);
-}
-
-inline std::string enumToString(CollectionTimeScope value)
-{
- return std::string(enumToString(convDataCollectionTimeScope, value));
-}
-
-} // namespace utils
\ No newline at end of file
diff --git a/src/types/types.hpp b/src/types/types.hpp
deleted file mode 100644
index 93f3b27..0000000
--- a/src/types/types.hpp
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma once
-
-#include "types/collection_duration.hpp"
-#include "types/collection_time_scope.hpp"
-#include "types/operation_type.hpp"
-#include "utils/labeled_tuple.hpp"
-#include "utils/tstring.hpp"
-
-#include <sdbusplus/message/types.hpp>
-
-#include <chrono>
-#include <string>
-#include <tuple>
-#include <type_traits>
-#include <vector>
-
-using ReadingParametersPastVersion =
- std::vector<std::tuple<sdbusplus::message::object_path, std::string,
- std::string, std::string>>;
-
-using ReadingParameters =
- std::vector<std::tuple<sdbusplus::message::object_path, std::string,
- std::string, std::string, std::string, uint64_t>>;
-
-using LabeledSensorParameters =
- utils::LabeledTuple<std::tuple<std::string, std::string>,
- utils::tstring::Service, utils::tstring::Path>;
-
-using LabeledMetricParameters = utils::LabeledTuple<
- std::tuple<LabeledSensorParameters, OperationType, std::string, std::string,
- CollectionTimeScope, CollectionDuration>,
- utils::tstring::SensorPath, utils::tstring::OperationType,
- utils::tstring::Id, utils::tstring::MetricMetadata,
- utils::tstring::CollectionTimeScope, utils::tstring::CollectionDuration>;
-
-using Readings = std::tuple<
- uint64_t,
- std::vector<std::tuple<std::string, std::string, double, uint64_t>>>;
diff --git a/src/utils/labeled_tuple.hpp b/src/utils/labeled_tuple.hpp
index a224141..795f37f 100644
--- a/src/utils/labeled_tuple.hpp
+++ b/src/utils/labeled_tuple.hpp
@@ -170,15 +170,15 @@
};
template <class... Args, class... Labels>
-inline void to_json(nlohmann::json& json,
- const LabeledTuple<std::tuple<Args...>, Labels...>& tuple)
+void to_json(nlohmann::json& json,
+ const LabeledTuple<std::tuple<Args...>, Labels...>& tuple)
{
json = tuple.to_json();
}
template <class... Args, class... Labels>
-inline void from_json(const nlohmann::json& json,
- LabeledTuple<std::tuple<Args...>, Labels...>& tuple)
+void from_json(const nlohmann::json& json,
+ LabeledTuple<std::tuple<Args...>, Labels...>& tuple)
{
tuple.from_json(json);
}
diff --git a/src/utils/tstring.hpp b/src/utils/tstring.hpp
index 3e85ba5..a8d3e90 100644
--- a/src/utils/tstring.hpp
+++ b/src/utils/tstring.hpp
@@ -56,21 +56,5 @@
}
};
-struct CollectionTimeScope
-{
- static std::string str()
- {
- return "collectionTimeScope";
- }
-};
-
-struct CollectionDuration
-{
- static std::string str()
- {
- return "collectionDuration";
- }
-};
-
} // namespace tstring
} // namespace utils