#pragma once #include "interfaces/json_storage.hpp" class PersistentJsonStorage : public interfaces::JsonStorage { public: explicit PersistentJsonStorage(const DirectoryPath& directory); void store(const FilePath& subPath, const nlohmann::json& data) override; bool remove(const FilePath& subPath) override; bool exist(const FilePath& path) const override; std::optional load(const FilePath& subPath) const override; std::vector list() const override; private: DirectoryPath directory; static std::filesystem::path join(const std::filesystem::path&, const std::filesystem::path&); static void limitPermissions(const std::filesystem::path& path); static void assertThatPathIsNotSymlink(const std::filesystem::path& path); };