29class DirectoryVolume final :
public Volume {
39 static std::expected<std::unique_ptr<DirectoryVolume>,
Error>
40 create(
const std::filesystem::path &root, std::optional<std::vector<std::uint8_t>> systemArea);
49 static std::expected<std::string, Error>
identify(
const std::filesystem::path &root);
52 std::expected<LocatedFile, Error>
find(
const std::string &name)
override;
55 std::span<std::uint8_t, kSectorData> sector)
override;
62 std::uint32_t lba = 0;
64 std::filesystem::path path;
65 std::uint32_t size = 0;
69 bool isDirectory =
false;
71 std::filesystem::path path;
72 std::size_t index = 0;
75 DirectoryVolume() =
default;
77 std::expected<void, Error> build(
const std::filesystem::path &root);
78 static std::expected<std::string, Error> isoName(
const std::filesystem::path &entry);
79 static std::uint32_t extentSize(
const std::vector<ListingEntry> &listing);
80 static std::vector<std::uint8_t>
81 record(std::string_view identifier,
const Entry &entry,
bool isDirectory);
82 void writeDescriptors(std::uint32_t pathTable, std::uint32_t tableSectors,
Seconds newest);
83 void writePathTables(std::uint32_t tableSectors);
84 void writeDirectory(std::size_t directory);
86 std::vector<std::uint8_t> systemArea_;
87 std::vector<Entry> directories_;
88 std::vector<std::size_t> parents_;
89 std::vector<std::vector<ListingEntry>> listings_;
90 std::vector<Entry> files_;
91 std::map<std::string, std::size_t> parentOf_;
92 std::vector<std::uint32_t> fileStarts_;
93 std::map<std::uint32_t, Sector> metadata_;
94 std::map<std::filesystem::path, std::ifstream> handles_;
95 std::uint32_t volumeSectors_ = 0;