From 7d2f632b1dd1fe2ca01ef89716efe355e4d32687 Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Mon, 16 Sep 2024 15:32:59 +0200 Subject: Introduce ByteStreamUtils, wrap kChunkSize ...and use the qualified name ByteStreamUtils::kChunkSize --- src/buildtool/execution_api/remote/bazel/bytestream_client.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/buildtool/execution_api/remote/bazel/bytestream_client.hpp') diff --git a/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp b/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp index d5485c9f..a444e61b 100644 --- a/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp +++ b/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp @@ -27,7 +27,7 @@ #include "src/buildtool/auth/authentication.hpp" #include "src/buildtool/common/remote/client_common.hpp" #include "src/buildtool/common/remote/port.hpp" -#include "src/buildtool/execution_api/common/bytestream_common.hpp" +#include "src/buildtool/execution_api/common/bytestream_utils.hpp" #include "src/buildtool/execution_api/remote/config.hpp" #include "src/buildtool/logging/log_level.hpp" #include "src/buildtool/logging/logger.hpp" @@ -115,11 +115,12 @@ class ByteStreamClient { google::bytestream::WriteRequest request{}; request.set_resource_name(resource_name); - request.mutable_data()->resize(kChunkSize, '\0'); + request.mutable_data()->resize(ByteStreamUtils::kChunkSize, '\0'); std::size_t pos{}; do { - auto const size = std::min(data.size() - pos, kChunkSize); + auto const size = + std::min(data.size() - pos, ByteStreamUtils::kChunkSize); request.mutable_data()->resize(size); data.copy(request.mutable_data()->data(), size, pos); request.set_write_offset(static_cast(pos)); @@ -141,7 +142,7 @@ class ByteStreamClient { pos = gsl::narrow(committed_size); } else { - pos += kChunkSize; + pos += ByteStreamUtils::kChunkSize; } } while (pos < data.size()); if (not writer->WritesDone()) { -- cgit v1.2.3