Remove `include/grpcpp/impl/codegen/channel_interface.h` (#31312)

* Remove `include/grpcpp/impl/codegen/channel_interface.h`

* Update
pull/31496/head
Cheng-Yu Chung 2 years ago committed by GitHub
parent 3b18968927
commit e60140676a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      BUILD
  2. 2
      CMakeLists.txt
  3. 2
      build_autogenerated.yaml
  4. 1
      gRPC-C++.podspec
  5. 2
      include/grpcpp/channel.h
  6. 170
      include/grpcpp/impl/channel_interface.h
  7. 2
      include/grpcpp/impl/client_unary_call.h
  8. 149
      include/grpcpp/impl/codegen/channel_interface.h
  9. 2
      include/grpcpp/support/async_stream.h
  10. 2
      include/grpcpp/support/async_unary_call.h
  11. 2
      include/grpcpp/support/client_callback.h
  12. 2
      src/compiler/cpp_generator.cc
  13. 1
      tools/doxygen/Doxyfile.c++
  14. 1
      tools/doxygen/Doxyfile.c++.internal

@ -337,6 +337,7 @@ GRPCXX_PUBLIC_HDRS = [
"include/grpcpp/impl/call_op_set_interface.h",
"include/grpcpp/impl/call.h",
"include/grpcpp/impl/channel_argument_option.h",
"include/grpcpp/impl/channel_interface.h",
"include/grpcpp/impl/client_unary_call.h",
"include/grpcpp/impl/codegen/core_codegen.h",
"include/grpcpp/impl/grpc_library.h",

2
CMakeLists.txt generated

@ -3364,6 +3364,7 @@ foreach(_hdr
include/grpcpp/impl/call_hook.h
include/grpcpp/impl/call_op_set_interface.h
include/grpcpp/impl/channel_argument_option.h
include/grpcpp/impl/channel_interface.h
include/grpcpp/impl/client_unary_call.h
include/grpcpp/impl/codegen/async_generic_service.h
include/grpcpp/impl/codegen/async_stream.h
@ -4035,6 +4036,7 @@ foreach(_hdr
include/grpcpp/impl/call_hook.h
include/grpcpp/impl/call_op_set_interface.h
include/grpcpp/impl/channel_argument_option.h
include/grpcpp/impl/channel_interface.h
include/grpcpp/impl/client_unary_call.h
include/grpcpp/impl/codegen/async_generic_service.h
include/grpcpp/impl/codegen/async_stream.h

@ -2747,6 +2747,7 @@ libs:
- include/grpcpp/impl/call_hook.h
- include/grpcpp/impl/call_op_set_interface.h
- include/grpcpp/impl/channel_argument_option.h
- include/grpcpp/impl/channel_interface.h
- include/grpcpp/impl/client_unary_call.h
- include/grpcpp/impl/codegen/async_generic_service.h
- include/grpcpp/impl/codegen/async_stream.h
@ -3161,6 +3162,7 @@ libs:
- include/grpcpp/impl/call_hook.h
- include/grpcpp/impl/call_op_set_interface.h
- include/grpcpp/impl/channel_argument_option.h
- include/grpcpp/impl/channel_interface.h
- include/grpcpp/impl/client_unary_call.h
- include/grpcpp/impl/codegen/async_generic_service.h
- include/grpcpp/impl/codegen/async_stream.h

1
gRPC-C++.podspec generated

@ -97,6 +97,7 @@ Pod::Spec.new do |s|
'include/grpcpp/impl/call_hook.h',
'include/grpcpp/impl/call_op_set_interface.h',
'include/grpcpp/impl/channel_argument_option.h',
'include/grpcpp/impl/channel_interface.h',
'include/grpcpp/impl/client_unary_call.h',
'include/grpcpp/impl/codegen/async_generic_service.h',
'include/grpcpp/impl/codegen/async_stream.h',

@ -24,7 +24,7 @@
#include <grpc/grpc.h>
#include <grpcpp/completion_queue.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/codegen/channel_interface.h>
#include <grpcpp/impl/channel_interface.h>
#include <grpcpp/impl/codegen/grpc_library.h>
#include <grpcpp/impl/codegen/sync.h>
#include <grpcpp/support/client_interceptor.h>

@ -0,0 +1,170 @@
/*
*
* Copyright 2016 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_CHANNEL_INTERFACE_H
#define GRPCPP_IMPL_CHANNEL_INTERFACE_H
#include <grpc/impl/codegen/connectivity_state.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/support/status.h>
#include <grpcpp/support/time.h>
namespace grpc {
template <class R>
class ClientReader;
template <class W>
class ClientWriter;
template <class W, class R>
class ClientReaderWriter;
namespace internal {
template <class InputMessage, class OutputMessage>
class CallbackUnaryCallImpl;
template <class R>
class ClientAsyncReaderFactory;
template <class W>
class ClientAsyncWriterFactory;
template <class W, class R>
class ClientAsyncReaderWriterFactory;
class ClientAsyncResponseReaderHelper;
template <class W, class R>
class ClientCallbackReaderWriterFactory;
template <class R>
class ClientCallbackReaderFactory;
template <class W>
class ClientCallbackWriterFactory;
class ClientCallbackUnaryFactory;
} // namespace internal
class ChannelInterface;
class ClientContext;
class CompletionQueue;
namespace experimental {
class DelegatingChannel;
}
namespace internal {
class Call;
class CallOpSetInterface;
class RpcMethod;
class InterceptedChannel;
template <class InputMessage, class OutputMessage>
class BlockingUnaryCallImpl;
} // namespace internal
/// Codegen interface for \a grpc::Channel.
class ChannelInterface {
public:
virtual ~ChannelInterface() {}
/// Get the current channel state. If the channel is in IDLE and
/// \a try_to_connect is set to true, try to connect.
virtual grpc_connectivity_state GetState(bool try_to_connect) = 0;
/// Return the \a tag on \a cq when the channel state is changed or \a
/// deadline expires. \a GetState needs to called to get the current state.
template <typename T>
void NotifyOnStateChange(grpc_connectivity_state last_observed, T deadline,
grpc::CompletionQueue* cq, void* tag) {
TimePoint<T> deadline_tp(deadline);
NotifyOnStateChangeImpl(last_observed, deadline_tp.raw_time(), cq, tag);
}
/// Blocking wait for channel state change or \a deadline expiration.
/// \a GetState needs to called to get the current state.
template <typename T>
bool WaitForStateChange(grpc_connectivity_state last_observed, T deadline) {
TimePoint<T> deadline_tp(deadline);
return WaitForStateChangeImpl(last_observed, deadline_tp.raw_time());
}
/// Wait for this channel to be connected
template <typename T>
bool WaitForConnected(T deadline) {
grpc_connectivity_state state;
while ((state = GetState(true)) != GRPC_CHANNEL_READY) {
if (!WaitForStateChange(state, deadline)) return false;
}
return true;
}
private:
template <class R>
friend class grpc::ClientReader;
template <class W>
friend class grpc::ClientWriter;
template <class W, class R>
friend class grpc::ClientReaderWriter;
template <class R>
friend class grpc::internal::ClientAsyncReaderFactory;
template <class W>
friend class grpc::internal::ClientAsyncWriterFactory;
template <class W, class R>
friend class grpc::internal::ClientAsyncReaderWriterFactory;
friend class grpc::internal::ClientAsyncResponseReaderHelper;
template <class W, class R>
friend class grpc::internal::ClientCallbackReaderWriterFactory;
template <class R>
friend class grpc::internal::ClientCallbackReaderFactory;
template <class W>
friend class grpc::internal::ClientCallbackWriterFactory;
friend class grpc::internal::ClientCallbackUnaryFactory;
template <class InputMessage, class OutputMessage>
friend class grpc::internal::BlockingUnaryCallImpl;
template <class InputMessage, class OutputMessage>
friend class grpc::internal::CallbackUnaryCallImpl;
friend class grpc::internal::RpcMethod;
friend class grpc::experimental::DelegatingChannel;
friend class grpc::internal::InterceptedChannel;
virtual internal::Call CreateCall(const internal::RpcMethod& method,
grpc::ClientContext* context,
grpc::CompletionQueue* cq) = 0;
virtual void PerformOpsOnCall(internal::CallOpSetInterface* ops,
internal::Call* call) = 0;
virtual void* RegisterMethod(const char* method) = 0;
virtual void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline,
grpc::CompletionQueue* cq,
void* tag) = 0;
virtual bool WaitForStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline) = 0;
// EXPERIMENTAL
// This is needed to keep codegen_test_minimal happy. InterceptedChannel needs
// to make use of this but can't directly call Channel's implementation
// because of the test.
// Returns an empty Call object (rather than being pure) since this is a new
// method and adding a new pure method to an interface would be a breaking
// change (even though this is private and non-API)
virtual internal::Call CreateCallInternal(
const internal::RpcMethod& /*method*/, grpc::ClientContext* /*context*/,
grpc::CompletionQueue* /*cq*/, size_t /*interceptor_pos*/) {
return internal::Call();
}
// A method to get the callbackable completion queue associated with this
// channel. If the return value is nullptr, this channel doesn't support
// callback operations.
// TODO(vjpai): Consider a better default like using a global CQ
// Returns nullptr (rather than being pure) since this is a post-1.0 method
// and adding a new pure method to an interface would be a breaking change
// (even though this is private and non-API)
virtual grpc::CompletionQueue* CallbackCQ() { return nullptr; }
};
} // namespace grpc
#endif // GRPCPP_IMPL_CHANNEL_INTERFACE_H

@ -20,8 +20,8 @@
#define GRPCPP_IMPL_CLIENT_UNARY_CALL_H
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/channel_interface.h>
#include <grpcpp/impl/codegen/call_op_set.h>
#include <grpcpp/impl/codegen/channel_interface.h>
#include <grpcpp/impl/codegen/core_codegen_interface.h>
#include <grpcpp/support/config.h>
#include <grpcpp/support/status.h>

@ -21,152 +21,7 @@
// IWYU pragma: private
#include <grpc/impl/codegen/connectivity_state.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/codegen/status.h>
#include <grpcpp/impl/codegen/time.h>
namespace grpc {
template <class R>
class ClientReader;
template <class W>
class ClientWriter;
template <class W, class R>
class ClientReaderWriter;
namespace internal {
template <class InputMessage, class OutputMessage>
class CallbackUnaryCallImpl;
template <class R>
class ClientAsyncReaderFactory;
template <class W>
class ClientAsyncWriterFactory;
template <class W, class R>
class ClientAsyncReaderWriterFactory;
class ClientAsyncResponseReaderHelper;
template <class W, class R>
class ClientCallbackReaderWriterFactory;
template <class R>
class ClientCallbackReaderFactory;
template <class W>
class ClientCallbackWriterFactory;
class ClientCallbackUnaryFactory;
} // namespace internal
class ChannelInterface;
class ClientContext;
class CompletionQueue;
namespace experimental {
class DelegatingChannel;
}
namespace internal {
class Call;
class CallOpSetInterface;
class RpcMethod;
class InterceptedChannel;
template <class InputMessage, class OutputMessage>
class BlockingUnaryCallImpl;
} // namespace internal
/// Codegen interface for \a grpc::Channel.
class ChannelInterface {
public:
virtual ~ChannelInterface() {}
/// Get the current channel state. If the channel is in IDLE and
/// \a try_to_connect is set to true, try to connect.
virtual grpc_connectivity_state GetState(bool try_to_connect) = 0;
/// Return the \a tag on \a cq when the channel state is changed or \a
/// deadline expires. \a GetState needs to called to get the current state.
template <typename T>
void NotifyOnStateChange(grpc_connectivity_state last_observed, T deadline,
grpc::CompletionQueue* cq, void* tag) {
TimePoint<T> deadline_tp(deadline);
NotifyOnStateChangeImpl(last_observed, deadline_tp.raw_time(), cq, tag);
}
/// Blocking wait for channel state change or \a deadline expiration.
/// \a GetState needs to called to get the current state.
template <typename T>
bool WaitForStateChange(grpc_connectivity_state last_observed, T deadline) {
TimePoint<T> deadline_tp(deadline);
return WaitForStateChangeImpl(last_observed, deadline_tp.raw_time());
}
/// Wait for this channel to be connected
template <typename T>
bool WaitForConnected(T deadline) {
grpc_connectivity_state state;
while ((state = GetState(true)) != GRPC_CHANNEL_READY) {
if (!WaitForStateChange(state, deadline)) return false;
}
return true;
}
private:
template <class R>
friend class grpc::ClientReader;
template <class W>
friend class grpc::ClientWriter;
template <class W, class R>
friend class grpc::ClientReaderWriter;
template <class R>
friend class grpc::internal::ClientAsyncReaderFactory;
template <class W>
friend class grpc::internal::ClientAsyncWriterFactory;
template <class W, class R>
friend class grpc::internal::ClientAsyncReaderWriterFactory;
friend class grpc::internal::ClientAsyncResponseReaderHelper;
template <class W, class R>
friend class grpc::internal::ClientCallbackReaderWriterFactory;
template <class R>
friend class grpc::internal::ClientCallbackReaderFactory;
template <class W>
friend class grpc::internal::ClientCallbackWriterFactory;
friend class grpc::internal::ClientCallbackUnaryFactory;
template <class InputMessage, class OutputMessage>
friend class grpc::internal::BlockingUnaryCallImpl;
template <class InputMessage, class OutputMessage>
friend class grpc::internal::CallbackUnaryCallImpl;
friend class grpc::internal::RpcMethod;
friend class grpc::experimental::DelegatingChannel;
friend class grpc::internal::InterceptedChannel;
virtual internal::Call CreateCall(const internal::RpcMethod& method,
grpc::ClientContext* context,
grpc::CompletionQueue* cq) = 0;
virtual void PerformOpsOnCall(internal::CallOpSetInterface* ops,
internal::Call* call) = 0;
virtual void* RegisterMethod(const char* method) = 0;
virtual void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline,
grpc::CompletionQueue* cq,
void* tag) = 0;
virtual bool WaitForStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline) = 0;
// EXPERIMENTAL
// This is needed to keep codegen_test_minimal happy. InterceptedChannel needs
// to make use of this but can't directly call Channel's implementation
// because of the test.
// Returns an empty Call object (rather than being pure) since this is a new
// method and adding a new pure method to an interface would be a breaking
// change (even though this is private and non-API)
virtual internal::Call CreateCallInternal(
const internal::RpcMethod& /*method*/, grpc::ClientContext* /*context*/,
grpc::CompletionQueue* /*cq*/, size_t /*interceptor_pos*/) {
return internal::Call();
}
// A method to get the callbackable completion queue associated with this
// channel. If the return value is nullptr, this channel doesn't support
// callback operations.
// TODO(vjpai): Consider a better default like using a global CQ
// Returns nullptr (rather than being pure) since this is a post-1.0 method
// and adding a new pure method to an interface would be a breaking change
// (even though this is private and non-API)
virtual grpc::CompletionQueue* CallbackCQ() { return nullptr; }
};
} // namespace grpc
/// TODO(chengyuc): Remove this file after solving compatibility.
#include <grpcpp/impl/channel_interface.h>
#endif // GRPCPP_IMPL_CODEGEN_CHANNEL_INTERFACE_H

