From a02cc7d88ae45abf7ccb742c7c61345f7ef6d0d2 Mon Sep 17 00:00:00 2001 From: Cheng-Yu Chung Date: Fri, 18 Nov 2022 14:10:37 -0500 Subject: [PATCH] Remove `include/grpcpp/impl/codegen/delegating_channel.h` (#31495) * Remove `include/grpcpp/impl/codegen/delegating_channel.h` * Update * Automated change: Fix sanity tests * Automated change: Fix sanity tests --- BUILD | 1 + CMakeLists.txt | 2 + build_autogenerated.yaml | 2 + gRPC-C++.podspec | 1 + .../grpcpp/impl/codegen/delegating_channel.h | 70 +------------- include/grpcpp/impl/delegating_channel.h | 91 +++++++++++++++++++ test/cpp/end2end/delegating_channel_test.cc | 2 +- tools/doxygen/Doxyfile.c++ | 1 + tools/doxygen/Doxyfile.c++.internal | 1 + 9 files changed, 102 insertions(+), 69 deletions(-) create mode 100644 include/grpcpp/impl/delegating_channel.h diff --git a/BUILD b/BUILD index 773ad1ace1a..5911bd218dc 100644 --- a/BUILD +++ b/BUILD @@ -342,6 +342,7 @@ GRPCXX_PUBLIC_HDRS = [ "include/grpcpp/impl/client_unary_call.h", "include/grpcpp/impl/codegen/core_codegen.h", "include/grpcpp/impl/completion_queue_tag.h", + "include/grpcpp/impl/delegating_channel.h", "include/grpcpp/impl/grpc_library.h", "include/grpcpp/impl/method_handler_impl.h", "include/grpcpp/impl/rpc_method.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index f257cd9ad06..5f623dfe73d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3446,6 +3446,7 @@ foreach(_hdr include/grpcpp/impl/codegen/sync_stream.h include/grpcpp/impl/codegen/time.h include/grpcpp/impl/completion_queue_tag.h + include/grpcpp/impl/delegating_channel.h include/grpcpp/impl/grpc_library.h include/grpcpp/impl/method_handler_impl.h include/grpcpp/impl/rpc_method.h @@ -4133,6 +4134,7 @@ foreach(_hdr include/grpcpp/impl/codegen/sync_stream.h include/grpcpp/impl/codegen/time.h include/grpcpp/impl/completion_queue_tag.h + include/grpcpp/impl/delegating_channel.h include/grpcpp/impl/grpc_library.h include/grpcpp/impl/method_handler_impl.h include/grpcpp/impl/rpc_method.h diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index 96b6968afe7..ba672cc0eca 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -2821,6 +2821,7 @@ libs: - include/grpcpp/impl/codegen/sync_stream.h - include/grpcpp/impl/codegen/time.h - include/grpcpp/impl/completion_queue_tag.h + - include/grpcpp/impl/delegating_channel.h - include/grpcpp/impl/grpc_library.h - include/grpcpp/impl/method_handler_impl.h - include/grpcpp/impl/rpc_method.h @@ -3239,6 +3240,7 @@ libs: - include/grpcpp/impl/codegen/sync_stream.h - include/grpcpp/impl/codegen/time.h - include/grpcpp/impl/completion_queue_tag.h + - include/grpcpp/impl/delegating_channel.h - include/grpcpp/impl/grpc_library.h - include/grpcpp/impl/method_handler_impl.h - include/grpcpp/impl/rpc_method.h diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 46c89e6c1d9..7293fb5d252 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -147,6 +147,7 @@ Pod::Spec.new do |s| 'include/grpcpp/impl/codegen/sync_stream.h', 'include/grpcpp/impl/codegen/time.h', 'include/grpcpp/impl/completion_queue_tag.h', + 'include/grpcpp/impl/delegating_channel.h', 'include/grpcpp/impl/grpc_library.h', 'include/grpcpp/impl/method_handler_impl.h', 'include/grpcpp/impl/rpc_method.h', diff --git a/include/grpcpp/impl/codegen/delegating_channel.h b/include/grpcpp/impl/codegen/delegating_channel.h index 5e63d542667..1a51f01872e 100644 --- a/include/grpcpp/impl/codegen/delegating_channel.h +++ b/include/grpcpp/impl/codegen/delegating_channel.h @@ -21,73 +21,7 @@ // IWYU pragma: private -#include - -#include - -namespace grpc { -namespace experimental { - -class DelegatingChannel : public grpc::ChannelInterface { - public: - ~DelegatingChannel() override {} - - explicit DelegatingChannel( - std::shared_ptr delegate_channel) - : delegate_channel_(delegate_channel) {} - - grpc_connectivity_state GetState(bool try_to_connect) override { - return delegate_channel()->GetState(try_to_connect); - } - - std::shared_ptr delegate_channel() { - return delegate_channel_; - } - - private: - internal::Call CreateCall(const internal::RpcMethod& method, - ClientContext* context, - grpc::CompletionQueue* cq) final { - return delegate_channel()->CreateCall(method, context, cq); - } - - void PerformOpsOnCall(internal::CallOpSetInterface* ops, - internal::Call* call) final { - delegate_channel()->PerformOpsOnCall(ops, call); - } - - void* RegisterMethod(const char* method) final { - return delegate_channel()->RegisterMethod(method); - } - - void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed, - gpr_timespec deadline, grpc::CompletionQueue* cq, - void* tag) override { - delegate_channel()->NotifyOnStateChangeImpl(last_observed, deadline, cq, - tag); - } - - bool WaitForStateChangeImpl(grpc_connectivity_state last_observed, - gpr_timespec deadline) override { - return delegate_channel()->WaitForStateChangeImpl(last_observed, deadline); - } - - internal::Call CreateCallInternal(const internal::RpcMethod& method, - ClientContext* context, - grpc::CompletionQueue* cq, - size_t interceptor_pos) final { - return delegate_channel()->CreateCallInternal(method, context, cq, - interceptor_pos); - } - - grpc::CompletionQueue* CallbackCQ() final { - return delegate_channel()->CallbackCQ(); - } - - std::shared_ptr delegate_channel_; -}; - -} // namespace experimental -} // namespace grpc +/// TODO(chengyuc): Remove this file after solving compatibility. +#include #endif // GRPCPP_IMPL_CODEGEN_DELEGATING_CHANNEL_H diff --git a/include/grpcpp/impl/delegating_channel.h b/include/grpcpp/impl/delegating_channel.h new file mode 100644 index 00000000000..eeb0c9c32fd --- /dev/null +++ b/include/grpcpp/impl/delegating_channel.h @@ -0,0 +1,91 @@ +/* + * + * Copyright 2019 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. + * + */ + +#ifndef GRPCPP_IMPL_DELEGATING_CHANNEL_H +#define GRPCPP_IMPL_DELEGATING_CHANNEL_H + +#include + +#include + +namespace grpc { +namespace experimental { + +class DelegatingChannel : public grpc::ChannelInterface { + public: + ~DelegatingChannel() override {} + + explicit DelegatingChannel( + std::shared_ptr delegate_channel) + : delegate_channel_(delegate_channel) {} + + grpc_connectivity_state GetState(bool try_to_connect) override { + return delegate_channel()->GetState(try_to_connect); + } + + std::shared_ptr delegate_channel() { + return delegate_channel_; + } + + private: + internal::Call CreateCall(const internal::RpcMethod& method, + ClientContext* context, + grpc::CompletionQueue* cq) final { + return delegate_channel()->CreateCall(method, context, cq); + } + + void PerformOpsOnCall(internal::CallOpSetInterface* ops, + internal::Call* call) final { + delegate_channel()->PerformOpsOnCall(ops, call); + } + + void* RegisterMethod(const char* method) final { + return delegate_channel()->RegisterMethod(method); + } + + void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed, + gpr_timespec deadline, grpc::CompletionQueue* cq, + void* tag) override { + delegate_channel()->NotifyOnStateChangeImpl(last_observed, deadline, cq, + tag); + } + + bool WaitForStateChangeImpl(grpc_connectivity_state last_observed, + gpr_timespec deadline) override { + return delegate_channel()->WaitForStateChangeImpl(last_observed, deadline); + } + + internal::Call CreateCallInternal(const internal::RpcMethod& method, + ClientContext* context, + grpc::CompletionQueue* cq, + size_t interceptor_pos) final { + return delegate_channel()->CreateCallInternal(method, context, cq, + interceptor_pos); + } + + grpc::CompletionQueue* CallbackCQ() final { + return delegate_channel()->CallbackCQ(); + } + + std::shared_ptr delegate_channel_; +}; + +} // namespace experimental +} // namespace grpc + +#endif // GRPCPP_IMPL_DELEGATING_CHANNEL_H diff --git a/test/cpp/end2end/delegating_channel_test.cc b/test/cpp/end2end/delegating_channel_test.cc index d12f5ac2e61..deb47dacf4a 100644 --- a/test/cpp/end2end/delegating_channel_test.cc +++ b/test/cpp/end2end/delegating_channel_test.cc @@ -25,8 +25,8 @@ #include #include #include -#include #include +#include #include #include #include diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 314e5d2438b..cec1c8d9873 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -1011,6 +1011,7 @@ include/grpcpp/impl/codegen/sync.h \ include/grpcpp/impl/codegen/sync_stream.h \ include/grpcpp/impl/codegen/time.h \ include/grpcpp/impl/completion_queue_tag.h \ +include/grpcpp/impl/delegating_channel.h \ include/grpcpp/impl/grpc_library.h \ include/grpcpp/impl/method_handler_impl.h \ include/grpcpp/impl/rpc_method.h \ diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 7561bd7a01b..4b067b71247 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1011,6 +1011,7 @@ include/grpcpp/impl/codegen/sync.h \ include/grpcpp/impl/codegen/sync_stream.h \ include/grpcpp/impl/codegen/time.h \ include/grpcpp/impl/completion_queue_tag.h \ +include/grpcpp/impl/delegating_channel.h \ include/grpcpp/impl/grpc_library.h \ include/grpcpp/impl/method_handler_impl.h \ include/grpcpp/impl/rpc_method.h \