summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-09-16 15:32:59 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-09-18 09:45:19 +0200
commit7d2f632b1dd1fe2ca01ef89716efe355e4d32687 (patch)
tree9dfb24707da8a9d8db0506636f5c6186f2e2fbe1 /src/buildtool/execution_api/remote/bazel/bytestream_client.hpp
parentaf36ec3931067d40f0552a8d5610cc9d35f91bbc (diff)
downloadjustbuild-7d2f632b1dd1fe2ca01ef89716efe355e4d32687.tar.gz
Introduce ByteStreamUtils, wrap kChunkSize
...and use the qualified name ByteStreamUtils::kChunkSize
Diffstat (limited to 'src/buildtool/execution_api/remote/bazel/bytestream_client.hpp')
-rw-r--r--src/buildtool/execution_api/remote/bazel/bytestream_client.hpp9
1 files changed, 5 insertions, 4 deletions
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<int>(pos));
@@ -141,7 +142,7 @@ class ByteStreamClient {
pos = gsl::narrow<std::size_t>(committed_size);
}
else {
- pos += kChunkSize;
+ pos += ByteStreamUtils::kChunkSize;
}
} while (pos < data.size());
if (not writer->WritesDone()) {