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/cas_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/cas_server.cpp')
-rw-r--r-- | src/buildtool/execution_api/execution_service/cas_server.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
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; } |