@ -21,7 +21,7 @@
#include <grpc/grpc.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/codegen/channel_interface.h>
#include <grpcpp/impl/channel_interface.h>
#include <grpcpp/impl/codegen/core_codegen_interface.h>
#include <grpcpp/impl/service_type.h>
#include <grpcpp/server_context.h>

@ -23,8 +23,8 @@
#include <grpcpp/client_context.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/call_op_set_interface.h>
#include <grpcpp/impl/channel_interface.h>
#include <grpcpp/impl/codegen/call_op_set.h>
#include <grpcpp/impl/codegen/channel_interface.h>
#include <grpcpp/impl/codegen/core_codegen_interface.h>
#include <grpcpp/impl/service_type.h>
#include <grpcpp/server_context.h>

@ -23,9 +23,9 @@
#include <functional>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/channel_interface.h>
#include <grpcpp/impl/codegen/call_op_set.h>
#include <grpcpp/impl/codegen/callback_common.h>
#include <grpcpp/impl/codegen/channel_interface.h>
#include <grpcpp/impl/codegen/core_codegen_interface.h>
#include <grpcpp/impl/codegen/sync.h>
#include <grpcpp/support/config.h>

@ -1650,7 +1650,7 @@ std::string GetSourceIncludes(grpc_generator::File* file,
"functional",
"grpcpp/support/async_stream.h",
"grpcpp/support/async_unary_call.h",
"grpcpp/impl/codegen/channel_interface.h",
"grpcpp/impl/channel_interface.h",
"grpcpp/impl/client_unary_call.h",
"grpcpp/support/client_callback.h",
"grpcpp/support/message_allocator.h",

@ -958,6 +958,7 @@ include/grpcpp/impl/call.h \
include/grpcpp/impl/call_hook.h \
include/grpcpp/impl/call_op_set_interface.h \
include/grpcpp/impl/channel_argument_option.h \
include/grpcpp/impl/channel_interface.h \
include/grpcpp/impl/client_unary_call.h \
include/grpcpp/impl/codegen/async_generic_service.h \
include/grpcpp/impl/codegen/async_stream.h \

@ -958,6 +958,7 @@ include/grpcpp/impl/call.h \
include/grpcpp/impl/call_hook.h \
include/grpcpp/impl/call_op_set_interface.h \
include/grpcpp/impl/channel_argument_option.h \
include/grpcpp/impl/channel_interface.h \
include/grpcpp/impl/client_unary_call.h \
include/grpcpp/impl/codegen/async_generic_service.h \
include/grpcpp/impl/codegen/async_stream.h \

Loading…
Cancel
Save