From 7571f74dbc53e9b4fe3b9000662ca686960db78e Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Mon, 23 Sep 2024 12:09:44 +0200 Subject: StorageUtils: Add generation-aware rehashing ID file map Such a file could be used to store mappings of digests from CAS or Git cache to digests of different hash type that represent same content. --- src/buildtool/crypto/hash_function.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/buildtool/crypto/hash_function.hpp') diff --git a/src/buildtool/crypto/hash_function.hpp b/src/buildtool/crypto/hash_function.hpp index 9e5a9c0b..530e0b2b 100644 --- a/src/buildtool/crypto/hash_function.hpp +++ b/src/buildtool/crypto/hash_function.hpp @@ -95,4 +95,15 @@ class HashFunction { -> std::optional>; }; +[[nodiscard]] constexpr auto ToString(HashFunction::Type type) noexcept -> const + char* { + switch (type) { + case HashFunction::Type::GitSHA1: + return "git-SHA1"; + case HashFunction::Type::PlainSHA256: + return "plain-SHA256"; + } + Ensures(false); // unreachable +} + #endif // INCLUDED_SRC_BUILDTOOL_CRYPTO_HASH_FUNCTION_HPP -- cgit v1.2.3