Fix clang_format_code.sh issues and move the internal calls to new name

pull/18454/head
Karthik Ravi Shankar 6 years ago
parent 17ca558e13
commit 858b5cca20
  1. 4
      include/grpcpp/create_channel.h
  2. 4
      include/grpcpp/create_channel_impl.h
  3. 6
      include/grpcpp/security/credentials.h
  4. 8
      src/cpp/client/create_channel.cc
  5. 2
      src/cpp/client/insecure_credentials.cc
  6. 2
      src/cpp/client/secure_credentials.cc
  7. 2
      src/cpp/client/secure_credentials.h
  8. 4
      test/cpp/client/client_channel_stress_test.cc
  9. 8
      test/cpp/end2end/async_end2end_test.cc
  10. 7
      test/cpp/end2end/client_callback_end2end_test.cc
  11. 4
      test/cpp/end2end/end2end_test.cc
  12. 4
      test/cpp/microbenchmarks/fullstack_fixtures.h
  13. 6
      test/cpp/util/create_test_channel.cc

@ -26,14 +26,14 @@ namespace grpc {
static inline std::shared_ptr<Channel> CreateChannel( static inline std::shared_ptr<Channel> CreateChannel(
const grpc::string& target, const grpc::string& target,
const std::shared_ptr<ChannelCredentials>& creds) { const std::shared_ptr<ChannelCredentials>& creds) {
return ::grpc_impl::CreateChannel(target, creds); return ::grpc_impl::CreateChannelImpl(target, creds);
} }
static inline std::shared_ptr<Channel> CreateCustomChannel( static inline std::shared_ptr<Channel> CreateCustomChannel(
const grpc::string& target, const grpc::string& target,
const std::shared_ptr<ChannelCredentials>& creds, const std::shared_ptr<ChannelCredentials>& creds,
const ChannelArguments& args) { const ChannelArguments& args) {
return ::grpc_impl::CreateCustomChannel(target, creds, args); return ::grpc_impl::CreateCustomChannelImpl(target, creds, args);
} }
namespace experimental { namespace experimental {

@ -35,7 +35,7 @@ namespace grpc_impl {
/// \param creds Credentials to use for the created channel. If it does not /// \param creds Credentials to use for the created channel. If it does not
/// hold an object or is invalid, a lame channel (one on which all operations /// hold an object or is invalid, a lame channel (one on which all operations
/// fail) is returned. /// fail) is returned.
std::shared_ptr<grpc::Channel> CreateChannel( std::shared_ptr<grpc::Channel> CreateChannelImpl(
const grpc::string& target, const grpc::string& target,
const std::shared_ptr<grpc::ChannelCredentials>& creds); const std::shared_ptr<grpc::ChannelCredentials>& creds);
@ -49,7 +49,7 @@ std::shared_ptr<grpc::Channel> CreateChannel(
/// hold an object or is invalid, a lame channel (one on which all operations /// hold an object or is invalid, a lame channel (one on which all operations
/// fail) is returned. /// fail) is returned.
/// \param args Options for channel creation. /// \param args Options for channel creation.
std::shared_ptr<grpc::Channel> CreateCustomChannel( std::shared_ptr<grpc::Channel> CreateCustomChannelImpl(
const grpc::string& target, const grpc::string& target,
const std::shared_ptr<grpc::ChannelCredentials>& creds, const std::shared_ptr<grpc::ChannelCredentials>& creds,
const grpc::ChannelArguments& args); const grpc::ChannelArguments& args);

@ -38,7 +38,7 @@ class CallCredentials;
class ChannelCredentials; class ChannelCredentials;
} // namespace grpc } // namespace grpc
namespace grpc_impl { namespace grpc_impl {
std::shared_ptr<grpc::Channel> CreateCustomChannel( std::shared_ptr<grpc::Channel> CreateCustomChannelImpl(
const grpc::string& target, const grpc::string& target,
const std::shared_ptr<grpc::ChannelCredentials>& creds, const std::shared_ptr<grpc::ChannelCredentials>& creds,
const grpc::ChannelArguments& args); const grpc::ChannelArguments& args);
@ -77,7 +77,7 @@ class ChannelCredentials : private GrpcLibraryCodegen {
virtual SecureChannelCredentials* AsSecureCredentials() = 0; virtual SecureChannelCredentials* AsSecureCredentials() = 0;
private: private:
friend std::shared_ptr<Channel> grpc_impl::CreateCustomChannel( friend std::shared_ptr<Channel> grpc_impl::CreateCustomChannelImpl(
const grpc::string& target, const grpc::string& target,
const std::shared_ptr<ChannelCredentials>& creds, const std::shared_ptr<ChannelCredentials>& creds,
const grpc::ChannelArguments& args); const grpc::ChannelArguments& args);
@ -91,7 +91,7 @@ class ChannelCredentials : private GrpcLibraryCodegen {
grpc::experimental::ClientInterceptorFactoryInterface>> grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators); interceptor_creators);
virtual std::shared_ptr<Channel> CreateChannel( virtual std::shared_ptr<Channel> CreateChannelImpl(
const grpc::string& target, const ChannelArguments& args) = 0; const grpc::string& target, const ChannelArguments& args) = 0;
// This function should have been a pure virtual function, but it is // This function should have been a pure virtual function, but it is

@ -26,19 +26,19 @@
#include "src/cpp/client/create_channel_internal.h" #include "src/cpp/client/create_channel_internal.h"
namespace grpc_impl { namespace grpc_impl {
std::shared_ptr<grpc::Channel> CreateChannel( std::shared_ptr<grpc::Channel> CreateChannelImpl(
const grpc::string& target, const grpc::string& target,
const std::shared_ptr<grpc::ChannelCredentials>& creds) { const std::shared_ptr<grpc::ChannelCredentials>& creds) {
return CreateCustomChannel(target, creds, grpc::ChannelArguments()); return CreateCustomChannelImpl(target, creds, grpc::ChannelArguments());
} }
std::shared_ptr<grpc::Channel> CreateCustomChannel( std::shared_ptr<grpc::Channel> CreateCustomChannelImpl(
const grpc::string& target, const grpc::string& target,
const std::shared_ptr<grpc::ChannelCredentials>& creds, const std::shared_ptr<grpc::ChannelCredentials>& creds,
const grpc::ChannelArguments& args) { const grpc::ChannelArguments& args) {
grpc::GrpcLibraryCodegen grpc::GrpcLibraryCodegen
init_lib; // We need to call init in case of a bad creds. init_lib; // We need to call init in case of a bad creds.
return creds ? creds->CreateChannel(target, args) return creds ? creds->CreateChannelImpl(target, args)
: grpc::CreateChannelInternal( : grpc::CreateChannelInternal(
"", "",
grpc_lame_client_channel_create( grpc_lame_client_channel_create(

@ -30,7 +30,7 @@ namespace grpc {
namespace { namespace {
class InsecureChannelCredentialsImpl final : public ChannelCredentials { class InsecureChannelCredentialsImpl final : public ChannelCredentials {
public: public:
std::shared_ptr<grpc::Channel> CreateChannel( std::shared_ptr<grpc::Channel> CreateChannelImpl(
const string& target, const grpc::ChannelArguments& args) override { const string& target, const grpc::ChannelArguments& args) override {
return CreateChannelWithInterceptors( return CreateChannelWithInterceptors(
target, args, target, args,

@ -34,7 +34,7 @@ SecureChannelCredentials::SecureChannelCredentials(
g_gli_initializer.summon(); g_gli_initializer.summon();
} }
std::shared_ptr<grpc::Channel> SecureChannelCredentials::CreateChannel( std::shared_ptr<grpc::Channel> SecureChannelCredentials::CreateChannelImpl(
const string& target, const grpc::ChannelArguments& args) { const string& target, const grpc::ChannelArguments& args) {
return CreateChannelWithInterceptors( return CreateChannelWithInterceptors(
target, args, target, args,

@ -37,7 +37,7 @@ class SecureChannelCredentials final : public ChannelCredentials {
} }
grpc_channel_credentials* GetRawCreds() { return c_creds_; } grpc_channel_credentials* GetRawCreds() { return c_creds_; }
std::shared_ptr<grpc::Channel> CreateChannel( std::shared_ptr<grpc::Channel> CreateChannelImpl(
const string& target, const grpc::ChannelArguments& args) override; const string& target, const grpc::ChannelArguments& args) override;
SecureChannelCredentials* AsSecureCredentials() override { return this; } SecureChannelCredentials* AsSecureCredentials() override { return this; }

@ -268,8 +268,8 @@ class ClientChannelStressTest {
response_generator_.get()); response_generator_.get());
std::ostringstream uri; std::ostringstream uri;
uri << "fake:///servername_not_used"; uri << "fake:///servername_not_used";
channel_ = channel_ = ::grpc::CreateCustomChannel(uri.str(),
::grpc::CreateCustomChannel(uri.str(), InsecureChannelCredentials(), args); InsecureChannelCredentials(), args);
stub_ = grpc::testing::EchoTestService::NewStub(channel_); stub_ = grpc::testing::EchoTestService::NewStub(channel_);
} }

@ -294,8 +294,8 @@ class AsyncEnd2endTest : public ::testing::TestWithParam<TestScenario> {
auto channel_creds = GetCredentialsProvider()->GetChannelCredentials( auto channel_creds = GetCredentialsProvider()->GetChannelCredentials(
GetParam().credentials_type, &args); GetParam().credentials_type, &args);
std::shared_ptr<Channel> channel = std::shared_ptr<Channel> channel =
!(GetParam().inproc) !(GetParam().inproc) ? ::grpc::CreateCustomChannel(
? ::grpc::CreateCustomChannel(server_address_.str(), channel_creds, args) server_address_.str(), channel_creds, args)
: server_->InProcessChannel(args); : server_->InProcessChannel(args);
stub_ = grpc::testing::EchoTestService::NewStub(channel); stub_ = grpc::testing::EchoTestService::NewStub(channel);
} }
@ -1255,8 +1255,8 @@ TEST_P(AsyncEnd2endTest, UnimplementedRpc) {
const auto& channel_creds = GetCredentialsProvider()->GetChannelCredentials( const auto& channel_creds = GetCredentialsProvider()->GetChannelCredentials(
GetParam().credentials_type, &args); GetParam().credentials_type, &args);
std::shared_ptr<Channel> channel = std::shared_ptr<Channel> channel =
!(GetParam().inproc) !(GetParam().inproc) ? ::grpc::CreateCustomChannel(server_address_.str(),
? ::grpc::CreateCustomChannel(server_address_.str(), channel_creds, args) channel_creds, args)
: server_->InProcessChannel(args); : server_->InProcessChannel(args);
std::unique_ptr<grpc::testing::UnimplementedEchoService::Stub> stub; std::unique_ptr<grpc::testing::UnimplementedEchoService::Stub> stub;
stub = grpc::testing::UnimplementedEchoService::NewStub(channel); stub = grpc::testing::UnimplementedEchoService::NewStub(channel);

@ -142,8 +142,8 @@ class ClientCallbackEnd2endTest
switch (GetParam().protocol) { switch (GetParam().protocol) {
case Protocol::TCP: case Protocol::TCP:
if (!GetParam().use_interceptors) { if (!GetParam().use_interceptors) {
channel_ = channel_ = ::grpc::CreateCustomChannel(server_address_.str(),
::grpc::CreateCustomChannel(server_address_.str(), channel_creds, args); channel_creds, args);
} else { } else {
channel_ = CreateCustomChannelWithInterceptors( channel_ = CreateCustomChannelWithInterceptors(
server_address_.str(), channel_creds, args, server_address_.str(), channel_creds, args,
@ -1153,7 +1153,8 @@ TEST_P(ClientCallbackEnd2endTest, UnimplementedRpc) {
GetParam().credentials_type, &args); GetParam().credentials_type, &args);
std::shared_ptr<Channel> channel = std::shared_ptr<Channel> channel =
(GetParam().protocol == Protocol::TCP) (GetParam().protocol == Protocol::TCP)
? ::grpc::CreateCustomChannel(server_address_.str(), channel_creds, args) ? ::grpc::CreateCustomChannel(server_address_.str(), channel_creds,
args)
: server_->InProcessChannel(args); : server_->InProcessChannel(args);
std::unique_ptr<grpc::testing::UnimplementedEchoService::Stub> stub; std::unique_ptr<grpc::testing::UnimplementedEchoService::Stub> stub;
stub = grpc::testing::UnimplementedEchoService::NewStub(channel); stub = grpc::testing::UnimplementedEchoService::NewStub(channel);

@ -340,8 +340,8 @@ class End2endTest : public ::testing::TestWithParam<TestScenario> {
if (!GetParam().inproc) { if (!GetParam().inproc) {
if (!GetParam().use_interceptors) { if (!GetParam().use_interceptors) {
channel_ = channel_ = ::grpc::CreateCustomChannel(server_address_.str(),
::grpc::CreateCustomChannel(server_address_.str(), channel_creds, args); channel_creds, args);
} else { } else {
channel_ = CreateCustomChannelWithInterceptors( channel_ = CreateCustomChannelWithInterceptors(
server_address_.str(), channel_creds, args, server_address_.str(), channel_creds, args,

@ -86,8 +86,8 @@ class FullstackFixture : public BaseFixture {
ChannelArguments args; ChannelArguments args;
config.ApplyCommonChannelArguments(&args); config.ApplyCommonChannelArguments(&args);
if (address.length() > 0) { if (address.length() > 0) {
channel_ = channel_ = ::grpc::CreateCustomChannel(
::grpc::CreateCustomChannel(address, InsecureChannelCredentials(), args); address, InsecureChannelCredentials(), args);
} else { } else {
channel_ = server_->InProcessChannel(args); channel_ = server_->InProcessChannel(args);
} }

@ -132,7 +132,8 @@ std::shared_ptr<Channel> CreateTestChannel(
std::shared_ptr<ChannelCredentials> channel_creds; std::shared_ptr<ChannelCredentials> channel_creds;
if (cred_type.empty()) { if (cred_type.empty()) {
if (interceptor_creators.empty()) { if (interceptor_creators.empty()) {
return ::grpc::CreateCustomChannel(server, InsecureChannelCredentials(), args); return ::grpc::CreateCustomChannel(server, InsecureChannelCredentials(),
args);
} else { } else {
return experimental::CreateCustomChannelWithInterceptors( return experimental::CreateCustomChannelWithInterceptors(
server, InsecureChannelCredentials(), args, server, InsecureChannelCredentials(), args,
@ -159,7 +160,8 @@ std::shared_ptr<Channel> CreateTestChannel(
channel_creds = CompositeChannelCredentials(channel_creds, creds); channel_creds = CompositeChannelCredentials(channel_creds, creds);
} }
if (interceptor_creators.empty()) { if (interceptor_creators.empty()) {
return ::grpc::CreateCustomChannel(connect_to, channel_creds, channel_args); return ::grpc::CreateCustomChannel(connect_to, channel_creds,
channel_args);
} else { } else {
return experimental::CreateCustomChannelWithInterceptors( return experimental::CreateCustomChannelWithInterceptors(
connect_to, channel_creds, channel_args, connect_to, channel_creds, channel_args,

Loading…
Cancel
Save