diff options
Diffstat (limited to 'src/buildtool/execution_api')
3 files changed, 2 insertions, 64 deletions
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp index fe6ad757..f15d421d 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp @@ -191,11 +191,8 @@ auto BazelApi::CreateAction( else { if (IsTreeObject(info.type)) { // read object infos from sub tree and call retrieve recursively - auto request_remote_tree = alternative != nullptr - ? std::make_optional(info.digest) - : std::nullopt; - auto reader = TreeReader<BazelNetworkReader>{ - network_->CreateReader(), std::move(request_remote_tree)}; + auto reader = + TreeReader<BazelNetworkReader>{network_->CreateReader()}; auto const result = reader.RecursivelyReadTreeLeafs( info.digest, output_paths[i]); if (not result or diff --git a/src/buildtool/execution_api/remote/bazel/bazel_network_reader.cpp b/src/buildtool/execution_api/remote/bazel/bazel_network_reader.cpp index 6f125d67..4580cf22 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_network_reader.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_network_reader.cpp @@ -21,11 +21,8 @@ #include <unordered_set> #include <utility> -#include "src/buildtool/common/artifact_digest_factory.hpp" #include "src/buildtool/common/protocol_traits.hpp" #include "src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp" -#include "src/buildtool/execution_api/common/message_limits.hpp" -#include "src/buildtool/file_system/object_type.hpp" #include "src/buildtool/logging/log_level.hpp" #include "src/buildtool/logging/logger.hpp" #include "src/utils/cpp/back_map.hpp" @@ -40,32 +37,8 @@ BazelNetworkReader::BazelNetworkReader( cas_{*cas}, hash_function_{hash_function} {} -BazelNetworkReader::BazelNetworkReader( - BazelNetworkReader&& other, - std::optional<ArtifactDigest> request_remote_tree) noexcept - : instance_name_{other.instance_name_}, - cas_{other.cas_}, - hash_function_{other.hash_function_} { - if (not IsNativeProtocol() and request_remote_tree) { - // Query full tree from remote CAS. Note that this is currently not - // supported by Buildbarn revision c3c06bbe2a. - auto full_tree = - cas_.GetTree(instance_name_, - ArtifactDigestFactory::ToBazel(*request_remote_tree), - MessageLimits::kMaxGrpcLength); - auxiliary_map_ = MakeAuxiliaryMap(std::move(full_tree)); - } -} - auto BazelNetworkReader::ReadDirectory(ArtifactDigest const& digest) const noexcept -> std::optional<bazel_re::Directory> { - if (auxiliary_map_) { - auto it = auxiliary_map_->find(digest); - if (it != auxiliary_map_->end()) { - return it->second; - } - } - if (auto blob = ReadSingleBlob(digest)) { if (auto const content = blob->ReadContent()) { return BazelMsgFactory::MessageFromString<bazel_re::Directory>( @@ -152,25 +125,6 @@ auto BazelNetworkReader::IsNativeProtocol() const noexcept -> bool { return ProtocolTraits::IsNative(hash_function_.GetType()); } -auto BazelNetworkReader::MakeAuxiliaryMap( - std::vector<bazel_re::Directory>&& full_tree) const noexcept - -> std::optional<DirectoryMap> { - ExpectsAudit(not IsNativeProtocol()); - - DirectoryMap result; - result.reserve(full_tree.size()); - for (auto& dir : full_tree) { - try { - result.emplace(ArtifactDigestFactory::HashDataAs<ObjectType::File>( - hash_function_, dir.SerializeAsString()), - std::move(dir)); - } catch (...) { - return std::nullopt; - } - } - return result; -} - auto BazelNetworkReader::ReadSingleBlob(ArtifactDigest const& digest) const noexcept -> std::optional<ArtifactBlob> { return cas_.ReadSingleBlob(instance_name_, digest); diff --git a/src/buildtool/execution_api/remote/bazel/bazel_network_reader.hpp b/src/buildtool/execution_api/remote/bazel/bazel_network_reader.hpp index f7915446..fb138844 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_network_reader.hpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_network_reader.hpp @@ -19,7 +19,6 @@ #include <functional> #include <optional> #include <string> -#include <unordered_map> #include <unordered_set> #include <vector> @@ -42,10 +41,6 @@ class BazelNetworkReader final { gsl::not_null<BazelCasClient const*> const& cas, HashFunction hash_function) noexcept; - BazelNetworkReader( - BazelNetworkReader&& other, - std::optional<ArtifactDigest> request_remote_tree) noexcept; - [[nodiscard]] auto ReadDirectory(ArtifactDigest const& digest) const noexcept -> std::optional<bazel_re::Directory>; @@ -79,17 +74,9 @@ class BazelNetworkReader final { const noexcept -> std::vector<ArtifactBlob>; private: - using DirectoryMap = - std::unordered_map<ArtifactDigest, bazel_re::Directory>; - std::string const instance_name_; BazelCasClient const& cas_; HashFunction hash_function_; - std::optional<DirectoryMap> auxiliary_map_; - - [[nodiscard]] auto MakeAuxiliaryMap( - std::vector<bazel_re::Directory>&& full_tree) const noexcept - -> std::optional<DirectoryMap>; }; #endif // INCLUDED_SRC_BUILDTOOL_EXECUTION_API_REMOTE_BAZEL_BAZEL_TREE_READER_HPP |