diff options
author | 2015-08-19 16:28:09 -0700 | |
---|---|---|
committer | 2015-08-19 16:28:09 -0700 | |
commit | 8c2be9f22807870585111d88f5168dd11da99ce1 (patch) | |
tree | 2f7d8a372e68cb2c7ad04777e50bfbf927ededc6 /src/cpp | |
parent | 89bede02f16905eb48b71710dc4ea2542b3a5ca1 (diff) |
Remove ChannelInterface and replace it with Channel
Diffstat (limited to 'src/cpp')
-rw-r--r-- | src/cpp/client/channel.cc | 2 | ||||
-rw-r--r-- | src/cpp/client/channel.h | 80 | ||||
-rw-r--r-- | src/cpp/client/client_context.cc | 2 | ||||
-rw-r--r-- | src/cpp/client/create_channel.cc | 7 | ||||
-rw-r--r-- | src/cpp/client/insecure_credentials.cc | 6 | ||||
-rw-r--r-- | src/cpp/client/secure_credentials.cc | 6 | ||||
-rw-r--r-- | src/cpp/client/secure_credentials.h | 2 | ||||
-rw-r--r-- | src/cpp/common/call.cc | 2 |
8 files changed, 13 insertions, 94 deletions
diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc index 9695a0f14b..d9ffdc30cd 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> 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..704470693e 100644 --- a/src/cpp/client/create_channel.cc +++ b/src/cpp/client/create_channel.cc @@ -34,15 +34,14 @@ #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> 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; @@ -51,7 +50,7 @@ std::shared_ptr<ChannelInterface> CreateChannel( cp_args.SetString(GRPC_ARG_PRIMARY_USER_AGENT_STRING, user_agent_prefix.str()); return creds ? creds->CreateChannel(target, cp_args) - : std::shared_ptr<ChannelInterface>( + : std::shared_ptr<Channel>( new Channel(grpc_lame_client_channel_create( NULL, GRPC_STATUS_INVALID_ARGUMENT, "Invalid credentials."))); diff --git a/src/cpp/client/insecure_credentials.cc b/src/cpp/client/insecure_credentials.cc index 2f9357b568..70ce17dc6d 100644 --- a/src/cpp/client/insecure_credentials.cc +++ b/src/cpp/client/insecure_credentials.cc @@ -34,21 +34,21 @@ #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" 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( + return std::shared_ptr<Channel>(new Channel( grpc_insecure_channel_create(target.c_str(), &channel_args, nullptr))); } diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc index 6cd6b77fcf..b32f783fa3 100644 --- a/src/cpp/client/secure_credentials.cc +++ b/src/cpp/client/secure_credentials.cc @@ -33,18 +33,18 @@ #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/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 std::shared_ptr<Channel>(new Channel( args.GetSslTargetNameOverride(), grpc_secure_channel_create(c_creds_, target.c_str(), &channel_args))); } 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" |