39class DirectoryVolume final :
public Volume {
53 static std::expected<std::unique_ptr<DirectoryVolume>,
Error>
54 create(
const std::filesystem::path &root,
55 std::optional<std::vector<std::uint8_t>> systemArea,
56 std::vector<Replacement> replacements);
65 static std::expected<std::string, Error>
identify(
const std::filesystem::path &root);
68 std::expected<LocatedFile, Error>
find(
const std::string &name)
override;
71 std::span<std::uint8_t, kSectorData> sector)
override;
78 std::uint32_t lba = 0;
80 std::filesystem::path path;
81 std::uint32_t size = 0;
82 const std::vector<std::uint8_t> *payload =
nullptr;
86 bool isDirectory =
false;
88 std::filesystem::path path;
89 std::size_t index = 0;
92 DirectoryVolume() =
default;
94 std::expected<void, Error> build(
const std::filesystem::path &root);
95 std::expected<void, Error> applyReplacements();
96 static std::expected<std::string, Error> isoName(
const std::filesystem::path &entry);
97 static std::uint32_t extentSize(
const std::vector<ListingEntry> &listing);
98 static std::vector<std::uint8_t>
99 record(std::string_view identifier,
const Entry &entry,
bool isDirectory);
100 void writeDescriptors(std::uint32_t pathTable, std::uint32_t tableSectors,
Seconds newest);
101 void writePathTables(std::uint32_t tableSectors);
102 void writeDirectory(std::size_t directory);
104 std::vector<std::uint8_t> systemArea_;
105 std::vector<Replacement> replacements_;
106 std::vector<Entry> directories_;
107 std::vector<std::size_t> parents_;
108 std::vector<std::vector<ListingEntry>> listings_;
109 std::vector<Entry> files_;
110 std::map<std::string, std::size_t> parentOf_;
111 std::vector<std::uint32_t> fileStarts_;
112 std::map<std::uint32_t, Sector> metadata_;
113 std::map<std::filesystem::path, std::ifstream> handles_;
114 std::uint32_t volumeSectors_ = 0;