2021-01-23 15:13:08 +01:00
|
|
|
#ifndef GEMINISERVER_CACHE_FILES_HPP
|
|
|
|
#define GEMINISERVER_CACHE_FILES_HPP
|
|
|
|
|
2021-02-21 19:02:32 +01:00
|
|
|
#include <string>
|
|
|
|
#include <unordered_set>
|
|
|
|
#include <unordered_map>
|
|
|
|
#include <filesystem>
|
2021-01-23 15:13:08 +01:00
|
|
|
|
|
|
|
namespace gemini {
|
2021-02-21 19:02:32 +01:00
|
|
|
struct Information;
|
|
|
|
|
2021-01-23 15:13:08 +01:00
|
|
|
/**
|
|
|
|
* \brief This class is used to store the files in cache.
|
|
|
|
*/
|
2021-02-21 19:02:32 +01:00
|
|
|
class CacheFiles final {
|
|
|
|
private:
|
|
|
|
std::unordered_set<std::string> files;
|
|
|
|
std::unordered_map<std::string, std::string> content;
|
|
|
|
|
|
|
|
public:
|
|
|
|
const Information &information;
|
|
|
|
|
|
|
|
CacheFiles() = delete;
|
|
|
|
|
|
|
|
CacheFiles(const std::filesystem::path &folder, const Information &infos);
|
|
|
|
|
|
|
|
~CacheFiles() noexcept = default;
|
|
|
|
|
|
|
|
[[nodiscard, gnu::always_inline]] inline const std::unordered_set<std::string> &get_files() const {
|
|
|
|
return files;
|
|
|
|
}
|
2021-01-23 15:13:08 +01:00
|
|
|
|
2021-02-21 19:02:32 +01:00
|
|
|
[[nodiscard, gnu::always_inline]] inline const std::unordered_map<std::string, std::string> &get_content() const {
|
|
|
|
return content;
|
|
|
|
}
|
2021-01-23 15:13:08 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif //GEMINISERVER_CACHE_FILES_HPP
|