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/local/local_api.hpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src/buildtool/execution_api/local/local_api.hpp') diff --git a/src/buildtool/execution_api/local/local_api.hpp b/src/buildtool/execution_api/local/local_api.hpp index 38b98601..13bcb7e3 100644 --- a/src/buildtool/execution_api/local/local_api.hpp +++ b/src/buildtool/execution_api/local/local_api.hpp @@ -10,7 +10,6 @@ #include "src/buildtool/compatibility/native_support.hpp" #include "src/buildtool/execution_api/bazel_msg/bazel_blob.hpp" #include "src/buildtool/execution_api/common/execution_api.hpp" -#include "src/buildtool/execution_api/common/local_tree_map.hpp" #include "src/buildtool/execution_api/local/local_action.hpp" #include "src/buildtool/execution_api/local/local_storage.hpp" @@ -26,7 +25,6 @@ class LocalApi final : public IExecutionApi { std::map const& properties) noexcept -> IExecutionAction::Ptr final { return IExecutionAction::Ptr{new LocalAction{storage_, - tree_map_, root_digest, command, output_files, @@ -202,11 +200,9 @@ class LocalApi final : public IExecutionApi { std::vector const& artifacts) noexcept -> std::optional final { 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; @@ -217,10 +213,7 @@ class LocalApi final : public IExecutionApi { return std::nullopt; } - if (tree_map_->AddTree(*digest, std::move(tree))) { - return ArtifactDigest{*digest}; - } - return std::nullopt; + return ArtifactDigest{*digest}; } [[nodiscard]] auto IsAvailable(ArtifactDigest const& digest) const noexcept @@ -247,9 +240,7 @@ class LocalApi final : public IExecutionApi { } private: - std::shared_ptr tree_map_{std::make_shared()}; - std::shared_ptr storage_{ - std::make_shared(tree_map_)}; + std::shared_ptr storage_{std::make_shared()}; }; #endif // INCLUDED_SRC_BUILDTOOL_EXECUTION_API_LOCAL_LOCAL_API_HPP -- cgit v1.2.3