From c01123bd19be5398f20730d2872ad337e5b5d73a Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Thu, 29 Aug 2024 17:31:02 +0200 Subject: Cast ArtifactDigest to bazel_re::Digest explicitly ...to simplify further refactoring. --- .../execution_api/execution_service/bytestream_server.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/buildtool/execution_api/execution_service/bytestream_server.cpp') 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 stored; - if (is_tree) { - stored = storage_.CAS().StoreTree(tmp); - } - else { - stored = storage_.CAS().StoreBlob( - tmp, /*is_executable=*/false); - } - + auto const stored = is_tree ? storage_.CAS().StoreTree(tmp) + : storage_.CAS().StoreBlob( + 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(*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, -- cgit v1.2.3