diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-08-29 11:35:37 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-08-30 17:17:09 +0200 |
commit | d551ef4acdf1732a145724b70f65be5fbe4052b0 (patch) | |
tree | 0cd3d2da73907d5d142b6b8c6b92304ed0a9a17e /src/buildtool/execution_api | |
parent | 8520a8fe2b2fc20940ed6457971a8de179343449 (diff) | |
download | justbuild-d551ef4acdf1732a145724b70f65be5fbe4052b0.tar.gz |
Replace bazel_re::Digest in LocalCAS::{...}Path
...with ArtifactDigest.
Diffstat (limited to 'src/buildtool/execution_api')
5 files changed, 25 insertions, 16 deletions
diff --git a/src/buildtool/execution_api/execution_service/bytestream_server.cpp b/src/buildtool/execution_api/execution_service/bytestream_server.cpp index 32adba91..0f77542d 100644 --- a/src/buildtool/execution_api/execution_service/bytestream_server.cpp +++ b/src/buildtool/execution_api/execution_service/bytestream_server.cpp @@ -73,12 +73,11 @@ auto BytestreamServiceImpl::Read( if (NativeSupport::IsTree(*hash)) { ArtifactDigest dgst{NativeSupport::Unprefix(*hash), 0, true}; - path = storage_.CAS().TreePath(static_cast<bazel_re::Digest>(dgst)); + path = storage_.CAS().TreePath(dgst); } else { ArtifactDigest dgst{NativeSupport::Unprefix(*hash), 0, false}; - path = - storage_.CAS().BlobPath(static_cast<bazel_re::Digest>(dgst), false); + path = storage_.CAS().BlobPath(dgst, false); } if (not path) { auto str = fmt::format("could not find {}", *hash); diff --git a/src/buildtool/execution_api/execution_service/cas_utils.cpp b/src/buildtool/execution_api/execution_service/cas_utils.cpp index 592cd6ce..e92a2239 100644 --- a/src/buildtool/execution_api/execution_service/cas_utils.cpp +++ b/src/buildtool/execution_api/execution_service/cas_utils.cpp @@ -50,9 +50,11 @@ auto CASUtils::SplitBlobIdentity(bazel_re::Digest const& blob_digest, -> expected<std::vector<bazel_re::Digest>, grpc::Status> { // Check blob existence. - auto path = NativeSupport::IsTree(blob_digest.hash()) - ? storage.CAS().TreePath(blob_digest) - : storage.CAS().BlobPath(blob_digest, false); + auto path = + NativeSupport::IsTree(blob_digest.hash()) + ? storage.CAS().TreePath(static_cast<ArtifactDigest>(blob_digest)) + : storage.CAS().BlobPath(static_cast<ArtifactDigest>(blob_digest), + false); if (not path) { return unexpected{ grpc::Status{grpc::StatusCode::NOT_FOUND, diff --git a/src/buildtool/execution_api/execution_service/execution_server.cpp b/src/buildtool/execution_api/execution_service/execution_server.cpp index 16202975..b862a03d 100644 --- a/src/buildtool/execution_api/execution_service/execution_server.cpp +++ b/src/buildtool/execution_api/execution_service/execution_server.cpp @@ -378,8 +378,8 @@ namespace { if (auto error_msg = IsAHash(request.action_digest().hash())) { return unexpected{std::move(*error_msg)}; } - auto const action_path = - storage.CAS().BlobPath(request.action_digest(), false); + auto const action_path = storage.CAS().BlobPath( + static_cast<ArtifactDigest>(request.action_digest()), false); if (not action_path) { return unexpected{fmt::format("could not retrieve blob {} from cas", request.action_digest().hash())}; @@ -395,8 +395,11 @@ namespace { } auto const input_root_path = Compatibility::IsCompatible() - ? storage.CAS().BlobPath(action.input_root_digest(), false) - : storage.CAS().TreePath(action.input_root_digest()); + ? storage.CAS().BlobPath( + static_cast<ArtifactDigest>(action.input_root_digest()), + false) + : storage.CAS().TreePath( + static_cast<ArtifactDigest>(action.input_root_digest())); if (not input_root_path) { return unexpected{ @@ -412,7 +415,8 @@ namespace { if (auto error_msg = IsAHash(action.command_digest().hash())) { return unexpected{*std::move(error_msg)}; } - auto path = storage.CAS().BlobPath(action.command_digest(), false); + auto path = storage.CAS().BlobPath( + static_cast<ArtifactDigest>(action.command_digest()), false); if (not path) { return unexpected{fmt::format("Could not retrieve blob {} from cas", action.command_digest().hash())}; diff --git a/src/buildtool/execution_api/local/local_api.hpp b/src/buildtool/execution_api/local/local_api.hpp index 59dc1880..35b7b768 100644 --- a/src/buildtool/execution_api/local/local_api.hpp +++ b/src/buildtool/execution_api/local/local_api.hpp @@ -293,7 +293,9 @@ class LocalApi final : public IExecutionApi { std::vector<std::string>* targets) { targets->reserve(digests.size()); for (auto const& digest : digests) { - auto p = cas.BlobPath(digest, /*is_executable=*/false); + auto p = + cas.BlobPath(static_cast<ArtifactDigest>(digest), + /*is_executable=*/false); auto content = FileSystemManager::ReadFile(*p); targets->emplace_back(*content); } diff --git a/src/buildtool/execution_api/local/local_response.hpp b/src/buildtool/execution_api/local/local_response.hpp index 21dd5952..68ab0bcc 100644 --- a/src/buildtool/execution_api/local/local_response.hpp +++ b/src/buildtool/execution_api/local/local_response.hpp @@ -43,8 +43,9 @@ class LocalResponse final : public IExecutionResponse { return (output_.action.stdout_digest().size_bytes() != 0); } auto StdErr() noexcept -> std::string final { - if (auto path = storage_.CAS().BlobPath(output_.action.stderr_digest(), - /*is_executable=*/false)) { + if (auto path = storage_.CAS().BlobPath( + static_cast<ArtifactDigest>(output_.action.stderr_digest()), + /*is_executable=*/false)) { if (auto content = FileSystemManager::ReadFile(*path)) { return std::move(*content); } @@ -53,8 +54,9 @@ class LocalResponse final : public IExecutionResponse { return {}; } auto StdOut() noexcept -> std::string final { - if (auto path = storage_.CAS().BlobPath(output_.action.stdout_digest(), - /*is_executable=*/false)) { + if (auto path = storage_.CAS().BlobPath( + static_cast<ArtifactDigest>(output_.action.stdout_digest()), + /*is_executable=*/false)) { if (auto content = FileSystemManager::ReadFile(*path)) { return std::move(*content); } |