diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-12-04 12:31:15 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-12-04 18:03:44 +0100 |
commit | f2c7776e00d6a0ed9f601fbfbf082cab0393d640 (patch) | |
tree | ffc286fb7eff4e00b434eabdc57f9608ed4e475d /src/buildtool/execution_api/utils/rehash_utils.cpp | |
parent | ee5dac3d832d4951fc0141aaf9b642e499d8189d (diff) | |
download | justbuild-f2c7776e00d6a0ed9f601fbfbf082cab0393d640.tar.gz |
rehash_utils: add a class for the rehash function
... to allow a more specific signature when passing around
the rehash function.
Diffstat (limited to 'src/buildtool/execution_api/utils/rehash_utils.cpp')
-rw-r--r-- | src/buildtool/execution_api/utils/rehash_utils.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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<Artifact::ObjectInfo> const& digests, /*from_git=*/true); } +auto Rehasher::Rehash(Artifact::ObjectInfo const& info) const + -> expected<Artifact::ObjectInfo, std::string> { + auto rehashed = RehashUtils::RehashDigest( + std::vector<Artifact::ObjectInfo>{info}, source_, target_, apis_); + if (not rehashed) { + return unexpected<std::string>(rehashed.error()); + } + return rehashed.value()[0]; +} + } // namespace RehashUtils |