[xds] C++ XdsServerBuilder Remove src/... header dependency from public header (#34790)

pull/34796/head
Yash Tibrewal 1 year ago committed by GitHub
parent 1fd45fcd01
commit 2bc23f1138
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      BUILD
  2. 1
      CMakeLists.txt
  3. 1
      build_autogenerated.yaml
  4. 1
      gRPC-C++.podspec
  5. 1
      grpc.gyp
  6. 16
      include/grpcpp/xds_server_builder.h
  7. 43
      src/cpp/server/xds_server_builder.cc
  8. 1
      tools/doxygen/Doxyfile.c++.internal

@ -1144,6 +1144,7 @@ grpc_cc_library(
grpc_cc_library(
name = "grpc++_xds_server",
srcs = [
"src/cpp/server/xds_server_builder.cc",
"src/cpp/server/xds_server_credentials.cc",
],
hdrs = [
@ -1155,6 +1156,7 @@ grpc_cc_library(
],
visibility = ["@grpc:xds"],
deps = [
"channel_arg_names",
"gpr",
"grpc",
"grpc++_base",

1
CMakeLists.txt generated

@ -3895,6 +3895,7 @@ add_library(grpc++
src/cpp/server/server_cc.cc
src/cpp/server/server_context.cc
src/cpp/server/server_posix.cc
src/cpp/server/xds_server_builder.cc
src/cpp/server/xds_server_credentials.cc
src/cpp/thread_manager/thread_manager.cc
src/cpp/util/byte_buffer_cc.cc

@ -3656,6 +3656,7 @@ libs:
- src/cpp/server/server_cc.cc
- src/cpp/server/server_context.cc
- src/cpp/server/server_posix.cc
- src/cpp/server/xds_server_builder.cc
- src/cpp/server/xds_server_credentials.cc
- src/cpp/thread_manager/thread_manager.cc
- src/cpp/util/byte_buffer_cc.cc

1
gRPC-C++.podspec generated

@ -1181,6 +1181,7 @@ Pod::Spec.new do |s|
'src/cpp/server/server_context.cc',
'src/cpp/server/server_posix.cc',
'src/cpp/server/thread_pool_interface.h',
'src/cpp/server/xds_server_builder.cc',
'src/cpp/server/xds_server_credentials.cc',
'src/cpp/thread_manager/thread_manager.cc',
'src/cpp/thread_manager/thread_manager.h',

1
grpc.gyp generated

@ -1820,6 +1820,7 @@
'src/cpp/server/server_cc.cc',
'src/cpp/server/server_context.cc',
'src/cpp/server/server_posix.cc',
'src/cpp/server/xds_server_builder.cc',
'src/cpp/server/xds_server_credentials.cc',
'src/cpp/thread_manager/thread_manager.cc',
'src/cpp/util/byte_buffer_cc.cc',

@ -23,8 +23,6 @@
#include <grpcpp/server_builder.h>
#include "src/core/ext/xds/xds_enabled_server.h"
namespace grpc {
class XdsServerServingStatusNotifierInterface {
@ -81,19 +79,7 @@ class XdsServerBuilder : public grpc::ServerBuilder {
private:
// Called at the beginning of BuildAndStart().
ChannelArguments BuildChannelArgs() override {
ChannelArguments args = ServerBuilder::BuildChannelArgs();
if (drain_grace_time_ms_ >= 0) {
args.SetInt(GRPC_ARG_SERVER_CONFIG_CHANGE_DRAIN_GRACE_TIME_MS,
drain_grace_time_ms_);
}
args.SetInt(GRPC_ARG_XDS_ENABLED_SERVER, 1);
grpc_channel_args c_channel_args = args.c_channel_args();
grpc_server_config_fetcher* fetcher = grpc_server_config_fetcher_xds_create(
{OnServingStatusUpdate, notifier_}, &c_channel_args);
if (fetcher != nullptr) set_fetcher(fetcher);
return args;
}
ChannelArguments BuildChannelArgs() override;
static void OnServingStatusUpdate(void* user_data, const char* uri,
grpc_serving_status_update update) {

@ -0,0 +1,43 @@
//
//
// Copyright 2023 gRPC authors.
//
// 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.
//
//
#include <grpc/grpc.h>
#include <grpc/impl/channel_arg_names.h>
#include <grpcpp/server_builder.h>
#include <grpcpp/support/channel_arguments.h>
#include <grpcpp/xds_server_builder.h>
#include "src/core/ext/xds/xds_enabled_server.h"
namespace grpc {
ChannelArguments XdsServerBuilder::BuildChannelArgs() {
ChannelArguments args = ServerBuilder::BuildChannelArgs();
if (drain_grace_time_ms_ >= 0) {
args.SetInt(GRPC_ARG_SERVER_CONFIG_CHANGE_DRAIN_GRACE_TIME_MS,
drain_grace_time_ms_);
}
args.SetInt(GRPC_ARG_XDS_ENABLED_SERVER, 1);
grpc_channel_args c_channel_args = args.c_channel_args();
grpc_server_config_fetcher* fetcher = grpc_server_config_fetcher_xds_create(
{OnServingStatusUpdate, notifier_}, &c_channel_args);
if (fetcher != nullptr) set_fetcher(fetcher);
return args;
}
} // namespace grpc

@ -2841,6 +2841,7 @@ src/cpp/server/server_cc.cc \
src/cpp/server/server_context.cc \
src/cpp/server/server_posix.cc \
src/cpp/server/thread_pool_interface.h \
src/cpp/server/xds_server_builder.cc \
src/cpp/server/xds_server_credentials.cc \
src/cpp/thread_manager/thread_manager.cc \
src/cpp/thread_manager/thread_manager.h \

Loading…
Cancel
Save