From 90da9d81814d1717e424286b1d17ac6fbaf54a9a Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Tue, 18 Feb 2025 14:14:22 +0100 Subject: CommonApi: Remove GetMissingArtifactsInfo --- src/buildtool/execution_api/common/common_api.hpp | 42 ----------------------- 1 file changed, 42 deletions(-) (limited to 'src/buildtool/execution_api/common/common_api.hpp') diff --git a/src/buildtool/execution_api/common/common_api.hpp b/src/buildtool/execution_api/common/common_api.hpp index 05cb46fd..dfd16b1d 100644 --- a/src/buildtool/execution_api/common/common_api.hpp +++ b/src/buildtool/execution_api/common/common_api.hpp @@ -17,9 +17,7 @@ #include #include -#include #include -#include #include #include @@ -33,14 +31,6 @@ #include "src/buildtool/execution_api/common/execution_api.hpp" #include "src/buildtool/logging/logger.hpp" -/// \brief Stores a list of missing artifact digests, as well as a back-mapping -/// to some given original type. -template -struct MissingArtifactsInfo { - std::unordered_set digests; - std::unordered_map back_map; -}; - /// \brief Common logic for RetrieveToFds. /// \param dump_to_stream Dumps the artifact to the respective open stream. /// \param fallback Processes the respective file descriptor further in case the @@ -53,38 +43,6 @@ struct MissingArtifactsInfo { std::optional> const& fallback) noexcept -> bool; -/// \brief Get the missing artifacts from a given input list, needed, e.g., to -/// be uploaded. -/// \returns A struct storing the missing artifacts and a back-mapping to the -/// original given type, or nullopt in case of exceptions. -template - requires(std::is_same_v< - TValue, - typename std::iterator_traits::value_type>) -[[nodiscard]] auto GetMissingArtifactsInfo( - IExecutionApi const& api, - TIterator const& begin, - TIterator const& end, - typename std::function const& - converter) noexcept -> std::optional> { - std::unordered_set digests; - digests.reserve(std::distance(begin, end)); - MissingArtifactsInfo res{}; - for (auto it = begin; it != end; ++it) { - try { - auto const inserted = - res.back_map.insert({std::invoke(converter, *it), *it}); - if (inserted.second) { - digests.emplace(inserted.first->first); - } - } catch (...) { - return std::nullopt; - } - } - res.digests = api.GetMissingDigests(digests); - return res; -} - /// \brief Upload missing blobs from a given BlobTree. [[nodiscard]] auto CommonUploadBlobTree(BlobTreePtr const& blob_tree, IExecutionApi const& api) noexcept -- cgit v1.2.3