From 0dfd8029176212ea41e7a8eda7fabcb57705c3e3 Mon Sep 17 00:00:00 2001 From: Alberto Sartori Date: Mon, 30 Jan 2023 17:20:07 +0100 Subject: bytestream_client: use common header with settings shared by both server and client --- src/buildtool/execution_api/common/TARGETS | 6 ++++++ .../execution_api/common/bytestream_common.hpp | 23 ++++++++++++++++++++++ src/buildtool/execution_api/remote/TARGETS | 1 + .../remote/bazel/bytestream_client.hpp | 4 +--- 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 src/buildtool/execution_api/common/bytestream_common.hpp (limited to 'src') diff --git a/src/buildtool/execution_api/common/TARGETS b/src/buildtool/execution_api/common/TARGETS index 61a18115..2c7ca6cf 100644 --- a/src/buildtool/execution_api/common/TARGETS +++ b/src/buildtool/execution_api/common/TARGETS @@ -19,4 +19,10 @@ , "stage": ["src", "buildtool", "execution_api", "common"] , "private-deps": [["src/buildtool/file_system", "object_type"]] } +, "bytestream-common": + { "type": ["@", "rules", "CC", "library"] + , "name": ["bytestream-common"] + , "hdrs": ["bytestream_common.hpp"] + , "stage": ["src", "buildtool", "execution_api", "common"] + } } diff --git a/src/buildtool/execution_api/common/bytestream_common.hpp b/src/buildtool/execution_api/common/bytestream_common.hpp new file mode 100644 index 00000000..5c7cf3cb --- /dev/null +++ b/src/buildtool/execution_api/common/bytestream_common.hpp @@ -0,0 +1,23 @@ +// Copyright 2022 Huawei Cloud Computing Technology Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// settings common for server and client +#ifndef BYTESTREAM_COMMON_HPP +#define BYTESTREAM_COMMON_HPP +#include + +// Chunk size for uploads (default size used by BuildBarn) +constexpr static std::size_t kChunkSize = 64 * 1024; + +#endif diff --git a/src/buildtool/execution_api/remote/TARGETS b/src/buildtool/execution_api/remote/TARGETS index 3f7961d5..687343a7 100644 --- a/src/buildtool/execution_api/remote/TARGETS +++ b/src/buildtool/execution_api/remote/TARGETS @@ -28,6 +28,7 @@ , ["src/buildtool/common", "bazel_types"] , ["src/buildtool/execution_api/bazel_msg", "bazel_msg"] , ["src/buildtool/auth", "auth"] + , ["src/buildtool/execution_api/common", "bytestream-common"] ] , "proto": [ ["@", "bazel_remote_apis", "", "remote_execution_proto"] diff --git a/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp b/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp index 9be55bc5..79905b39 100644 --- a/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp +++ b/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp @@ -23,6 +23,7 @@ #include #include "google/bytestream/bytestream.grpc.pb.h" +#include "src/buildtool/execution_api/common/bytestream_common.hpp" #include "src/buildtool/execution_api/remote/bazel/bazel_client_common.hpp" #include "src/buildtool/execution_api/remote/config.hpp" #include "src/buildtool/logging/logger.hpp" @@ -177,9 +178,6 @@ class ByteStreamClient { } private: - // Chunk size for uploads (default size used by BuildBarn) - constexpr static std::size_t kChunkSize = 64 * 1024; - std::unique_ptr stub_; Logger logger_{"ByteStreamClient"}; -- cgit v1.2.3