diff options
Diffstat (limited to 'src/other_tools/ops_maps/content_cas_map.hpp')
-rw-r--r-- | src/other_tools/ops_maps/content_cas_map.hpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/other_tools/ops_maps/content_cas_map.hpp b/src/other_tools/ops_maps/content_cas_map.hpp index d9462c68..d6ad0088 100644 --- a/src/other_tools/ops_maps/content_cas_map.hpp +++ b/src/other_tools/ops_maps/content_cas_map.hpp @@ -61,6 +61,18 @@ struct ArchiveRepoInfo { } }; +struct ForeignFileInfo { + ArchiveContent archive{}; /* key */ + std::string name{}; /* key */ + bool executable{}; /* key */ + bool absent{}; /* key */ + + [[nodiscard]] auto operator==(const ForeignFileInfo& other) const -> bool { + return archive == other.archive and name == other.name and + executable == other.executable and absent == other.absent; + } +}; + /// \brief Maps the content hash of an archive to nullptr, as we only care if /// the map fails or not. using ContentCASMap = AsyncMapConsumer<ArchiveContent, std::nullptr_t>; @@ -98,6 +110,19 @@ struct hash<ArchiveRepoInfo> { return seed; } }; + +template <> +struct hash<ForeignFileInfo> { + [[nodiscard]] auto operator()(const ForeignFileInfo& ct) const noexcept + -> std::size_t { + size_t seed{}; + hash_combine<ArchiveContent>(&seed, ct.archive); + hash_combine<std::string>(&seed, ct.name); + hash_combine<bool>(&seed, ct.executable); + hash_combine<bool>(&seed, ct.absent); + return seed; + } +}; } // namespace std #endif // INCLUDED_SRC_OTHER_TOOLS_OPS_MAPS_CONTENT_CAS_MAP_HPP |