diff options
Diffstat (limited to 'src/buildtool/execution_api/execution_service/bytestream_server.cpp')
-rw-r--r-- | src/buildtool/execution_api/execution_service/bytestream_server.cpp | 14 |
1 files changed, 4 insertions, 10 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, |