From f2c7776e00d6a0ed9f601fbfbf082cab0393d640 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Wed, 4 Dec 2024 12:31:15 +0100 Subject: rehash_utils: add a class for the rehash function ... to allow a more specific signature when passing around the rehash function. --- src/buildtool/execution_api/utils/rehash_utils.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/buildtool/execution_api/utils/rehash_utils.cpp') diff --git a/src/buildtool/execution_api/utils/rehash_utils.cpp b/src/buildtool/execution_api/utils/rehash_utils.cpp index 43a6e682..ec4edf99 100644 --- a/src/buildtool/execution_api/utils/rehash_utils.cpp +++ b/src/buildtool/execution_api/utils/rehash_utils.cpp @@ -297,4 +297,14 @@ auto RehashGitDigest(std::vector const& digests, /*from_git=*/true); } +auto Rehasher::Rehash(Artifact::ObjectInfo const& info) const + -> expected { + auto rehashed = RehashUtils::RehashDigest( + std::vector{info}, source_, target_, apis_); + if (not rehashed) { + return unexpected(rehashed.error()); + } + return rehashed.value()[0]; +} + } // namespace RehashUtils -- cgit v1.2.3