Added PersistentJsonStorageClass
PersistentJsonStorage is used to store persistent information in
json format. This class will be used by ReportManager to save
persistent report configuration.
Tested:
- Added unit tests for new functionality
- All other unit tests are passing
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
Change-Id: Ib496e6782e849d910fe37c02c355047afda5c79c
diff --git a/src/interfaces/json_storage.hpp b/src/interfaces/json_storage.hpp
new file mode 100644
index 0000000..badd938
--- /dev/null
+++ b/src/interfaces/json_storage.hpp
@@ -0,0 +1,29 @@
+#pragma once
+
+#include <boost/serialization/strong_typedef.hpp>
+#include <nlohmann/json.hpp>
+
+#include <filesystem>
+#include <optional>
+#include <string>
+
+namespace interfaces
+{
+
+class JsonStorage
+{
+ public:
+ BOOST_STRONG_TYPEDEF(std::filesystem::path, FilePath)
+ BOOST_STRONG_TYPEDEF(std::filesystem::path, DirectoryPath)
+
+ virtual ~JsonStorage() = default;
+
+ virtual void store(const FilePath& subPath, const nlohmann::json& data) = 0;
+ virtual bool remove(const FilePath& subPath) = 0;
+ virtual std::optional<nlohmann::json>
+ load(const FilePath& subPath) const = 0;
+ virtual std::vector<FilePath>
+ list(const DirectoryPath& subDirectory) const = 0;
+};
+
+} // namespace interfaces