diff options
64 files changed, 296 insertions, 343 deletions
@@ -675,7 +675,7 @@ cc_library( "src/cpp/client/secure_credentials.h", "src/cpp/common/secure_auth_context.h", "src/cpp/server/secure_server_credentials.h", - "src/cpp/client/channel.h", + "src/cpp/client/create_channel_internal.h", "src/cpp/common/create_auth_context.h", "src/cpp/server/dynamic_thread_pool.h", "src/cpp/server/fixed_size_thread_pool.h", @@ -690,10 +690,10 @@ cc_library( "src/cpp/client/channel_arguments.cc", "src/cpp/client/client_context.cc", "src/cpp/client/create_channel.cc", + "src/cpp/client/create_channel_internal.cc", "src/cpp/client/credentials.cc", "src/cpp/client/generic_stub.cc", "src/cpp/client/insecure_credentials.cc", - "src/cpp/client/internal_stub.cc", "src/cpp/common/call.cc", "src/cpp/common/completion_queue.cc", "src/cpp/common/rpc_method.cc", @@ -717,8 +717,8 @@ cc_library( "include/grpc++/async_unary_call.h", "include/grpc++/auth_context.h", "include/grpc++/byte_buffer.h", + "include/grpc++/channel.h", "include/grpc++/channel_arguments.h", - "include/grpc++/channel_interface.h", "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", "include/grpc++/config.h", @@ -729,7 +729,6 @@ cc_library( "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/grpc_library.h", - "include/grpc++/impl/internal_stub.h", "include/grpc++/impl/proto_utils.h", "include/grpc++/impl/rpc_method.h", "include/grpc++/impl/rpc_service_method.h", @@ -767,7 +766,7 @@ cc_library( cc_library( name = "grpc++_unsecure", srcs = [ - "src/cpp/client/channel.h", + "src/cpp/client/create_channel_internal.h", "src/cpp/common/create_auth_context.h", "src/cpp/server/dynamic_thread_pool.h", "src/cpp/server/fixed_size_thread_pool.h", @@ -777,10 +776,10 @@ cc_library( "src/cpp/client/channel_arguments.cc", "src/cpp/client/client_context.cc", "src/cpp/client/create_channel.cc", + "src/cpp/client/create_channel_internal.cc", "src/cpp/client/credentials.cc", "src/cpp/client/generic_stub.cc", "src/cpp/client/insecure_credentials.cc", - "src/cpp/client/internal_stub.cc", "src/cpp/common/call.cc", "src/cpp/common/completion_queue.cc", "src/cpp/common/rpc_method.cc", @@ -804,8 +803,8 @@ cc_library( "include/grpc++/async_unary_call.h", "include/grpc++/auth_context.h", "include/grpc++/byte_buffer.h", + "include/grpc++/channel.h", "include/grpc++/channel_arguments.h", - "include/grpc++/channel_interface.h", "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", "include/grpc++/config.h", @@ -816,7 +815,6 @@ cc_library( "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/grpc_library.h", - "include/grpc++/impl/internal_stub.h", "include/grpc++/impl/proto_utils.h", "include/grpc++/impl/rpc_method.h", "include/grpc++/impl/rpc_service_method.h", @@ -4603,10 +4603,10 @@ LIBGRPC++_SRC = \ src/cpp/client/channel_arguments.cc \ src/cpp/client/client_context.cc \ src/cpp/client/create_channel.cc \ + src/cpp/client/create_channel_internal.cc \ src/cpp/client/credentials.cc \ src/cpp/client/generic_stub.cc \ src/cpp/client/insecure_credentials.cc \ - src/cpp/client/internal_stub.cc \ src/cpp/common/call.cc \ src/cpp/common/completion_queue.cc \ src/cpp/common/rpc_method.cc \ @@ -4630,8 +4630,8 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/async_unary_call.h \ include/grpc++/auth_context.h \ include/grpc++/byte_buffer.h \ + include/grpc++/channel.h \ include/grpc++/channel_arguments.h \ - include/grpc++/channel_interface.h \ include/grpc++/client_context.h \ include/grpc++/completion_queue.h \ include/grpc++/config.h \ @@ -4642,7 +4642,6 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ include/grpc++/impl/grpc_library.h \ - include/grpc++/impl/internal_stub.h \ include/grpc++/impl/proto_utils.h \ include/grpc++/impl/rpc_method.h \ include/grpc++/impl/rpc_service_method.h \ @@ -4843,10 +4842,10 @@ LIBGRPC++_UNSECURE_SRC = \ src/cpp/client/channel_arguments.cc \ src/cpp/client/client_context.cc \ src/cpp/client/create_channel.cc \ + src/cpp/client/create_channel_internal.cc \ src/cpp/client/credentials.cc \ src/cpp/client/generic_stub.cc \ src/cpp/client/insecure_credentials.cc \ - src/cpp/client/internal_stub.cc \ src/cpp/common/call.cc \ src/cpp/common/completion_queue.cc \ src/cpp/common/rpc_method.cc \ @@ -4870,8 +4869,8 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/async_unary_call.h \ include/grpc++/auth_context.h \ include/grpc++/byte_buffer.h \ + include/grpc++/channel.h \ include/grpc++/channel_arguments.h \ - include/grpc++/channel_interface.h \ include/grpc++/client_context.h \ include/grpc++/completion_queue.h \ include/grpc++/config.h \ @@ -4882,7 +4881,6 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ include/grpc++/impl/grpc_library.h \ - include/grpc++/impl/internal_stub.h \ include/grpc++/impl/proto_utils.h \ include/grpc++/impl/rpc_method.h \ include/grpc++/impl/rpc_service_method.h \ diff --git a/build.json b/build.json index 96d45f312b..b17b332443 100644 --- a/build.json +++ b/build.json @@ -34,8 +34,8 @@ "include/grpc++/async_unary_call.h", "include/grpc++/auth_context.h", "include/grpc++/byte_buffer.h", + "include/grpc++/channel.h", "include/grpc++/channel_arguments.h", - "include/grpc++/channel_interface.h", "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", "include/grpc++/config.h", @@ -46,7 +46,6 @@ "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/grpc_library.h", - "include/grpc++/impl/internal_stub.h", "include/grpc++/impl/proto_utils.h", "include/grpc++/impl/rpc_method.h", "include/grpc++/impl/rpc_service_method.h", @@ -70,7 +69,7 @@ "include/grpc++/time.h" ], "headers": [ - "src/cpp/client/channel.h", + "src/cpp/client/create_channel_internal.h", "src/cpp/common/create_auth_context.h", "src/cpp/server/dynamic_thread_pool.h", "src/cpp/server/fixed_size_thread_pool.h", @@ -81,10 +80,10 @@ "src/cpp/client/channel_arguments.cc", "src/cpp/client/client_context.cc", "src/cpp/client/create_channel.cc", + "src/cpp/client/create_channel_internal.cc", "src/cpp/client/credentials.cc", "src/cpp/client/generic_stub.cc", "src/cpp/client/insecure_credentials.cc", - "src/cpp/client/internal_stub.cc", "src/cpp/common/call.cc", "src/cpp/common/completion_queue.cc", "src/cpp/common/rpc_method.cc", diff --git a/examples/pubsub/main.cc b/examples/pubsub/main.cc index b1898f18d9..fcee3b316b 100644 --- a/examples/pubsub/main.cc +++ b/examples/pubsub/main.cc @@ -41,7 +41,7 @@ #include <grpc/support/log.h> #include <gflags/gflags.h> #include <grpc++/channel_arguments.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> #include <grpc++/status.h> @@ -72,7 +72,7 @@ int main(int argc, char** argv) { ss << FLAGS_server_host << ":" << FLAGS_server_port; std::shared_ptr<grpc::Credentials> creds = grpc::GoogleDefaultCredentials(); - std::shared_ptr<grpc::ChannelInterface> channel = + std::shared_ptr<grpc::Channel> channel = grpc::CreateChannel(ss.str(), creds, grpc::ChannelArguments()); grpc::examples::pubsub::Publisher publisher(channel); diff --git a/examples/pubsub/publisher.cc b/examples/pubsub/publisher.cc index 458050af73..fd38ca92ed 100644 --- a/examples/pubsub/publisher.cc +++ b/examples/pubsub/publisher.cc @@ -50,7 +50,7 @@ namespace grpc { namespace examples { namespace pubsub { -Publisher::Publisher(std::shared_ptr<ChannelInterface> channel) +Publisher::Publisher(std::shared_ptr<Channel> channel) : stub_(PublisherService::NewStub(channel)) {} void Publisher::Shutdown() { stub_.reset(); } diff --git a/examples/pubsub/publisher.h b/examples/pubsub/publisher.h index 33bcf98df4..b98e6973dc 100644 --- a/examples/pubsub/publisher.h +++ b/examples/pubsub/publisher.h @@ -34,7 +34,7 @@ #ifndef GRPC_EXAMPLES_PUBSUB_PUBLISHER_H #define GRPC_EXAMPLES_PUBSUB_PUBLISHER_H -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/status.h> #include "examples/pubsub/pubsub.grpc.pb.h" @@ -45,7 +45,7 @@ namespace pubsub { class Publisher { public: - Publisher(std::shared_ptr<ChannelInterface> channel); + Publisher(std::shared_ptr<Channel> channel); void Shutdown(); Status CreateTopic(const grpc::string& topic); diff --git a/examples/pubsub/publisher_test.cc b/examples/pubsub/publisher_test.cc index 6b9dcacc49..972b426e64 100644 --- a/examples/pubsub/publisher_test.cc +++ b/examples/pubsub/publisher_test.cc @@ -32,7 +32,7 @@ */ #include <grpc++/channel_arguments.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/server.h> @@ -46,7 +46,7 @@ #include "test/core/util/port.h" #include "test/core/util/test_config.h" -using grpc::ChannelInterface; +using grpc::Channel; namespace grpc { namespace testing { @@ -124,7 +124,7 @@ class PublisherTest : public ::testing::Test { std::unique_ptr<Server> server_; PublisherServiceImpl service_; - std::shared_ptr<ChannelInterface> channel_; + std::shared_ptr<Channel> channel_; std::unique_ptr<grpc::examples::pubsub::Publisher> publisher_; }; diff --git a/examples/pubsub/subscriber.cc b/examples/pubsub/subscriber.cc index d9e0292ba0..0818f501db 100644 --- a/examples/pubsub/subscriber.cc +++ b/examples/pubsub/subscriber.cc @@ -48,7 +48,7 @@ namespace grpc { namespace examples { namespace pubsub { -Subscriber::Subscriber(std::shared_ptr<ChannelInterface> channel) +Subscriber::Subscriber(std::shared_ptr<Channel> channel) : stub_(SubscriberService::NewStub(channel)) {} void Subscriber::Shutdown() { stub_.reset(); } diff --git a/examples/pubsub/subscriber.h b/examples/pubsub/subscriber.h index 40ab45471d..87c833102c 100644 --- a/examples/pubsub/subscriber.h +++ b/examples/pubsub/subscriber.h @@ -34,7 +34,7 @@ #ifndef GRPC_EXAMPLES_PUBSUB_SUBSCRIBER_H #define GRPC_EXAMPLES_PUBSUB_SUBSCRIBER_H -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/status.h> #include "examples/pubsub/pubsub.grpc.pb.h" @@ -45,7 +45,7 @@ namespace pubsub { class Subscriber { public: - Subscriber(std::shared_ptr<ChannelInterface> channel); + Subscriber(std::shared_ptr<Channel> channel); void Shutdown(); Status CreateSubscription(const grpc::string& topic, diff --git a/examples/pubsub/subscriber_test.cc b/examples/pubsub/subscriber_test.cc index b0e7fc034b..7974ca88c2 100644 --- a/examples/pubsub/subscriber_test.cc +++ b/examples/pubsub/subscriber_test.cc @@ -32,7 +32,7 @@ */ #include <grpc++/channel_arguments.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/server.h> @@ -122,7 +122,7 @@ class SubscriberTest : public ::testing::Test { std::unique_ptr<Server> server_; SubscriberServiceImpl service_; - std::shared_ptr<ChannelInterface> channel_; + std::shared_ptr<Channel> channel_; std::unique_ptr<grpc::examples::pubsub::Subscriber> subscriber_; }; diff --git a/include/grpc++/async_unary_call.h b/include/grpc++/async_unary_call.h index 3d22df4b33..4e1dd15f32 100644 --- a/include/grpc++/async_unary_call.h +++ b/include/grpc++/async_unary_call.h @@ -34,7 +34,7 @@ #ifndef GRPCXX_ASYNC_UNARY_CALL_H #define GRPCXX_ASYNC_UNARY_CALL_H -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/completion_queue.h> #include <grpc++/server_context.h> @@ -58,7 +58,7 @@ class ClientAsyncResponseReader GRPC_FINAL : public ClientAsyncResponseReaderInterface<R> { public: template <class W> - ClientAsyncResponseReader(ChannelInterface* channel, CompletionQueue* cq, + ClientAsyncResponseReader(Channel* channel, CompletionQueue* cq, const RpcMethod& method, ClientContext* context, const W& request) : context_(context), call_(channel->CreateCall(method, context, cq)) { diff --git a/include/grpc++/channel_interface.h b/include/grpc++/channel.h index 4176cded7b..7d6216e9c4 100644 --- a/include/grpc++/channel_interface.h +++ b/include/grpc++/channel.h @@ -31,36 +31,49 @@ * */ -#ifndef GRPCXX_CHANNEL_INTERFACE_H -#define GRPCXX_CHANNEL_INTERFACE_H +#ifndef GRPCXX_CHANNEL_H +#define GRPCXX_CHANNEL_H #include <memory> #include <grpc/grpc.h> -#include <grpc++/status.h> +#include <grpc++/config.h> #include <grpc++/impl/call.h> +#include <grpc++/impl/grpc_library.h> -struct grpc_call; +struct grpc_channel; namespace grpc { -class Call; -class CallOpBuffer; -class ClientContext; +class CallOpSetInterface; +class ChannelArguments; class CompletionQueue; -class RpcMethod; +class Credentials; +class SecureCredentials; -class ChannelInterface : public CallHook, - public std::enable_shared_from_this<ChannelInterface> { - public: - virtual ~ChannelInterface() {} +template <class R> +class ClientReader; +template <class W> +class ClientWriter; +template <class R, class W> +class ClientReaderWriter; +template <class R> +class ClientAsyncReader; +template <class W> +class ClientAsyncWriter; +template <class R, class W> +class ClientAsyncReaderWriter; +template <class R> +class ClientAsyncResponseReader; - virtual void* RegisterMethod(const char* method_name) = 0; - virtual Call CreateCall(const RpcMethod& method, ClientContext* context, - CompletionQueue* cq) = 0; +class Channel GRPC_FINAL : public GrpcLibrary, + public CallHook, + public std::enable_shared_from_this<Channel> { + public: + ~Channel(); // Get the current channel state. If the channel is in IDLE and try_to_connect // is set to true, try to connect. - virtual grpc_connectivity_state GetState(bool try_to_connect) = 0; + grpc_connectivity_state GetState(bool try_to_connect); // Return the tag on cq when the channel state is changed or deadline expires. // GetState needs to called to get the current state. @@ -80,13 +93,46 @@ class ChannelInterface : public CallHook, } private: - virtual void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed, - gpr_timespec deadline, - CompletionQueue* cq, void* tag) = 0; - virtual bool WaitForStateChangeImpl(grpc_connectivity_state last_observed, - gpr_timespec deadline) = 0; + template <class R> + friend class ::grpc::ClientReader; + template <class W> + friend class ::grpc::ClientWriter; + template <class R, class W> + friend class ::grpc::ClientReaderWriter; + template <class R> + friend class ::grpc::ClientAsyncReader; + template <class W> + friend class ::grpc::ClientAsyncWriter; + template <class R, class W> + friend class ::grpc::ClientAsyncReaderWriter; + template <class R> + friend class ::grpc::ClientAsyncResponseReader; + template <class InputMessage, class OutputMessage> + friend Status BlockingUnaryCall(Channel* channel, const RpcMethod& method, + ClientContext* context, + const InputMessage& request, + OutputMessage* result); + friend class ::grpc::RpcMethod; + friend std::shared_ptr<Channel> CreateChannelInternal( + const grpc::string& host, grpc_channel* c_channel); + + Channel(const grpc::string& host, grpc_channel* c_channel); + + Call CreateCall(const RpcMethod& method, ClientContext* context, + CompletionQueue* cq); + void PerformOpsOnCall(CallOpSetInterface* ops, Call* call); + void* RegisterMethod(const char* method); + + void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed, + gpr_timespec deadline, CompletionQueue* cq, + void* tag); + bool WaitForStateChangeImpl(grpc_connectivity_state last_observed, + gpr_timespec deadline); + + const grpc::string host_; + grpc_channel* const c_channel_; // owned }; } // namespace grpc -#endif // GRPCXX_CHANNEL_INTERFACE_H +#endif // GRPCXX_CHANNEL_H diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index 8de2ba4877..55ed17506a 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -51,7 +51,7 @@ struct census_context; namespace grpc { -class ChannelInterface; +class Channel; class CompletionQueue; class Credentials; class RpcMethod; @@ -215,20 +215,18 @@ class ClientContext { template <class R> friend class ::grpc::ClientAsyncResponseReader; template <class InputMessage, class OutputMessage> - friend Status BlockingUnaryCall(ChannelInterface* channel, - const RpcMethod& method, + friend Status BlockingUnaryCall(Channel* channel, const RpcMethod& method, ClientContext* context, const InputMessage& request, OutputMessage* result); grpc_call* call() { return call_; } - void set_call(grpc_call* call, - const std::shared_ptr<ChannelInterface>& channel); + void set_call(grpc_call* call, const std::shared_ptr<Channel>& channel); grpc::string authority() { return authority_; } bool initial_metadata_received_; - std::shared_ptr<ChannelInterface> channel_; + std::shared_ptr<Channel> channel_; grpc_call* call_; gpr_timespec deadline_; grpc::string authority_; diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index 2f30211145..061f4874fa 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -65,7 +65,7 @@ template <class ServiceType, class RequestType, class ResponseType> class BidiStreamingHandler; class UnknownMethodHandler; -class ChannelInterface; +class Channel; class ClientContext; class CompletionQueue; class RpcMethod; @@ -143,8 +143,7 @@ class CompletionQueue : public GrpcLibrary { friend class ::grpc::Server; friend class ::grpc::ServerContext; template <class InputMessage, class OutputMessage> - friend Status BlockingUnaryCall(ChannelInterface* channel, - const RpcMethod& method, + friend Status BlockingUnaryCall(Channel* channel, const RpcMethod& method, ClientContext* context, const InputMessage& request, OutputMessage* result); diff --git a/include/grpc++/create_channel.h b/include/grpc++/create_channel.h index 424a93a64c..fe34452128 100644 --- a/include/grpc++/create_channel.h +++ b/include/grpc++/create_channel.h @@ -41,10 +41,9 @@ namespace grpc { class ChannelArguments; -class ChannelInterface; // If creds does not hold an object or is invalid, a lame channel is returned. -std::shared_ptr<ChannelInterface> CreateChannel( +std::shared_ptr<Channel> CreateChannel( const grpc::string& target, const std::shared_ptr<Credentials>& creds, const ChannelArguments& args); diff --git a/include/grpc++/credentials.h b/include/grpc++/credentials.h index a4f1e73118..306dc961c0 100644 --- a/include/grpc++/credentials.h +++ b/include/grpc++/credentials.h @@ -41,7 +41,7 @@ namespace grpc { class ChannelArguments; -class ChannelInterface; +class Channel; class SecureCredentials; class Credentials : public GrpcLibrary { @@ -57,11 +57,11 @@ class Credentials : public GrpcLibrary { virtual SecureCredentials* AsSecureCredentials() = 0; private: - friend std::shared_ptr<ChannelInterface> CreateChannel( + friend std::shared_ptr<Channel> CreateChannel( const grpc::string& target, const std::shared_ptr<Credentials>& creds, const ChannelArguments& args); - virtual std::shared_ptr<ChannelInterface> CreateChannel( + virtual std::shared_ptr<Channel> CreateChannel( const grpc::string& target, const ChannelArguments& args) = 0; }; diff --git a/include/grpc++/generic_stub.h b/include/grpc++/generic_stub.h index 172f10e45a..734440881e 100644 --- a/include/grpc++/generic_stub.h +++ b/include/grpc++/generic_stub.h @@ -47,8 +47,7 @@ typedef ClientAsyncReaderWriter<ByteBuffer, ByteBuffer> // by name. class GenericStub GRPC_FINAL { public: - explicit GenericStub(std::shared_ptr<ChannelInterface> channel) - : channel_(channel) {} + explicit GenericStub(std::shared_ptr<Channel> channel) : channel_(channel) {} // begin a call to a named method std::unique_ptr<GenericClientAsyncReaderWriter> Call( @@ -56,7 +55,7 @@ class GenericStub GRPC_FINAL { void* tag); private: - std::shared_ptr<ChannelInterface> channel_; + std::shared_ptr<Channel> channel_; }; } // namespace grpc diff --git a/include/grpc++/impl/client_unary_call.h b/include/grpc++/impl/client_unary_call.h index b77ce7d02c..4aae816cd7 100644 --- a/include/grpc++/impl/client_unary_call.h +++ b/include/grpc++/impl/client_unary_call.h @@ -41,14 +41,14 @@ namespace grpc { -class ChannelInterface; +class Channel; class ClientContext; class CompletionQueue; class RpcMethod; // Wrapper that performs a blocking unary call template <class InputMessage, class OutputMessage> -Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method, +Status BlockingUnaryCall(Channel* channel, const RpcMethod& method, ClientContext* context, const InputMessage& request, OutputMessage* result) { CompletionQueue cq; diff --git a/include/grpc++/impl/rpc_method.h b/include/grpc++/impl/rpc_method.h index 50a160b08c..9800268062 100644 --- a/include/grpc++/impl/rpc_method.h +++ b/include/grpc++/impl/rpc_method.h @@ -34,6 +34,10 @@ #ifndef GRPCXX_IMPL_RPC_METHOD_H #define GRPCXX_IMPL_RPC_METHOD_H +#include <memory> + +#include <grpc++/channel.h> + namespace grpc { class RpcMethod { @@ -45,8 +49,14 @@ class RpcMethod { BIDI_STREAMING }; - RpcMethod(const char* name, RpcType type, void* channel_tag) - : name_(name), method_type_(type), channel_tag_(channel_tag) {} + RpcMethod(const char* name, RpcType type) + : name_(name), method_type_(type), channel_tag_(NULL) {} + + RpcMethod(const char* name, RpcType type, + const std::shared_ptr<Channel>& channel) + : name_(name), + method_type_(type), + channel_tag_(channel->RegisterMethod(name)) {} const char* name() const { return name_; } RpcType method_type() const { return method_type_; } diff --git a/include/grpc++/impl/rpc_service_method.h b/include/grpc++/impl/rpc_service_method.h index c02ebec19e..9dbb485078 100644 --- a/include/grpc++/impl/rpc_service_method.h +++ b/include/grpc++/impl/rpc_service_method.h @@ -235,7 +235,7 @@ class RpcServiceMethod : public RpcMethod { // Takes ownership of the handler RpcServiceMethod(const char* name, RpcMethod::RpcType type, MethodHandler* handler) - : RpcMethod(name, type, nullptr), handler_(handler) {} + : RpcMethod(name, type), handler_(handler) {} MethodHandler* handler() { return handler_.get(); } diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 4bffaffb40..dd9508255f 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -34,7 +34,7 @@ #ifndef GRPCXX_STREAM_H #define GRPCXX_STREAM_H -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/completion_queue.h> #include <grpc++/server_context.h> @@ -100,7 +100,7 @@ class ClientReader GRPC_FINAL : public ClientReaderInterface<R> { public: // Blocking create a stream and write the first request out. template <class W> - ClientReader(ChannelInterface* channel, const RpcMethod& method, + ClientReader(Channel* channel, const RpcMethod& method, ClientContext* context, const W& request) : context_(context), call_(channel->CreateCall(method, context, &cq_)) { CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, @@ -163,7 +163,7 @@ class ClientWriter : public ClientWriterInterface<W> { public: // Blocking create a stream. template <class R> - ClientWriter(ChannelInterface* channel, const RpcMethod& method, + ClientWriter(Channel* channel, const RpcMethod& method, ClientContext* context, R* response) : context_(context), call_(channel->CreateCall(method, context, &cq_)) { finish_ops_.RecvMessage(response); @@ -221,7 +221,7 @@ template <class W, class R> class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface<W, R> { public: // Blocking create a stream. - ClientReaderWriter(ChannelInterface* channel, const RpcMethod& method, + ClientReaderWriter(Channel* channel, const RpcMethod& method, ClientContext* context) : context_(context), call_(channel->CreateCall(method, context, &cq_)) { CallOpSet<CallOpSendInitialMetadata> ops; @@ -425,7 +425,7 @@ class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface<R> { public: // Create a stream and write the first request out. template <class W> - ClientAsyncReader(ChannelInterface* channel, CompletionQueue* cq, + ClientAsyncReader(Channel* channel, CompletionQueue* cq, const RpcMethod& method, ClientContext* context, const W& request, void* tag) : context_(context), call_(channel->CreateCall(method, context, cq)) { @@ -484,7 +484,7 @@ template <class W> class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface<W> { public: template <class R> - ClientAsyncWriter(ChannelInterface* channel, CompletionQueue* cq, + ClientAsyncWriter(Channel* channel, CompletionQueue* cq, const RpcMethod& method, ClientContext* context, R* response, void* tag) : context_(context), call_(channel->CreateCall(method, context, cq)) { @@ -549,7 +549,7 @@ template <class W, class R> class ClientAsyncReaderWriter GRPC_FINAL : public ClientAsyncReaderWriterInterface<W, R> { public: - ClientAsyncReaderWriter(ChannelInterface* channel, CompletionQueue* cq, + ClientAsyncReaderWriter(Channel* channel, CompletionQueue* cq, const RpcMethod& method, ClientContext* context, void* tag) : context_(context), call_(channel->CreateCall(method, context, cq)) { diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index ea487bcd89..b04ac038ad 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -112,7 +112,6 @@ grpc::string GetHeaderPrologue(const grpc::protobuf::FileDescriptor *file, grpc::string GetHeaderIncludes(const grpc::protobuf::FileDescriptor *file, const Parameters ¶ms) { grpc::string temp = - "#include <grpc++/impl/internal_stub.h>\n" "#include <grpc++/impl/rpc_method.h>\n" "#include <grpc++/impl/proto_utils.h>\n" "#include <grpc++/impl/service_type.h>\n" @@ -123,7 +122,7 @@ grpc::string GetHeaderIncludes(const grpc::protobuf::FileDescriptor *file, "\n" "namespace grpc {\n" "class CompletionQueue;\n" - "class ChannelInterface;\n" + "class Channel;\n" "class RpcService;\n" "class ServerCompletionQueue;\n" "class ServerContext;\n" @@ -554,17 +553,17 @@ void PrintHeaderService(grpc::protobuf::io::Printer *printer, printer->Outdent(); printer->Print("};\n"); printer->Print( - "class Stub GRPC_FINAL : public StubInterface," - " public ::grpc::InternalStub {\n public:\n"); + "class Stub GRPC_FINAL : public StubInterface" + " {\n public:\n"); printer->Indent(); - printer->Print( - "Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel);\n"); + printer->Print("Stub(const std::shared_ptr< ::grpc::Channel>& channel);\n"); for (int i = 0; i < service->method_count(); ++i) { PrintHeaderClientMethod(printer, service->method(i), vars, true); } printer->Outdent(); printer->Print("\n private:\n"); printer->Indent(); + printer->Print("std::shared_ptr< ::grpc::Channel> channel_;\n"); for (int i = 0; i < service->method_count(); ++i) { PrintHeaderClientMethod(printer, service->method(i), vars, false); } @@ -575,7 +574,7 @@ void PrintHeaderService(grpc::protobuf::io::Printer *printer, printer->Print("};\n"); printer->Print( "static std::unique_ptr<Stub> NewStub(const std::shared_ptr< " - "::grpc::ChannelInterface>& channel, " + "::grpc::Channel>& channel, " "const ::grpc::StubOptions& options = ::grpc::StubOptions());\n"); printer->Print("\n"); @@ -703,7 +702,7 @@ grpc::string GetSourceIncludes(const grpc::protobuf::FileDescriptor *file, std::map<grpc::string, grpc::string> vars; printer.Print(vars, "#include <grpc++/async_unary_call.h>\n"); - printer.Print(vars, "#include <grpc++/channel_interface.h>\n"); + printer.Print(vars, "#include <grpc++/channel.h>\n"); printer.Print(vars, "#include <grpc++/impl/client_unary_call.h>\n"); printer.Print(vars, "#include <grpc++/impl/rpc_service_method.h>\n"); printer.Print(vars, "#include <grpc++/impl/service_type.h>\n"); @@ -738,7 +737,7 @@ void PrintSourceClientMethod(grpc::protobuf::io::Printer *printer, "::grpc::ClientContext* context, " "const $Request$& request, $Response$* response) {\n"); printer->Print(*vars, - " return ::grpc::BlockingUnaryCall(channel(), " + " return ::grpc::BlockingUnaryCall(channel_.get(), " "rpcmethod_$Method$_, " "context, request, response);\n" "}\n\n"); @@ -751,7 +750,7 @@ void PrintSourceClientMethod(grpc::protobuf::io::Printer *printer, printer->Print(*vars, " return new " "::grpc::ClientAsyncResponseReader< $Response$>(" - "channel(), cq, " + "channel_.get(), cq, " "rpcmethod_$Method$_, " "context, request);\n" "}\n\n"); @@ -762,7 +761,7 @@ void PrintSourceClientMethod(grpc::protobuf::io::Printer *printer, "::grpc::ClientContext* context, $Response$* response) {\n"); printer->Print(*vars, " return new ::grpc::ClientWriter< $Request$>(" - "channel(), " + "channel_.get(), " "rpcmethod_$Method$_, " "context, response);\n" "}\n\n"); @@ -773,7 +772,7 @@ void PrintSourceClientMethod(grpc::protobuf::io::Printer *printer, "::grpc::CompletionQueue* cq, void* tag) {\n"); printer->Print(*vars, " return new ::grpc::ClientAsyncWriter< $Request$>(" - "channel(), cq, " + "channel_.get(), cq, " "rpcmethod_$Method$_, " "context, response, tag);\n" "}\n\n"); @@ -785,7 +784,7 @@ void PrintSourceClientMethod(grpc::protobuf::io::Printer *printer, "::grpc::ClientContext* context, const $Request$& request) {\n"); printer->Print(*vars, " return new ::grpc::ClientReader< $Response$>(" - "channel(), " + "channel_.get(), " "rpcmethod_$Method$_, " "context, request);\n" "}\n\n"); @@ -796,7 +795,7 @@ void PrintSourceClientMethod(grpc::protobuf::io::Printer *printer, "::grpc::CompletionQueue* cq, void* tag) {\n"); printer->Print(*vars, " return new ::grpc::ClientAsyncReader< $Response$>(" - "channel(), cq, " + "channel_.get(), cq, " "rpcmethod_$Method$_, " "context, request, tag);\n" "}\n\n"); @@ -808,7 +807,7 @@ void PrintSourceClientMethod(grpc::protobuf::io::Printer *printer, printer->Print(*vars, " return new ::grpc::ClientReaderWriter< " "$Request$, $Response$>(" - "channel(), " + "channel_.get(), " "rpcmethod_$Method$_, " "context);\n" "}\n\n"); @@ -820,7 +819,7 @@ void PrintSourceClientMethod(grpc::protobuf::io::Printer *printer, printer->Print(*vars, " return new " "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>(" - "channel(), cq, " + "channel_.get(), cq, " "rpcmethod_$Method$_, " "context, tag);\n" "}\n\n"); @@ -964,20 +963,19 @@ void PrintSourceService(grpc::protobuf::io::Printer *printer, } printer->Print(*vars, "};\n\n"); - printer->Print( - *vars, - "std::unique_ptr< $ns$$Service$::Stub> $ns$$Service$::NewStub(" - "const std::shared_ptr< ::grpc::ChannelInterface>& channel, " - "const ::grpc::StubOptions& options) {\n" - " std::unique_ptr< $ns$$Service$::Stub> stub(new " - "$ns$$Service$::Stub(channel));\n" - " return stub;\n" - "}\n\n"); + printer->Print(*vars, + "std::unique_ptr< $ns$$Service$::Stub> $ns$$Service$::NewStub(" + "const std::shared_ptr< ::grpc::Channel>& channel, " + "const ::grpc::StubOptions& options) {\n" + " std::unique_ptr< $ns$$Service$::Stub> stub(new " + "$ns$$Service$::Stub(channel));\n" + " return stub;\n" + "}\n\n"); printer->Print(*vars, "$ns$$Service$::Stub::Stub(const std::shared_ptr< " - "::grpc::ChannelInterface>& channel)\n"); + "::grpc::Channel>& channel)\n"); printer->Indent(); - printer->Print(": ::grpc::InternalStub(channel)"); + printer->Print(": channel_(channel)"); for (int i = 0; i < service->method_count(); ++i) { const grpc::protobuf::MethodDescriptor *method = service->method(i); (*vars)["Method"] = method->name(); @@ -991,13 +989,12 @@ void PrintSourceService(grpc::protobuf::io::Printer *printer, } else { (*vars)["StreamingType"] = "BIDI_STREAMING"; } - printer->Print( - *vars, - ", rpcmethod_$Method$_(" - "$prefix$$Service$_method_names[$Idx$], " - "::grpc::RpcMethod::$StreamingType$, " - "channel->RegisterMethod($prefix$$Service$_method_names[$Idx$])" - ")\n"); + printer->Print(*vars, + ", rpcmethod_$Method$_(" + "$prefix$$Service$_method_names[$Idx$], " + "::grpc::RpcMethod::$StreamingType$, " + "channel" + ")\n"); } printer->Print("{}\n\n"); printer->Outdent(); diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc index 17f31c22cb..bb4be07beb 100644 --- a/src/cpp/client/channel.cc +++ b/src/cpp/client/channel.cc @@ -31,7 +31,7 @@ * */ -#include "src/cpp/client/channel.h" +#include <grpc++/channel.h> #include <memory> @@ -52,8 +52,6 @@ namespace grpc { -Channel::Channel(grpc_channel* channel) : c_channel_(channel) {} - Channel::Channel(const grpc::string& host, grpc_channel* channel) : host_(host), c_channel_(channel) {} diff --git a/src/cpp/client/channel.h b/src/cpp/client/channel.h deleted file mode 100644 index 7e406ad788..0000000000 --- a/src/cpp/client/channel.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPC_INTERNAL_CPP_CLIENT_CHANNEL_H -#define GRPC_INTERNAL_CPP_CLIENT_CHANNEL_H - -#include <memory> - -#include <grpc++/channel_interface.h> -#include <grpc++/config.h> -#include <grpc++/impl/grpc_library.h> - -struct grpc_channel; - -namespace grpc { -class Call; -class CallOpSetInterface; -class ChannelArguments; -class CompletionQueue; -class Credentials; -class StreamContextInterface; - -class Channel GRPC_FINAL : public GrpcLibrary, public ChannelInterface { - public: - explicit Channel(grpc_channel* c_channel); - Channel(const grpc::string& host, grpc_channel* c_channel); - ~Channel() GRPC_OVERRIDE; - - void* RegisterMethod(const char* method) GRPC_OVERRIDE; - Call CreateCall(const RpcMethod& method, ClientContext* context, - CompletionQueue* cq) GRPC_OVERRIDE; - void PerformOpsOnCall(CallOpSetInterface* ops, Call* call) GRPC_OVERRIDE; - - grpc_connectivity_state GetState(bool try_to_connect) GRPC_OVERRIDE; - - private: - void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed, - gpr_timespec deadline, CompletionQueue* cq, - void* tag) GRPC_OVERRIDE; - - bool WaitForStateChangeImpl(grpc_connectivity_state last_observed, - gpr_timespec deadline) GRPC_OVERRIDE; - - const grpc::string host_; - grpc_channel* const c_channel_; // owned -}; - -} // namespace grpc - -#endif // GRPC_INTERNAL_CPP_CLIENT_CHANNEL_H diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc index b8caa1eae4..a3906fc781 100644 --- a/src/cpp/client/client_context.cc +++ b/src/cpp/client/client_context.cc @@ -71,7 +71,7 @@ void ClientContext::AddMetadata(const grpc::string& meta_key, } void ClientContext::set_call(grpc_call* call, - const std::shared_ptr<ChannelInterface>& channel) { + const std::shared_ptr<Channel>& channel) { GPR_ASSERT(call_ == nullptr); call_ = call; channel_ = channel; diff --git a/src/cpp/client/create_channel.cc b/src/cpp/client/create_channel.cc index 5ae772f096..70ea7e0e27 100644 --- a/src/cpp/client/create_channel.cc +++ b/src/cpp/client/create_channel.cc @@ -34,15 +34,16 @@ #include <memory> #include <sstream> -#include "src/cpp/client/channel.h" -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/channel_arguments.h> #include <grpc++/create_channel.h> +#include "src/cpp/client/create_channel_internal.h" + namespace grpc { class ChannelArguments; -std::shared_ptr<ChannelInterface> CreateChannel( +std::shared_ptr<Channel> CreateChannel( const grpc::string& target, const std::shared_ptr<Credentials>& creds, const ChannelArguments& args) { ChannelArguments cp_args = args; @@ -50,10 +51,10 @@ std::shared_ptr<ChannelInterface> CreateChannel( user_agent_prefix << "grpc-c++/" << grpc_version_string(); cp_args.SetString(GRPC_ARG_PRIMARY_USER_AGENT_STRING, user_agent_prefix.str()); - return creds ? creds->CreateChannel(target, cp_args) - : std::shared_ptr<ChannelInterface>( - new Channel(grpc_lame_client_channel_create( - NULL, GRPC_STATUS_INVALID_ARGUMENT, - "Invalid credentials."))); + return creds + ? creds->CreateChannel(target, cp_args) + : CreateChannelInternal("", grpc_lame_client_channel_create( + NULL, GRPC_STATUS_INVALID_ARGUMENT, + "Invalid credentials.")); } } // namespace grpc diff --git a/src/cpp/client/internal_stub.cc b/src/cpp/client/create_channel_internal.cc index 91724a4837..9c5ab038cf 100644 --- a/src/cpp/client/internal_stub.cc +++ b/src/cpp/client/create_channel_internal.cc @@ -31,6 +31,16 @@ * */ -#include <grpc++/impl/internal_stub.h> +#include <memory> -namespace grpc {} // namespace grpc +#include <grpc++/channel.h> + +struct grpc_channel; + +namespace grpc { + +std::shared_ptr<Channel> CreateChannelInternal(const grpc::string& host, + grpc_channel* c_channel) { + return std::shared_ptr<Channel>(new Channel(host, c_channel)); +} +} // namespace grpc diff --git a/include/grpc++/impl/internal_stub.h b/src/cpp/client/create_channel_internal.h index 370a3b8ac5..1692471990 100644 --- a/include/grpc++/impl/internal_stub.h +++ b/src/cpp/client/create_channel_internal.h @@ -31,27 +31,21 @@ * */ -#ifndef GRPCXX_IMPL_INTERNAL_STUB_H -#define GRPCXX_IMPL_INTERNAL_STUB_H +#ifndef GRPC_INTERNAL_CPP_CLIENT_CREATE_CHANNEL_INTERNAL_H +#define GRPC_INTERNAL_CPP_CLIENT_CREATE_CHANNEL_INTERNAL_H #include <memory> -#include <grpc++/channel_interface.h> +#include <grpc++/config.h> -namespace grpc { - -class InternalStub { - public: - InternalStub(const std::shared_ptr<ChannelInterface>& channel) - : channel_(channel) {} - virtual ~InternalStub() {} +struct grpc_channel; - ChannelInterface* channel() { return channel_.get(); } +namespace grpc { +class Channel; - private: - const std::shared_ptr<ChannelInterface> channel_; -}; +std::shared_ptr<Channel> CreateChannelInternal(const grpc::string& host, + grpc_channel* c_channel); } // namespace grpc -#endif // GRPCXX_IMPL_INTERNAL_STUB_H +#endif // GRPC_INTERNAL_CPP_CLIENT_CREATE_CHANNEL_INTERNAL_H diff --git a/src/cpp/client/generic_stub.cc b/src/cpp/client/generic_stub.cc index 0c90578ae5..ee89c02965 100644 --- a/src/cpp/client/generic_stub.cc +++ b/src/cpp/client/generic_stub.cc @@ -44,8 +44,7 @@ std::unique_ptr<GenericClientAsyncReaderWriter> GenericStub::Call( return std::unique_ptr<GenericClientAsyncReaderWriter>( new GenericClientAsyncReaderWriter( channel_.get(), cq, - RpcMethod(method.c_str(), RpcMethod::BIDI_STREAMING, nullptr), - context, tag)); + RpcMethod(method.c_str(), RpcMethod::BIDI_STREAMING), context, tag)); } } // namespace grpc diff --git a/src/cpp/client/insecure_credentials.cc b/src/cpp/client/insecure_credentials.cc index 2f9357b568..97931406af 100644 --- a/src/cpp/client/insecure_credentials.cc +++ b/src/cpp/client/insecure_credentials.cc @@ -34,22 +34,24 @@ #include <grpc/grpc.h> #include <grpc/support/log.h> +#include <grpc++/channel.h> #include <grpc++/channel_arguments.h> #include <grpc++/config.h> #include <grpc++/credentials.h> -#include "src/cpp/client/channel.h" +#include "src/cpp/client/create_channel_internal.h" namespace grpc { namespace { class InsecureCredentialsImpl GRPC_FINAL : public Credentials { public: - std::shared_ptr<grpc::ChannelInterface> CreateChannel( + std::shared_ptr<grpc::Channel> CreateChannel( const string& target, const grpc::ChannelArguments& args) GRPC_OVERRIDE { grpc_channel_args channel_args; args.SetChannelArgs(&channel_args); - return std::shared_ptr<ChannelInterface>(new Channel( - grpc_insecure_channel_create(target.c_str(), &channel_args, nullptr))); + return CreateChannelInternal( + "", + grpc_insecure_channel_create(target.c_str(), &channel_args, nullptr)); } // InsecureCredentials should not be applied to a call. diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc index 6cd6b77fcf..1e912c6beb 100644 --- a/src/cpp/client/secure_credentials.cc +++ b/src/cpp/client/secure_credentials.cc @@ -32,21 +32,21 @@ */ #include <grpc/support/log.h> - +#include <grpc++/channel.h> #include <grpc++/channel_arguments.h> #include <grpc++/impl/grpc_library.h> -#include "src/cpp/client/channel.h" +#include "src/cpp/client/create_channel_internal.h" #include "src/cpp/client/secure_credentials.h" namespace grpc { -std::shared_ptr<grpc::ChannelInterface> SecureCredentials::CreateChannel( +std::shared_ptr<grpc::Channel> SecureCredentials::CreateChannel( const string& target, const grpc::ChannelArguments& args) { grpc_channel_args channel_args; args.SetChannelArgs(&channel_args); - return std::shared_ptr<ChannelInterface>(new Channel( + return CreateChannelInternal( args.GetSslTargetNameOverride(), - grpc_secure_channel_create(c_creds_, target.c_str(), &channel_args))); + grpc_secure_channel_create(c_creds_, target.c_str(), &channel_args)); } bool SecureCredentials::ApplyToCall(grpc_call* call) { diff --git a/src/cpp/client/secure_credentials.h b/src/cpp/client/secure_credentials.h index c2b8d43a15..974d83514d 100644 --- a/src/cpp/client/secure_credentials.h +++ b/src/cpp/client/secure_credentials.h @@ -48,7 +48,7 @@ class SecureCredentials GRPC_FINAL : public Credentials { grpc_credentials* GetRawCreds() { return c_creds_; } bool ApplyToCall(grpc_call* call) GRPC_OVERRIDE; - std::shared_ptr<grpc::ChannelInterface> CreateChannel( + std::shared_ptr<grpc::Channel> CreateChannel( const string& target, const grpc::ChannelArguments& args) GRPC_OVERRIDE; SecureCredentials* AsSecureCredentials() GRPC_OVERRIDE { return this; } diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 0a5c976e01..479f14d42b 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -36,7 +36,7 @@ #include <grpc/support/alloc.h> #include <grpc++/byte_buffer.h> #include <grpc++/client_context.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include "src/core/profiling/timers.h" diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 9a9cca0ba1..6b922d9698 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -39,7 +39,7 @@ #include "test/cpp/util/echo.grpc.pb.h" #include <grpc++/async_unary_call.h> #include <grpc++/channel_arguments.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> @@ -204,7 +204,7 @@ class AsyncEnd2endTest : public ::testing::TestWithParam<bool> { } void ResetStub() { - std::shared_ptr<ChannelInterface> channel = CreateChannel( + std::shared_ptr<Channel> channel = CreateChannel( server_address_.str(), InsecureCredentials(), ChannelArguments()); stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel)); } @@ -742,7 +742,7 @@ TEST_P(AsyncEnd2endTest, ServerCheckDone) { } TEST_P(AsyncEnd2endTest, UnimplementedRpc) { - std::shared_ptr<ChannelInterface> channel = CreateChannel( + std::shared_ptr<Channel> channel = CreateChannel( server_address_.str(), InsecureCredentials(), ChannelArguments()); std::unique_ptr<grpc::cpp::test::util::UnimplementedService::Stub> stub; stub = diff --git a/test/cpp/end2end/client_crash_test.cc b/test/cpp/end2end/client_crash_test.cc index 1c2a5c3a36..89708a2ef6 100644 --- a/test/cpp/end2end/client_crash_test.cc +++ b/test/cpp/end2end/client_crash_test.cc @@ -36,7 +36,7 @@ #include "test/cpp/util/echo_duplicate.grpc.pb.h" #include "test/cpp/util/echo.grpc.pb.h" #include <grpc++/channel_arguments.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 8ea63b1280..cb155a84ac 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -41,7 +41,7 @@ #include "test/cpp/util/echo_duplicate.grpc.pb.h" #include "test/cpp/util/echo.grpc.pb.h" #include <grpc++/channel_arguments.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> @@ -105,7 +105,7 @@ bool CheckIsLocalhost(const grpc::string& addr) { class Proxy : public ::grpc::cpp::test::util::TestService::Service { public: - Proxy(std::shared_ptr<ChannelInterface> channel) + Proxy(std::shared_ptr<Channel> channel) : stub_(grpc::cpp::test::util::TestService::NewStub(channel)) {} Status Echo(ServerContext* server_context, const EchoRequest* request, @@ -316,7 +316,7 @@ class End2endTest : public ::testing::TestWithParam<bool> { stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel_)); } - std::shared_ptr<ChannelInterface> channel_; + std::shared_ptr<Channel> channel_; std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_; std::unique_ptr<Server> server_; std::unique_ptr<Server> proxy_server_; @@ -567,7 +567,7 @@ TEST_F(End2endTest, DiffPackageServices) { TEST_F(End2endTest, BadCredentials) { std::shared_ptr<Credentials> bad_creds = ServiceAccountCredentials("", "", 1); EXPECT_EQ(static_cast<Credentials*>(nullptr), bad_creds.get()); - std::shared_ptr<ChannelInterface> channel = + std::shared_ptr<Channel> channel = CreateChannel(server_address_.str(), bad_creds, ChannelArguments()); std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub( grpc::cpp::test::util::TestService::NewStub(channel)); diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc index 3120cec938..b817198fa7 100644 --- a/test/cpp/end2end/generic_end2end_test.cc +++ b/test/cpp/end2end/generic_end2end_test.cc @@ -41,7 +41,7 @@ #include <grpc++/async_unary_call.h> #include <grpc++/byte_buffer.h> #include <grpc++/channel_arguments.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> @@ -127,7 +127,7 @@ class GenericEnd2endTest : public ::testing::Test { } void ResetStub() { - std::shared_ptr<ChannelInterface> channel = CreateChannel( + std::shared_ptr<Channel> channel = CreateChannel( server_address_.str(), InsecureCredentials(), ChannelArguments()); generic_stub_.reset(new GenericStub(channel)); } diff --git a/test/cpp/end2end/mock_test.cc b/test/cpp/end2end/mock_test.cc index d1d5c4447b..32493c5661 100644 --- a/test/cpp/end2end/mock_test.cc +++ b/test/cpp/end2end/mock_test.cc @@ -38,7 +38,7 @@ #include "test/cpp/util/echo_duplicate.grpc.pb.h" #include "test/cpp/util/echo.grpc.pb.h" #include <grpc++/channel_arguments.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> @@ -249,7 +249,7 @@ class MockTest : public ::testing::Test { void TearDown() GRPC_OVERRIDE { server_->Shutdown(); } void ResetStub() { - std::shared_ptr<ChannelInterface> channel = CreateChannel( + std::shared_ptr<Channel> channel = CreateChannel( server_address_.str(), InsecureCredentials(), ChannelArguments()); stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel)); } diff --git a/test/cpp/end2end/server_crash_test.cc b/test/cpp/end2end/server_crash_test.cc index 5c7bb4e653..2688f2c4ea 100644 --- a/test/cpp/end2end/server_crash_test.cc +++ b/test/cpp/end2end/server_crash_test.cc @@ -36,7 +36,7 @@ #include "test/cpp/util/echo_duplicate.grpc.pb.h" #include "test/cpp/util/echo.grpc.pb.h" #include <grpc++/channel_arguments.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> diff --git a/test/cpp/end2end/server_crash_test_client.cc b/test/cpp/end2end/server_crash_test_client.cc index 1da4f05c8d..52dce8f28e 100644 --- a/test/cpp/end2end/server_crash_test_client.cc +++ b/test/cpp/end2end/server_crash_test_client.cc @@ -38,7 +38,7 @@ #include <gflags/gflags.h> #include <grpc++/channel_arguments.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> diff --git a/test/cpp/end2end/shutdown_test.cc b/test/cpp/end2end/shutdown_test.cc index fccbb13030..dc5fb5af9b 100644 --- a/test/cpp/end2end/shutdown_test.cc +++ b/test/cpp/end2end/shutdown_test.cc @@ -39,7 +39,7 @@ #include "test/cpp/util/echo.grpc.pb.h" #include "src/core/support/env.h" #include <grpc++/channel_arguments.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> @@ -118,7 +118,7 @@ class ShutdownTest : public ::testing::Test { } protected: - std::shared_ptr<ChannelInterface> channel_; + std::shared_ptr<Channel> channel_; std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_; std::unique_ptr<Server> server_; bool shutdown_; diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc index 3604232749..bdcf07573e 100644 --- a/test/cpp/end2end/thread_stress_test.cc +++ b/test/cpp/end2end/thread_stress_test.cc @@ -39,7 +39,7 @@ #include "test/cpp/util/echo_duplicate.grpc.pb.h" #include "test/cpp/util/echo.grpc.pb.h" #include <grpc++/channel_arguments.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> @@ -195,7 +195,7 @@ class End2endTest : public ::testing::Test { void TearDown() GRPC_OVERRIDE { server_->Shutdown(); } void ResetStub() { - std::shared_ptr<ChannelInterface> channel = CreateChannel( + std::shared_ptr<Channel> channel = CreateChannel( server_address_.str(), InsecureCredentials(), ChannelArguments()); stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel)); } diff --git a/test/cpp/end2end/zookeeper_test.cc b/test/cpp/end2end/zookeeper_test.cc index f5eba66cb2..d7fac3d07e 100644 --- a/test/cpp/end2end/zookeeper_test.cc +++ b/test/cpp/end2end/zookeeper_test.cc @@ -36,7 +36,7 @@ #include "test/cpp/util/echo.grpc.pb.h" #include "src/core/support/env.h" #include <grpc++/channel_arguments.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> @@ -170,7 +170,7 @@ class ZookeeperTest : public ::testing::Test { return strs.str(); } - std::shared_ptr<ChannelInterface> channel_; + std::shared_ptr<Channel> channel_; std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_; std::unique_ptr<Server> server1_; std::unique_ptr<Server> server2_; diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index 48143b2e53..d9e4f1ba6a 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -38,7 +38,7 @@ #include <grpc/grpc.h> #include <grpc/support/log.h> #include <gflags/gflags.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/status.h> #include <grpc++/stream.h> diff --git a/test/cpp/interop/client_helper.cc b/test/cpp/interop/client_helper.cc index da5627de95..be652a4add 100644 --- a/test/cpp/interop/client_helper.cc +++ b/test/cpp/interop/client_helper.cc @@ -44,7 +44,7 @@ #include <grpc/support/log.h> #include <gflags/gflags.h> #include <grpc++/channel_arguments.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> #include <grpc++/stream.h> @@ -102,7 +102,7 @@ grpc::string GetOauth2AccessToken() { return access_token; } -std::shared_ptr<ChannelInterface> CreateChannelForTestCase( +std::shared_ptr<Channel> CreateChannelForTestCase( const grpc::string& test_case) { GPR_ASSERT(FLAGS_server_port); const int host_port_buf_size = 1024; diff --git a/test/cpp/interop/client_helper.h b/test/cpp/interop/client_helper.h index edc69e90ac..d4c14433a9 100644 --- a/test/cpp/interop/client_helper.h +++ b/test/cpp/interop/client_helper.h @@ -37,7 +37,7 @@ #include <memory> #include <grpc++/config.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include "src/core/surface/call.h" @@ -48,7 +48,7 @@ grpc::string GetServiceAccountJsonKey(); grpc::string GetOauth2AccessToken(); -std::shared_ptr<ChannelInterface> CreateChannelForTestCase( +std::shared_ptr<Channel> CreateChannelForTestCase( const grpc::string& test_case); class InteropClientContextInspector { diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc index 5ed14d556a..c73505c670 100644 --- a/test/cpp/interop/interop_client.cc +++ b/test/cpp/interop/interop_client.cc @@ -42,7 +42,7 @@ #include <grpc/support/log.h> #include <grpc/support/string_util.h> #include <grpc/support/useful.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/credentials.h> #include <grpc++/status.h> @@ -84,7 +84,7 @@ CompressionType GetInteropCompressionTypeFromCompressionAlgorithm( } } // namespace -InteropClient::InteropClient(std::shared_ptr<ChannelInterface> channel) +InteropClient::InteropClient(std::shared_ptr<Channel> channel) : channel_(channel) {} void InteropClient::AssertOkOrPrintErrorStatus(const Status& s) { diff --git a/test/cpp/interop/interop_client.h b/test/cpp/interop/interop_client.h index d6fb9bff39..354c2c6195 100644 --- a/test/cpp/interop/interop_client.h +++ b/test/cpp/interop/interop_client.h @@ -36,7 +36,7 @@ #include <memory> #include <grpc/grpc.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/status.h> #include "test/proto/messages.grpc.pb.h" @@ -45,10 +45,10 @@ namespace testing { class InteropClient { public: - explicit InteropClient(std::shared_ptr<ChannelInterface> channel); + explicit InteropClient(std::shared_ptr<Channel> channel); ~InteropClient() {} - void Reset(std::shared_ptr<ChannelInterface> channel) { channel_ = channel; } + void Reset(std::shared_ptr<Channel> channel) { channel_ = channel; } void DoEmpty(); void DoLargeUnary(); @@ -82,7 +82,7 @@ class InteropClient { void PerformLargeUnary(SimpleRequest* request, SimpleResponse* response); void AssertOkOrPrintErrorStatus(const Status& s); - std::shared_ptr<ChannelInterface> channel_; + std::shared_ptr<Channel> channel_; }; } // namespace testing diff --git a/test/cpp/interop/reconnect_interop_client.cc b/test/cpp/interop/reconnect_interop_client.cc index 65f098050e..675c6ff073 100644 --- a/test/cpp/interop/reconnect_interop_client.cc +++ b/test/cpp/interop/reconnect_interop_client.cc @@ -37,7 +37,7 @@ #include <grpc/grpc.h> #include <grpc/support/log.h> #include <gflags/gflags.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/status.h> #include "test/cpp/util/create_test_channel.h" @@ -50,7 +50,7 @@ DEFINE_int32(server_control_port, 0, "Server port for control rpcs."); DEFINE_int32(server_retry_port, 0, "Server port for testing reconnection."); DEFINE_string(server_host, "127.0.0.1", "Server host to connect to"); -using grpc::ChannelInterface; +using grpc::Channel; using grpc::ClientContext; using grpc::CreateTestChannel; using grpc::Status; @@ -78,7 +78,7 @@ int main(int argc, char** argv) { gpr_log(GPR_INFO, "Starting connections with retries."); server_address.str(""); server_address << FLAGS_server_host << ':' << FLAGS_server_retry_port; - std::shared_ptr<ChannelInterface> retry_channel = + std::shared_ptr<Channel> retry_channel = CreateTestChannel(server_address.str(), true); // About 13 retries. const int kDeadlineSeconds = 540; diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index 1c4f46328f..5395d02e32 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -125,11 +125,11 @@ class Client { channel_ = CreateTestChannel(target, config.enable_ssl()); stub_ = TestService::NewStub(channel_); } - ChannelInterface* get_channel() { return channel_.get(); } + Channel* get_channel() { return channel_.get(); } TestService::Stub* get_stub() { return stub_.get(); } private: - std::shared_ptr<ChannelInterface> channel_; + std::shared_ptr<Channel> channel_; std::unique_ptr<TestService::Stub> stub_; }; std::vector<ClientChannelInfo> channels_; diff --git a/test/cpp/qps/perf_db_client.h b/test/cpp/qps/perf_db_client.h index 7a9d86d3a6..3433cd88d1 100644 --- a/test/cpp/qps/perf_db_client.h +++ b/test/cpp/qps/perf_db_client.h @@ -38,7 +38,7 @@ #include <grpc/grpc.h> #include <grpc++/channel_arguments.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> @@ -65,7 +65,7 @@ class PerfDbClient { client_user_time_ = DBL_MIN; } - void init(std::shared_ptr<ChannelInterface> channel) { + void init(std::shared_ptr<Channel> channel) { stub_ = PerfDbTransfer::NewStub(channel); } diff --git a/test/cpp/util/cli_call.cc b/test/cpp/util/cli_call.cc index ac88910a01..d0a300f511 100644 --- a/test/cpp/util/cli_call.cc +++ b/test/cpp/util/cli_call.cc @@ -36,7 +36,7 @@ #include <iostream> #include <grpc++/byte_buffer.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/generic_stub.h> #include <grpc++/status.h> @@ -52,7 +52,7 @@ namespace { void* tag(int i) { return (void*)(gpr_intptr)i; } } // namespace -Status CliCall::Call(std::shared_ptr<grpc::ChannelInterface> channel, +Status CliCall::Call(std::shared_ptr<grpc::Channel> channel, const grpc::string& method, const grpc::string& request, grpc::string* response, const MetadataContainer& metadata, MetadataContainer* server_initial_metadata, diff --git a/test/cpp/util/cli_call.h b/test/cpp/util/cli_call.h index 8d114c9cb5..46b5dd3e4f 100644 --- a/test/cpp/util/cli_call.h +++ b/test/cpp/util/cli_call.h @@ -36,7 +36,7 @@ #include <map> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/config.h> #include <grpc++/status.h> @@ -46,7 +46,7 @@ namespace testing { class CliCall GRPC_FINAL { public: typedef std::multimap<grpc::string, grpc::string> MetadataContainer; - static Status Call(std::shared_ptr<grpc::ChannelInterface> channel, + static Status Call(std::shared_ptr<grpc::Channel> channel, const grpc::string& method, const grpc::string& request, grpc::string* response, const MetadataContainer& metadata, MetadataContainer* server_initial_metadata, diff --git a/test/cpp/util/cli_call_test.cc b/test/cpp/util/cli_call_test.cc index 6a1f055971..a48a56ae90 100644 --- a/test/cpp/util/cli_call_test.cc +++ b/test/cpp/util/cli_call_test.cc @@ -35,7 +35,7 @@ #include "test/cpp/util/cli_call.h" #include "test/cpp/util/echo.grpc.pb.h" #include <grpc++/channel_arguments.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> @@ -95,7 +95,7 @@ class CliCallTest : public ::testing::Test { stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel_)); } - std::shared_ptr<ChannelInterface> channel_; + std::shared_ptr<Channel> channel_; std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_; std::unique_ptr<Server> server_; std::ostringstream server_address_; diff --git a/test/cpp/util/create_test_channel.cc b/test/cpp/util/create_test_channel.cc index dc48fa2d87..43e719ef6b 100644 --- a/test/cpp/util/create_test_channel.cc +++ b/test/cpp/util/create_test_channel.cc @@ -55,7 +55,7 @@ namespace grpc { // CreateTestChannel("test.google.com:443", "", true, true, creds); // same as above // CreateTestChannel("", "test.google.com:443", true, true, creds); -std::shared_ptr<ChannelInterface> CreateTestChannel( +std::shared_ptr<Channel> CreateTestChannel( const grpc::string& server, const grpc::string& override_hostname, bool enable_ssl, bool use_prod_roots, const std::shared_ptr<Credentials>& creds) { @@ -80,7 +80,7 @@ std::shared_ptr<ChannelInterface> CreateTestChannel( } } -std::shared_ptr<ChannelInterface> CreateTestChannel( +std::shared_ptr<Channel> CreateTestChannel( const grpc::string& server, const grpc::string& override_hostname, bool enable_ssl, bool use_prod_roots) { return CreateTestChannel(server, override_hostname, enable_ssl, @@ -88,8 +88,8 @@ std::shared_ptr<ChannelInterface> CreateTestChannel( } // Shortcut for end2end and interop tests. -std::shared_ptr<ChannelInterface> CreateTestChannel(const grpc::string& server, - bool enable_ssl) { +std::shared_ptr<Channel> CreateTestChannel(const grpc::string& server, + bool enable_ssl) { return CreateTestChannel(server, "foo.test.google.fr", enable_ssl, false); } diff --git a/test/cpp/util/create_test_channel.h b/test/cpp/util/create_test_channel.h index 5f2609ddd8..129cc746f9 100644 --- a/test/cpp/util/create_test_channel.h +++ b/test/cpp/util/create_test_channel.h @@ -40,16 +40,16 @@ #include <grpc++/credentials.h> namespace grpc { -class ChannelInterface; +class Channel; -std::shared_ptr<ChannelInterface> CreateTestChannel(const grpc::string& server, - bool enable_ssl); +std::shared_ptr<Channel> CreateTestChannel(const grpc::string& server, + bool enable_ssl); -std::shared_ptr<ChannelInterface> CreateTestChannel( +std::shared_ptr<Channel> CreateTestChannel( const grpc::string& server, const grpc::string& override_hostname, bool enable_ssl, bool use_prod_roots); -std::shared_ptr<ChannelInterface> CreateTestChannel( +std::shared_ptr<Channel> CreateTestChannel( const grpc::string& server, const grpc::string& override_hostname, bool enable_ssl, bool use_prod_roots, const std::shared_ptr<Credentials>& creds); diff --git a/test/cpp/util/grpc_cli.cc b/test/cpp/util/grpc_cli.cc index 3c3baeb769..15c56a352c 100644 --- a/test/cpp/util/grpc_cli.cc +++ b/test/cpp/util/grpc_cli.cc @@ -67,7 +67,7 @@ #include "test/cpp/util/cli_call.h" #include "test/cpp/util/test_config.h" #include <grpc++/channel_arguments.h> -#include <grpc++/channel_interface.h> +#include <grpc++/channel.h> #include <grpc++/create_channel.h> #include <grpc++/credentials.h> @@ -154,7 +154,7 @@ int main(int argc, char** argv) { creds = grpc::SslCredentials(grpc::SslCredentialsOptions()); } } - std::shared_ptr<grpc::ChannelInterface> channel = + std::shared_ptr<grpc::Channel> channel = grpc::CreateChannel(server_address, creds, grpc::ChannelArguments()); grpc::string response; diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 4e7100c948..052d3e74c7 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -764,8 +764,8 @@ INPUT = include/grpc++/async_generic_service.h \ include/grpc++/async_unary_call.h \ include/grpc++/auth_context.h \ include/grpc++/byte_buffer.h \ +include/grpc++/channel.h \ include/grpc++/channel_arguments.h \ -include/grpc++/channel_interface.h \ include/grpc++/client_context.h \ include/grpc++/completion_queue.h \ include/grpc++/config.h \ @@ -776,7 +776,6 @@ include/grpc++/generic_stub.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ include/grpc++/impl/grpc_library.h \ -include/grpc++/impl/internal_stub.h \ include/grpc++/impl/proto_utils.h \ include/grpc++/impl/rpc_method.h \ include/grpc++/impl/rpc_service_method.h \ diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index b2750ae68a..ed19c6ca2b 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -764,8 +764,8 @@ INPUT = include/grpc++/async_generic_service.h \ include/grpc++/async_unary_call.h \ include/grpc++/auth_context.h \ include/grpc++/byte_buffer.h \ +include/grpc++/channel.h \ include/grpc++/channel_arguments.h \ -include/grpc++/channel_interface.h \ include/grpc++/client_context.h \ include/grpc++/completion_queue.h \ include/grpc++/config.h \ @@ -776,7 +776,6 @@ include/grpc++/generic_stub.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ include/grpc++/impl/grpc_library.h \ -include/grpc++/impl/internal_stub.h \ include/grpc++/impl/proto_utils.h \ include/grpc++/impl/rpc_method.h \ include/grpc++/impl/rpc_service_method.h \ @@ -801,7 +800,7 @@ include/grpc++/time.h \ src/cpp/client/secure_credentials.h \ src/cpp/common/secure_auth_context.h \ src/cpp/server/secure_server_credentials.h \ -src/cpp/client/channel.h \ +src/cpp/client/create_channel_internal.h \ src/cpp/common/create_auth_context.h \ src/cpp/server/dynamic_thread_pool.h \ src/cpp/server/fixed_size_thread_pool.h \ @@ -816,10 +815,10 @@ src/cpp/client/channel.cc \ src/cpp/client/channel_arguments.cc \ src/cpp/client/client_context.cc \ src/cpp/client/create_channel.cc \ +src/cpp/client/create_channel_internal.cc \ src/cpp/client/credentials.cc \ src/cpp/client/generic_stub.cc \ src/cpp/client/insecure_credentials.cc \ -src/cpp/client/internal_stub.cc \ src/cpp/common/call.cc \ src/cpp/common/completion_queue.cc \ src/cpp/common/rpc_method.cc \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index b2d3ef8457..f2c124a49d 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -13105,8 +13105,8 @@ "include/grpc++/async_unary_call.h", "include/grpc++/auth_context.h", "include/grpc++/byte_buffer.h", + "include/grpc++/channel.h", "include/grpc++/channel_arguments.h", - "include/grpc++/channel_interface.h", "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", "include/grpc++/config.h", @@ -13117,7 +13117,6 @@ "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/grpc_library.h", - "include/grpc++/impl/internal_stub.h", "include/grpc++/impl/proto_utils.h", "include/grpc++/impl/rpc_method.h", "include/grpc++/impl/rpc_service_method.h", @@ -13139,7 +13138,7 @@ "include/grpc++/stream.h", "include/grpc++/stub_options.h", "include/grpc++/time.h", - "src/cpp/client/channel.h", + "src/cpp/client/create_channel_internal.h", "src/cpp/client/secure_credentials.h", "src/cpp/common/create_auth_context.h", "src/cpp/common/secure_auth_context.h", @@ -13155,8 +13154,8 @@ "include/grpc++/async_unary_call.h", "include/grpc++/auth_context.h", "include/grpc++/byte_buffer.h", + "include/grpc++/channel.h", "include/grpc++/channel_arguments.h", - "include/grpc++/channel_interface.h", "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", "include/grpc++/config.h", @@ -13167,7 +13166,6 @@ "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/grpc_library.h", - "include/grpc++/impl/internal_stub.h", "include/grpc++/impl/proto_utils.h", "include/grpc++/impl/rpc_method.h", "include/grpc++/impl/rpc_service_method.h", @@ -13190,14 +13188,14 @@ "include/grpc++/stub_options.h", "include/grpc++/time.h", "src/cpp/client/channel.cc", - "src/cpp/client/channel.h", "src/cpp/client/channel_arguments.cc", "src/cpp/client/client_context.cc", "src/cpp/client/create_channel.cc", + "src/cpp/client/create_channel_internal.cc", + "src/cpp/client/create_channel_internal.h", "src/cpp/client/credentials.cc", "src/cpp/client/generic_stub.cc", "src/cpp/client/insecure_credentials.cc", - "src/cpp/client/internal_stub.cc", "src/cpp/client/secure_channel_arguments.cc", "src/cpp/client/secure_credentials.cc", "src/cpp/client/secure_credentials.h", @@ -13279,8 +13277,8 @@ "include/grpc++/async_unary_call.h", "include/grpc++/auth_context.h", "include/grpc++/byte_buffer.h", + "include/grpc++/channel.h", "include/grpc++/channel_arguments.h", - "include/grpc++/channel_interface.h", "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", "include/grpc++/config.h", @@ -13291,7 +13289,6 @@ "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/grpc_library.h", - "include/grpc++/impl/internal_stub.h", "include/grpc++/impl/proto_utils.h", "include/grpc++/impl/rpc_method.h", "include/grpc++/impl/rpc_service_method.h", @@ -13313,7 +13310,7 @@ "include/grpc++/stream.h", "include/grpc++/stub_options.h", "include/grpc++/time.h", - "src/cpp/client/channel.h", + "src/cpp/client/create_channel_internal.h", "src/cpp/common/create_auth_context.h", "src/cpp/server/dynamic_thread_pool.h", "src/cpp/server/fixed_size_thread_pool.h", @@ -13326,8 +13323,8 @@ "include/grpc++/async_unary_call.h", "include/grpc++/auth_context.h", "include/grpc++/byte_buffer.h", + "include/grpc++/channel.h", "include/grpc++/channel_arguments.h", - "include/grpc++/channel_interface.h", "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", "include/grpc++/config.h", @@ -13338,7 +13335,6 @@ "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/grpc_library.h", - "include/grpc++/impl/internal_stub.h", "include/grpc++/impl/proto_utils.h", "include/grpc++/impl/rpc_method.h", "include/grpc++/impl/rpc_service_method.h", @@ -13361,14 +13357,14 @@ "include/grpc++/stub_options.h", "include/grpc++/time.h", "src/cpp/client/channel.cc", - "src/cpp/client/channel.h", "src/cpp/client/channel_arguments.cc", "src/cpp/client/client_context.cc", "src/cpp/client/create_channel.cc", + "src/cpp/client/create_channel_internal.cc", + "src/cpp/client/create_channel_internal.h", "src/cpp/client/credentials.cc", "src/cpp/client/generic_stub.cc", "src/cpp/client/insecure_credentials.cc", - "src/cpp/client/internal_stub.cc", "src/cpp/common/call.cc", "src/cpp/common/completion_queue.cc", "src/cpp/common/create_auth_context.h", diff --git a/vsprojects/grpc++/grpc++.vcxproj b/vsprojects/grpc++/grpc++.vcxproj index cd85abd04a..168bd440c3 100644 --- a/vsprojects/grpc++/grpc++.vcxproj +++ b/vsprojects/grpc++/grpc++.vcxproj @@ -217,8 +217,8 @@ <ClInclude Include="..\..\include\grpc++\async_unary_call.h" /> <ClInclude Include="..\..\include\grpc++\auth_context.h" /> <ClInclude Include="..\..\include\grpc++\byte_buffer.h" /> + <ClInclude Include="..\..\include\grpc++\channel.h" /> <ClInclude Include="..\..\include\grpc++\channel_arguments.h" /> - <ClInclude Include="..\..\include\grpc++\channel_interface.h" /> <ClInclude Include="..\..\include\grpc++\client_context.h" /> <ClInclude Include="..\..\include\grpc++\completion_queue.h" /> <ClInclude Include="..\..\include\grpc++\config.h" /> @@ -229,7 +229,6 @@ <ClInclude Include="..\..\include\grpc++\impl\call.h" /> <ClInclude Include="..\..\include\grpc++\impl\client_unary_call.h" /> <ClInclude Include="..\..\include\grpc++\impl\grpc_library.h" /> - <ClInclude Include="..\..\include\grpc++\impl\internal_stub.h" /> <ClInclude Include="..\..\include\grpc++\impl\proto_utils.h" /> <ClInclude Include="..\..\include\grpc++\impl\rpc_method.h" /> <ClInclude Include="..\..\include\grpc++\impl\rpc_service_method.h" /> @@ -256,7 +255,7 @@ <ClInclude Include="..\..\src\cpp\client\secure_credentials.h" /> <ClInclude Include="..\..\src\cpp\common\secure_auth_context.h" /> <ClInclude Include="..\..\src\cpp\server\secure_server_credentials.h" /> - <ClInclude Include="..\..\src\cpp\client\channel.h" /> + <ClInclude Include="..\..\src\cpp\client\create_channel_internal.h" /> <ClInclude Include="..\..\src\cpp\common\create_auth_context.h" /> <ClInclude Include="..\..\src\cpp\server\dynamic_thread_pool.h" /> <ClInclude Include="..\..\src\cpp\server\fixed_size_thread_pool.h" /> @@ -283,14 +282,14 @@ </ClCompile> <ClCompile Include="..\..\src\cpp\client\create_channel.cc"> </ClCompile> + <ClCompile Include="..\..\src\cpp\client\create_channel_internal.cc"> + </ClCompile> <ClCompile Include="..\..\src\cpp\client\credentials.cc"> </ClCompile> <ClCompile Include="..\..\src\cpp\client\generic_stub.cc"> </ClCompile> <ClCompile Include="..\..\src\cpp\client\insecure_credentials.cc"> </ClCompile> - <ClCompile Include="..\..\src\cpp\client\internal_stub.cc"> - </ClCompile> <ClCompile Include="..\..\src\cpp\common\call.cc"> </ClCompile> <ClCompile Include="..\..\src\cpp\common\completion_queue.cc"> diff --git a/vsprojects/grpc++/grpc++.vcxproj.filters b/vsprojects/grpc++/grpc++.vcxproj.filters index 65720f35e2..e36db28801 100644 --- a/vsprojects/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/grpc++/grpc++.vcxproj.filters @@ -31,6 +31,9 @@ <ClCompile Include="..\..\src\cpp\client\create_channel.cc"> <Filter>src\cpp\client</Filter> </ClCompile> + <ClCompile Include="..\..\src\cpp\client\create_channel_internal.cc"> + <Filter>src\cpp\client</Filter> + </ClCompile> <ClCompile Include="..\..\src\cpp\client\credentials.cc"> <Filter>src\cpp\client</Filter> </ClCompile> @@ -40,9 +43,6 @@ <ClCompile Include="..\..\src\cpp\client\insecure_credentials.cc"> <Filter>src\cpp\client</Filter> </ClCompile> - <ClCompile Include="..\..\src\cpp\client\internal_stub.cc"> - <Filter>src\cpp\client</Filter> - </ClCompile> <ClCompile Include="..\..\src\cpp\common\call.cc"> <Filter>src\cpp\common</Filter> </ClCompile> @@ -108,10 +108,10 @@ <ClInclude Include="..\..\include\grpc++\byte_buffer.h"> <Filter>include\grpc++</Filter> </ClInclude> - <ClInclude Include="..\..\include\grpc++\channel_arguments.h"> + <ClInclude Include="..\..\include\grpc++\channel.h"> <Filter>include\grpc++</Filter> </ClInclude> - <ClInclude Include="..\..\include\grpc++\channel_interface.h"> + <ClInclude Include="..\..\include\grpc++\channel_arguments.h"> <Filter>include\grpc++</Filter> </ClInclude> <ClInclude Include="..\..\include\grpc++\client_context.h"> @@ -144,9 +144,6 @@ <ClInclude Include="..\..\include\grpc++\impl\grpc_library.h"> <Filter>include\grpc++\impl</Filter> </ClInclude> - <ClInclude Include="..\..\include\grpc++\impl\internal_stub.h"> - <Filter>include\grpc++\impl</Filter> - </ClInclude> <ClInclude Include="..\..\include\grpc++\impl\proto_utils.h"> <Filter>include\grpc++\impl</Filter> </ClInclude> @@ -221,7 +218,7 @@ <ClInclude Include="..\..\src\cpp\server\secure_server_credentials.h"> <Filter>src\cpp\server</Filter> </ClInclude> - <ClInclude Include="..\..\src\cpp\client\channel.h"> + <ClInclude Include="..\..\src\cpp\client\create_channel_internal.h"> <Filter>src\cpp\client</Filter> </ClInclude> <ClInclude Include="..\..\src\cpp\common\create_auth_context.h"> diff --git a/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj index 6f53272545..f004556dbb 100644 --- a/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -217,8 +217,8 @@ <ClInclude Include="..\..\include\grpc++\async_unary_call.h" /> <ClInclude Include="..\..\include\grpc++\auth_context.h" /> <ClInclude Include="..\..\include\grpc++\byte_buffer.h" /> + <ClInclude Include="..\..\include\grpc++\channel.h" /> <ClInclude Include="..\..\include\grpc++\channel_arguments.h" /> - <ClInclude Include="..\..\include\grpc++\channel_interface.h" /> <ClInclude Include="..\..\include\grpc++\client_context.h" /> <ClInclude Include="..\..\include\grpc++\completion_queue.h" /> <ClInclude Include="..\..\include\grpc++\config.h" /> @@ -229,7 +229,6 @@ <ClInclude Include="..\..\include\grpc++\impl\call.h" /> <ClInclude Include="..\..\include\grpc++\impl\client_unary_call.h" /> <ClInclude Include="..\..\include\grpc++\impl\grpc_library.h" /> - <ClInclude Include="..\..\include\grpc++\impl\internal_stub.h" /> <ClInclude Include="..\..\include\grpc++\impl\proto_utils.h" /> <ClInclude Include="..\..\include\grpc++\impl\rpc_method.h" /> <ClInclude Include="..\..\include\grpc++\impl\rpc_service_method.h" /> @@ -253,7 +252,7 @@ <ClInclude Include="..\..\include\grpc++\time.h" /> </ItemGroup> <ItemGroup> - <ClInclude Include="..\..\src\cpp\client\channel.h" /> + <ClInclude Include="..\..\src\cpp\client\create_channel_internal.h" /> <ClInclude Include="..\..\src\cpp\common\create_auth_context.h" /> <ClInclude Include="..\..\src\cpp\server\dynamic_thread_pool.h" /> <ClInclude Include="..\..\src\cpp\server\fixed_size_thread_pool.h" /> @@ -270,14 +269,14 @@ </ClCompile> <ClCompile Include="..\..\src\cpp\client\create_channel.cc"> </ClCompile> + <ClCompile Include="..\..\src\cpp\client\create_channel_internal.cc"> + </ClCompile> <ClCompile Include="..\..\src\cpp\client\credentials.cc"> </ClCompile> <ClCompile Include="..\..\src\cpp\client\generic_stub.cc"> </ClCompile> <ClCompile Include="..\..\src\cpp\client\insecure_credentials.cc"> </ClCompile> - <ClCompile Include="..\..\src\cpp\client\internal_stub.cc"> - </ClCompile> <ClCompile Include="..\..\src\cpp\common\call.cc"> </ClCompile> <ClCompile Include="..\..\src\cpp\common\completion_queue.cc"> diff --git a/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index 4d2e8a9c45..a28581eb53 100644 --- a/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -16,6 +16,9 @@ <ClCompile Include="..\..\src\cpp\client\create_channel.cc"> <Filter>src\cpp\client</Filter> </ClCompile> + <ClCompile Include="..\..\src\cpp\client\create_channel_internal.cc"> + <Filter>src\cpp\client</Filter> + </ClCompile> <ClCompile Include="..\..\src\cpp\client\credentials.cc"> <Filter>src\cpp\client</Filter> </ClCompile> @@ -25,9 +28,6 @@ <ClCompile Include="..\..\src\cpp\client\insecure_credentials.cc"> <Filter>src\cpp\client</Filter> </ClCompile> - <ClCompile Include="..\..\src\cpp\client\internal_stub.cc"> - <Filter>src\cpp\client</Filter> - </ClCompile> <ClCompile Include="..\..\src\cpp\common\call.cc"> <Filter>src\cpp\common</Filter> </ClCompile> @@ -93,10 +93,10 @@ <ClInclude Include="..\..\include\grpc++\byte_buffer.h"> <Filter>include\grpc++</Filter> </ClInclude> - <ClInclude Include="..\..\include\grpc++\channel_arguments.h"> + <ClInclude Include="..\..\include\grpc++\channel.h"> <Filter>include\grpc++</Filter> </ClInclude> - <ClInclude Include="..\..\include\grpc++\channel_interface.h"> + <ClInclude Include="..\..\include\grpc++\channel_arguments.h"> <Filter>include\grpc++</Filter> </ClInclude> <ClInclude Include="..\..\include\grpc++\client_context.h"> @@ -129,9 +129,6 @@ <ClInclude Include="..\..\include\grpc++\impl\grpc_library.h"> <Filter>include\grpc++\impl</Filter> </ClInclude> - <ClInclude Include="..\..\include\grpc++\impl\internal_stub.h"> - <Filter>include\grpc++\impl</Filter> - </ClInclude> <ClInclude Include="..\..\include\grpc++\impl\proto_utils.h"> <Filter>include\grpc++\impl</Filter> </ClInclude> @@ -197,7 +194,7 @@ </ClInclude> </ItemGroup> <ItemGroup> - <ClInclude Include="..\..\src\cpp\client\channel.h"> + <ClInclude Include="..\..\src\cpp\client\create_channel_internal.h"> <Filter>src\cpp\client</Filter> </ClInclude> <ClInclude Include="..\..\src\cpp\common\create_auth_context.h"> |