diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-08-29 17:31:02 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-08-30 17:17:09 +0200 |
commit | c01123bd19be5398f20730d2872ad337e5b5d73a (patch) | |
tree | ba4cd2d962a208ecd056650737c86a52a7ea838e /src/buildtool/execution_api/execution_service/bytestream_server.cpp | |
parent | 013d83eed166049be110d47f00feb4c6af1315af (diff) | |
download | justbuild-c01123bd19be5398f20730d2872ad337e5b5d73a.tar.gz |
Cast ArtifactDigest to bazel_re::Digest explicitly
...to simplify further refactoring.
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, |