summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_api/remote
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/execution_api/remote')
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp9
-rw-r--r--src/buildtool/execution_api/remote/bazel/bytestream_client.hpp11
2 files changed, 9 insertions, 11 deletions
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp b/src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp
index ea248810..155bbc89 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_cas_client.cpp
@@ -317,12 +317,9 @@ auto BazelCasClient::UpdateSingleBlob(std::string const& instance_name,
}
uuid = CreateUUIDVersion4(*id);
}
- auto ok = stream_->Write(fmt::format("{}/uploads/{}/blobs/{}/{}",
- instance_name,
- uuid,
- blob.digest.hash(),
- blob.digest.size_bytes()),
- *blob.data);
+ auto ok = stream_->Write(
+ ByteStreamUtils::WriteRequest{instance_name, uuid, blob.digest},
+ *blob.data);
if (not ok) {
logger_.Emit(LogLevel::Error,
"Failed to write {}:{}",
diff --git a/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp b/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp
index 02538384..a67fd904 100644
--- a/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp
+++ b/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp
@@ -106,7 +106,7 @@ class ByteStreamClient {
return output;
}
- [[nodiscard]] auto Write(std::string const& resource_name,
+ [[nodiscard]] auto Write(ByteStreamUtils::WriteRequest&& write_request,
std::string const& data) const noexcept -> bool {
try {
grpc::ClientContext ctx;
@@ -114,7 +114,7 @@ class ByteStreamClient {
auto writer = stub_->Write(&ctx, &response);
google::bytestream::WriteRequest request{};
- request.set_resource_name(resource_name);
+ request.set_resource_name(std::move(write_request).ToString());
request.mutable_data()->resize(ByteStreamUtils::kChunkSize, '\0');
std::size_t pos{};
@@ -131,12 +131,13 @@ class ByteStreamClient {
// the `Write()`, the client should check the status of the
// `Write()` by calling `QueryWriteStatus()` and continue
// writing from the returned `committed_size`.
- auto const committed_size = QueryWriteStatus(resource_name);
+ auto const committed_size =
+ QueryWriteStatus(request.resource_name());
if (committed_size <= 0) {
logger_.Emit(
LogLevel::Warning,
"broken stream for upload to resource name {}",
- resource_name);
+ request.resource_name());
return false;
}
pos = gsl::narrow<std::size_t>(committed_size);
@@ -148,7 +149,7 @@ class ByteStreamClient {
if (not writer->WritesDone()) {
logger_.Emit(LogLevel::Warning,
"broken stream for upload to resource name {}",
- resource_name);
+ request.resource_name());
return false;
}