summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_api/execution_service
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/execution_api/execution_service')
-rw-r--r--src/buildtool/execution_api/execution_service/bytestream_server.cpp14
-rw-r--r--src/buildtool/execution_api/execution_service/cas_server.cpp15
-rw-r--r--src/buildtool/execution_api/execution_service/execution_server.cpp16
3 files changed, 22 insertions, 23 deletions
diff --git a/src/buildtool/execution_api/execution_service/bytestream_server.cpp b/src/buildtool/execution_api/execution_service/bytestream_server.cpp
index 1b2aad14..4a3fa300 100644
--- a/src/buildtool/execution_api/execution_service/bytestream_server.cpp
+++ b/src/buildtool/execution_api/execution_service/bytestream_server.cpp
@@ -181,15 +181,9 @@ auto BytestreamServiceImpl::Write(
}
// Store blob and verify hash
- std::optional<bazel_re::Digest> stored;
- if (is_tree) {
- stored = storage_.CAS().StoreTree</*kOwner=*/true>(tmp);
- }
- else {
- stored = storage_.CAS().StoreBlob</*kOwner=*/true>(
- tmp, /*is_executable=*/false);
- }
-
+ auto const stored = is_tree ? storage_.CAS().StoreTree</*kOwner=*/true>(tmp)
+ : storage_.CAS().StoreBlob</*kOwner=*/true>(
+ tmp, /*is_executable=*/false);
if (not stored) {
// This is a serious problem: we have a sequence of bytes, but cannot
// write them to CAS.
@@ -198,7 +192,7 @@ auto BytestreamServiceImpl::Write(
return ::grpc::Status{::grpc::StatusCode::INTERNAL, str};
}
- if (stored->hash() != *hash) {
+ if (static_cast<bazel_re::Digest>(*stored).hash() != *hash) {
// User error: did not get a file with the announced hash
auto str = fmt::format("In upload for {} received object with hash {}",
*hash,
diff --git a/src/buildtool/execution_api/execution_service/cas_server.cpp b/src/buildtool/execution_api/execution_service/cas_server.cpp
index 2c2260ac..841243fc 100644
--- a/src/buildtool/execution_api/execution_service/cas_server.cpp
+++ b/src/buildtool/execution_api/execution_service/cas_server.cpp
@@ -60,14 +60,14 @@ inline constexpr std::size_t kSHA256Length = 64;
}
[[nodiscard]] auto CheckDigestConsistency(
- bazel_re::Digest const& ref,
- bazel_re::Digest const& computed) noexcept -> std::optional<std::string> {
+ ArtifactDigest const& ref,
+ ArtifactDigest const& computed) noexcept -> std::optional<std::string> {
bool valid = ref.hash() == computed.hash();
if (valid) {
bool const check_sizes =
- Compatibility::IsCompatible() or ref.size_bytes() != 0;
+ Compatibility::IsCompatible() or ref.size() != 0;
if (check_sizes) {
- valid = ref.size_bytes() == computed.size_bytes();
+ valid = ref.size() == computed.size();
}
}
if (not valid) {
@@ -76,9 +76,9 @@ inline constexpr std::size_t kSHA256Length = 64;
"from data {}:{} do not correspond.",
ref.hash(),
ref.hash(),
- ref.size_bytes(),
+ ref.size(),
computed.hash(),
- computed.size_bytes());
+ computed.size());
}
return std::nullopt;
}
@@ -373,6 +373,7 @@ auto CASServiceImpl::SpliceBlob(::grpc::ServerContext* /*context*/,
return ::grpc::Status{grpc::StatusCode::INVALID_ARGUMENT, str};
}
- response->mutable_blob_digest()->CopyFrom(*splice_result);
+ (*response->mutable_blob_digest()) =
+ static_cast<bazel_re::Digest>(*splice_result);
return ::grpc::Status::OK;
}
diff --git a/src/buildtool/execution_api/execution_service/execution_server.cpp b/src/buildtool/execution_api/execution_service/execution_server.cpp
index c89f06fe..65e63ce9 100644
--- a/src/buildtool/execution_api/execution_service/execution_server.cpp
+++ b/src/buildtool/execution_api/execution_service/execution_server.cpp
@@ -109,7 +109,8 @@ auto ExecutionServiceImpl::ToBazelExecuteResponse(
fmt::format("Could not store stderr of action {}",
i_execution_response->ActionDigest())};
}
- action_result.mutable_stderr_digest()->CopyFrom(*cas_digest);
+ (*action_result.mutable_stderr_digest()) =
+ static_cast<bazel_re::Digest>(*cas_digest);
}
if (i_execution_response->HasStdOut()) {
@@ -121,7 +122,8 @@ auto ExecutionServiceImpl::ToBazelExecuteResponse(
fmt::format("Could not store stdout of action {}",
i_execution_response->ActionDigest())};
}
- action_result.mutable_stdout_digest()->CopyFrom(*cas_digest);
+ (*action_result.mutable_stdout_digest()) =
+ static_cast<bazel_re::Digest>(*cas_digest);
}
::bazel_re::ExecuteResponse bazel_response{};
@@ -282,11 +284,13 @@ namespace {
digest.hash());
return unexpected{std::move(error)};
}
- *(out_dir.mutable_tree_digest()) = *std::move(cas_digest);
+ (*out_dir.mutable_tree_digest()) =
+ static_cast<bazel_re::Digest>(*cas_digest);
}
else {
// In native mode: Set the directory digest directly.
- *(out_dir.mutable_tree_digest()) = digest;
+ (*out_dir.mutable_tree_digest()) =
+ static_cast<bazel_re::Digest>(digest);
}
return std::move(out_dir);
}
@@ -320,8 +324,8 @@ namespace {
Artifact::ObjectInfo const& info) noexcept
-> ::bazel_re::OutputFile {
::bazel_re::OutputFile out_file{};
- *(out_file.mutable_path()) = std::move(path);
- *(out_file.mutable_digest()) = info.digest;
+ (*out_file.mutable_path()) = std::move(path);
+ (*out_file.mutable_digest()) = static_cast<bazel_re::Digest>(info.digest);
out_file.set_is_executable(IsExecutableObject(info.type));
return out_file;
}