summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_api/remote/bazel/bazel_response.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/execution_api/remote/bazel/bazel_response.cpp')
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_response.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp
index 81f8310d..e4bc9248 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp
@@ -26,11 +26,10 @@
#include "src/buildtool/common/artifact.hpp"
#include "src/buildtool/common/artifact_digest.hpp"
#include "src/buildtool/common/artifact_digest_factory.hpp"
-#include "src/buildtool/common/bazel_digest_factory.hpp"
#include "src/buildtool/common/protocol_traits.hpp"
#include "src/buildtool/crypto/hash_function.hpp"
-#include "src/buildtool/execution_api/bazel_msg/bazel_blob_container.hpp"
#include "src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp"
+#include "src/buildtool/execution_api/common/artifact_blob_container.hpp"
#include "src/buildtool/execution_api/common/common_api.hpp"
#include "src/buildtool/execution_api/common/content_blob_container.hpp"
#include "src/buildtool/execution_api/remote/bazel/bazel_network_reader.hpp"
@@ -44,7 +43,7 @@ namespace {
auto ProcessDirectoryMessage(HashFunction hash_function,
bazel_re::Directory const& dir) noexcept
- -> expected<BazelBlob, std::string> {
+ -> expected<ArtifactBlob, std::string> {
// in compatible mode: check validity of all symlinks
for (auto const& link : dir.symlinks()) {
if (not PathIsNonUpwards(link.target())) {
@@ -53,11 +52,11 @@ auto ProcessDirectoryMessage(HashFunction hash_function,
}
}
auto data = dir.SerializeAsString();
- auto digest =
- BazelDigestFactory::HashDataAs<ObjectType::File>(hash_function, data);
- return BazelBlob{std::move(digest),
- std::move(data),
- /*is_exec=*/false};
+ auto digest = ArtifactDigestFactory::HashDataAs<ObjectType::File>(
+ hash_function, data);
+ return ArtifactBlob{std::move(digest),
+ std::move(data),
+ /*is_exec=*/false};
}
} // namespace
@@ -282,11 +281,12 @@ auto BazelResponse::Populate() noexcept -> std::optional<std::string> {
auto BazelResponse::UploadTreeMessageDirectories(
bazel_re::Tree const& tree) const -> expected<ArtifactDigest, std::string> {
auto const upload_callback =
- [&network = *network_](std::unordered_set<BazelBlob>&& blobs) -> bool {
+ [&network =
+ *network_](std::unordered_set<ArtifactBlob>&& blobs) -> bool {
return network.UploadBlobs(std::move(blobs));
};
auto const hash_function = network_->GetHashFunction();
- std::unordered_set<BazelBlob> dir_blobs{};
+ std::unordered_set<ArtifactBlob> dir_blobs{};
auto rootdir_blob = ProcessDirectoryMessage(hash_function, tree.root());
if (not rootdir_blob) {
@@ -294,7 +294,7 @@ auto BazelResponse::UploadTreeMessageDirectories(
}
auto const root_digest = rootdir_blob->digest;
// store or upload rootdir blob, taking maximum transfer size into account
- if (not UpdateContainerAndUpload<bazel_re::Digest>(
+ if (not UpdateContainerAndUpload<ArtifactDigest>(
&dir_blobs,
*std::move(rootdir_blob),
/*exception_is_fatal=*/false,
@@ -310,7 +310,7 @@ auto BazelResponse::UploadTreeMessageDirectories(
return unexpected{std::move(blob).error()};
}
auto const blob_digest = blob->digest;
- if (not UpdateContainerAndUpload<bazel_re::Digest>(
+ if (not UpdateContainerAndUpload<ArtifactDigest>(
&dir_blobs,
*std::move(blob),
/*exception_is_fatal=*/false,
@@ -327,7 +327,5 @@ auto BazelResponse::UploadTreeMessageDirectories(
fmt::format("failed to upload blobs for Tree with root digest {}",
root_digest.hash())};
}
- return ArtifactDigestFactory::FromBazel(hash_function.GetType(),
- root_digest)
- .value(); // must succeed all the time
+ return root_digest;
}