userver: userver/fs/file_info_with_data.hpp Source File
Loading...
Searching...
No Matches
file_info_with_data.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/fs/file_info_with_data.hpp
4/// @brief data structures to store file info with load data
5
6#include <filesystem>
7#include <memory>
8#include <string>
9#include <unordered_map>
10#include <variant>
11
12USERVER_NAMESPACE_BEGIN
13
14/// @brief filesystem support
15namespace fs {
16
17/// @brief Struct file with load data
18///
19/// `data_or_path` holds either file contents (`std::string`) or a full path to the file
20/// (`std::filesystem::path`) when the file is too large to cache in memory.
22 std::variant<std::string, std::filesystem::path> data_or_path;
23 std::string extension;
24};
25
26using FileInfoWithDataConstPtr = std::shared_ptr<const FileInfoWithData>;
27using FileInfoWithDataMap = std::unordered_map<std::string, FileInfoWithDataConstPtr>;
28
29} // namespace fs
30
31USERVER_NAMESPACE_END