summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_api/remote/bazel/bazel_response.cpp
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2022-10-06 12:18:25 +0200
committerOliver Reiche <oliver.reiche@huawei.com>2022-10-07 13:30:06 +0200
commit51f8b186803292f111011d04d5291deb374dc34c (patch)
tree818606bb46be19cc56618f1d56eb5e3f309f4fae /src/buildtool/execution_api/remote/bazel/bazel_response.cpp
parent64b8da270611ebb997c3801f09bd06878aee026a (diff)
downloadjustbuild-51f8b186803292f111011d04d5291deb374dc34c.tar.gz
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).
Diffstat (limited to 'src/buildtool/execution_api/remote/bazel/bazel_response.cpp')
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_response.cpp32
1 files changed, 11 insertions, 21 deletions
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp
index d05517a1..6ae2457e 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp
@@ -5,6 +5,17 @@
#include "src/buildtool/execution_api/remote/bazel/bazel_cas_client.hpp"
#include "src/buildtool/logging/logger.hpp"
+namespace {
+
+auto ProcessDirectoryMessage(bazel_re::Directory const& dir) noexcept
+ -> std::optional<BazelBlob> {
+ auto data = dir.SerializeAsString();
+ auto digest = ArtifactDigest::Create(data);
+ return BazelBlob{std::move(digest), std::move(data)};
+}
+
+} // namespace
+
auto BazelResponse::ReadStringBlob(bazel_re::Digest const& id) noexcept
-> std::string {
auto blobs = network_->ReadBlobs({id}).Next();
@@ -120,24 +131,3 @@ auto BazelResponse::UploadTreeMessageDirectories(
}
return ArtifactDigest{root_digest};
}
-
-auto BazelResponse::ProcessDirectoryMessage(
- bazel_re::Directory const& dir) const noexcept -> std::optional<BazelBlob> {
- auto data = dir.SerializeAsString();
- auto digest = ArtifactDigest::Create(data);
-
- if (tree_map_ and not tree_map_->HasTree(digest)) {
- // cache in local tree map
- auto tree = tree_map_->CreateTree();
- if (not BazelMsgFactory::ReadObjectInfosFromDirectory(
- dir,
- [&tree](auto path, auto info) {
- return tree.AddInfo(path, info);
- }) or
- not tree_map_->AddTree(digest, std::move(tree))) {
- return std::nullopt;
- }
- }
-
- return BazelBlob{std::move(digest), std::move(data)};
-}