From 51f8b186803292f111011d04d5291deb374dc34c Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Thu, 6 Oct 2022 12:18:25 +0200 Subject: LocalTreeMap: Prevent tree objects from being stored ... to align with the original idea of caching a flat list of blob objects, without the need to recursively traverse any trees. Consequently, we cannot create any map entry in places where we do not have all sub-tree entries at hand (e.g., LocalAPI, BazelAPI, BazelResponse). --- src/buildtool/execution_api/remote/bazel/bazel_api.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/buildtool/execution_api/remote/bazel/bazel_api.cpp') diff --git a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp index a8846325..d1de9a68 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp @@ -24,9 +24,8 @@ BazelApi::BazelApi(std::string const& instance_name, std::string const& host, Port port, ExecutionConfiguration const& exec_config) noexcept { - tree_map_ = std::make_shared(); - network_ = std::make_shared( - instance_name, host, port, exec_config, tree_map_); + network_ = + std::make_shared(instance_name, host, port, exec_config); } // implement move constructor in cpp, where all members are complete types @@ -44,7 +43,6 @@ auto BazelApi::CreateAction( std::map const& properties) noexcept -> IExecutionAction::Ptr { return std::unique_ptr{new BazelAction{network_, - tree_map_, root_digest, command, output_files, @@ -227,11 +225,9 @@ auto BazelApi::CreateAction( std::vector const& artifacts) noexcept -> std::optional { BlobContainer blobs{}; - auto tree = tree_map_->CreateTree(); auto digest = BazelMsgFactory::CreateDirectoryDigestFromTree( artifacts, - [&blobs](BazelBlob&& blob) { blobs.Emplace(std::move(blob)); }, - [&tree](auto path, auto info) { return tree.AddInfo(path, info); }); + [&blobs](BazelBlob&& blob) { blobs.Emplace(std::move(blob)); }); if (not digest) { Logger::Log(LogLevel::Debug, "failed to create digest for tree."); return std::nullopt; @@ -248,10 +244,8 @@ auto BazelApi::CreateAction( Logger::Log(LogLevel::Debug, "failed to upload blobs for tree."); return std::nullopt; } - if (tree_map_->AddTree(*digest, std::move(tree))) { - return ArtifactDigest{*digest}; - } - return std::nullopt; + + return ArtifactDigest{*digest}; } [[nodiscard]] auto BazelApi::IsAvailable( -- cgit v1.2.3