diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2025-02-20 12:35:12 +0100 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2025-02-21 14:46:30 +0100 |
commit | ff9a8dfbe17f88cec92a00f00d2dbfb9015e342b (patch) | |
tree | 6702b58bf7235c324f45c5458edb9172faaab836 /src/buildtool/execution_api/remote/bazel/bytestream_client.hpp | |
parent | e8c157aed3fed0472d14b205c6b1dc78c393a430 (diff) | |
download | justbuild-ff9a8dfbe17f88cec92a00f00d2dbfb9015e342b.tar.gz |
ByteStreamClient: Use ByteStreamUtils::ReadRequest internally only.
Diffstat (limited to 'src/buildtool/execution_api/remote/bazel/bytestream_client.hpp')
-rw-r--r-- | src/buildtool/execution_api/remote/bazel/bytestream_client.hpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp b/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp index 452c0abe..e4f8f465 100644 --- a/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp +++ b/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp @@ -29,6 +29,7 @@ #include "google/bytestream/bytestream.pb.h" #include "gsl/gsl" #include "src/buildtool/auth/authentication.hpp" +#include "src/buildtool/common/artifact_digest.hpp" #include "src/buildtool/common/remote/client_common.hpp" #include "src/buildtool/common/remote/port.hpp" #include "src/buildtool/execution_api/common/artifact_blob.hpp" @@ -77,11 +78,15 @@ class ByteStreamClient { IncrementalReader( gsl::not_null<google::bytestream::ByteStream::Stub*> const& stub, - ByteStreamUtils::ReadRequest&& read_request, + std::string const& instance_name, + ArtifactDigest const& digest, Logger const* logger) : logger_{logger} { google::bytestream::ReadRequest request{}; - request.set_resource_name(std::move(read_request).ToString()); + + auto resource_name = + ByteStreamUtils::ReadRequest{instance_name, digest}.ToString(); + request.set_resource_name(std::move(resource_name)); reader_ = stub->Read(&ctx_, request); } }; @@ -93,14 +98,16 @@ class ByteStreamClient { CreateChannelWithCredentials(server, port, auth)); } - [[nodiscard]] auto IncrementalRead(ByteStreamUtils::ReadRequest&& request) - const noexcept -> IncrementalReader { - return IncrementalReader{stub_.get(), std::move(request), &logger_}; + [[nodiscard]] auto IncrementalRead( + std::string const& instance_name, + ArtifactDigest const& digest) const noexcept -> IncrementalReader { + return IncrementalReader{stub_.get(), instance_name, digest, &logger_}; } - [[nodiscard]] auto Read(ByteStreamUtils::ReadRequest&& request) - const noexcept -> std::optional<std::string> { - auto reader = IncrementalRead(std::move(request)); + [[nodiscard]] auto Read(std::string const& instance_name, + ArtifactDigest const& digest) const noexcept + -> std::optional<std::string> { + auto reader = IncrementalRead(instance_name, digest); std::string output{}; auto data = reader.Next(); while (data and not data->empty()) { |