Merge pull request #18373 from grpc/grpc_namespace_channel_create_posix

Move create_channel_posix from grpc to grpc_impl namespace
pull/18572/head
Karthik Ravi Shankar 6 years ago committed by GitHub
commit 3354f2c5a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      BUILD
  2. 1
      BUILD.gn
  3. 3
      CMakeLists.txt
  4. 3
      Makefile
  5. 1
      build.yaml
  6. 1
      gRPC-C++.podspec
  7. 46
      include/grpcpp/create_channel_posix.h
  8. 70
      include/grpcpp/create_channel_posix_impl.h
  9. 39
      src/cpp/client/create_channel_posix.cc
  10. 1
      tools/doxygen/Doxyfile.c++
  11. 1
      tools/doxygen/Doxyfile.c++.internal
  12. 2
      tools/run_tests/generated/sources_and_headers.json

@ -220,6 +220,7 @@ GRPCXX_PUBLIC_HDRS = [
"include/grpcpp/completion_queue.h", "include/grpcpp/completion_queue.h",
"include/grpcpp/create_channel.h", "include/grpcpp/create_channel.h",
"include/grpcpp/create_channel_posix.h", "include/grpcpp/create_channel_posix.h",
"include/grpcpp/create_channel_posix_impl.h",
"include/grpcpp/ext/health_check_service_server_builder_option.h", "include/grpcpp/ext/health_check_service_server_builder_option.h",
"include/grpcpp/generic/async_generic_service.h", "include/grpcpp/generic/async_generic_service.h",
"include/grpcpp/generic/generic_stub.h", "include/grpcpp/generic/generic_stub.h",

@ -1005,6 +1005,7 @@ config("grpc_config") {
"include/grpcpp/completion_queue.h", "include/grpcpp/completion_queue.h",
"include/grpcpp/create_channel.h", "include/grpcpp/create_channel.h",
"include/grpcpp/create_channel_posix.h", "include/grpcpp/create_channel_posix.h",
"include/grpcpp/create_channel_posix_impl.h",
"include/grpcpp/ext/health_check_service_server_builder_option.h", "include/grpcpp/ext/health_check_service_server_builder_option.h",
"include/grpcpp/generic/async_generic_service.h", "include/grpcpp/generic/async_generic_service.h",
"include/grpcpp/generic/generic_stub.h", "include/grpcpp/generic/generic_stub.h",

@ -3000,6 +3000,7 @@ foreach(_hdr
include/grpcpp/completion_queue.h include/grpcpp/completion_queue.h
include/grpcpp/create_channel.h include/grpcpp/create_channel.h
include/grpcpp/create_channel_posix.h include/grpcpp/create_channel_posix.h
include/grpcpp/create_channel_posix_impl.h
include/grpcpp/ext/health_check_service_server_builder_option.h include/grpcpp/ext/health_check_service_server_builder_option.h
include/grpcpp/generic/async_generic_service.h include/grpcpp/generic/async_generic_service.h
include/grpcpp/generic/generic_stub.h include/grpcpp/generic/generic_stub.h
@ -3592,6 +3593,7 @@ foreach(_hdr
include/grpcpp/completion_queue.h include/grpcpp/completion_queue.h
include/grpcpp/create_channel.h include/grpcpp/create_channel.h
include/grpcpp/create_channel_posix.h include/grpcpp/create_channel_posix.h
include/grpcpp/create_channel_posix_impl.h
include/grpcpp/ext/health_check_service_server_builder_option.h include/grpcpp/ext/health_check_service_server_builder_option.h
include/grpcpp/generic/async_generic_service.h include/grpcpp/generic/async_generic_service.h
include/grpcpp/generic/generic_stub.h include/grpcpp/generic/generic_stub.h
@ -4556,6 +4558,7 @@ foreach(_hdr
include/grpcpp/completion_queue.h include/grpcpp/completion_queue.h
include/grpcpp/create_channel.h include/grpcpp/create_channel.h
include/grpcpp/create_channel_posix.h include/grpcpp/create_channel_posix.h
include/grpcpp/create_channel_posix_impl.h
include/grpcpp/ext/health_check_service_server_builder_option.h include/grpcpp/ext/health_check_service_server_builder_option.h
include/grpcpp/generic/async_generic_service.h include/grpcpp/generic/async_generic_service.h
include/grpcpp/generic/generic_stub.h include/grpcpp/generic/generic_stub.h

@ -5327,6 +5327,7 @@ PUBLIC_HEADERS_CXX += \
include/grpcpp/completion_queue.h \ include/grpcpp/completion_queue.h \
include/grpcpp/create_channel.h \ include/grpcpp/create_channel.h \
include/grpcpp/create_channel_posix.h \ include/grpcpp/create_channel_posix.h \
include/grpcpp/create_channel_posix_impl.h \
include/grpcpp/ext/health_check_service_server_builder_option.h \ include/grpcpp/ext/health_check_service_server_builder_option.h \
include/grpcpp/generic/async_generic_service.h \ include/grpcpp/generic/async_generic_service.h \
include/grpcpp/generic/generic_stub.h \ include/grpcpp/generic/generic_stub.h \
@ -5927,6 +5928,7 @@ PUBLIC_HEADERS_CXX += \
include/grpcpp/completion_queue.h \ include/grpcpp/completion_queue.h \
include/grpcpp/create_channel.h \ include/grpcpp/create_channel.h \
include/grpcpp/create_channel_posix.h \ include/grpcpp/create_channel_posix.h \
include/grpcpp/create_channel_posix_impl.h \
include/grpcpp/ext/health_check_service_server_builder_option.h \ include/grpcpp/ext/health_check_service_server_builder_option.h \
include/grpcpp/generic/async_generic_service.h \ include/grpcpp/generic/async_generic_service.h \
include/grpcpp/generic/generic_stub.h \ include/grpcpp/generic/generic_stub.h \
@ -6840,6 +6842,7 @@ PUBLIC_HEADERS_CXX += \
include/grpcpp/completion_queue.h \ include/grpcpp/completion_queue.h \
include/grpcpp/create_channel.h \ include/grpcpp/create_channel.h \
include/grpcpp/create_channel_posix.h \ include/grpcpp/create_channel_posix.h \
include/grpcpp/create_channel_posix_impl.h \
include/grpcpp/ext/health_check_service_server_builder_option.h \ include/grpcpp/ext/health_check_service_server_builder_option.h \
include/grpcpp/generic/async_generic_service.h \ include/grpcpp/generic/async_generic_service.h \
include/grpcpp/generic/generic_stub.h \ include/grpcpp/generic/generic_stub.h \

@ -1345,6 +1345,7 @@ filegroups:
- include/grpcpp/completion_queue.h - include/grpcpp/completion_queue.h
- include/grpcpp/create_channel.h - include/grpcpp/create_channel.h
- include/grpcpp/create_channel_posix.h - include/grpcpp/create_channel_posix.h
- include/grpcpp/create_channel_posix_impl.h
- include/grpcpp/ext/health_check_service_server_builder_option.h - include/grpcpp/ext/health_check_service_server_builder_option.h
- include/grpcpp/generic/async_generic_service.h - include/grpcpp/generic/async_generic_service.h
- include/grpcpp/generic/generic_stub.h - include/grpcpp/generic/generic_stub.h

@ -86,6 +86,7 @@ Pod::Spec.new do |s|
'include/grpcpp/completion_queue.h', 'include/grpcpp/completion_queue.h',
'include/grpcpp/create_channel.h', 'include/grpcpp/create_channel.h',
'include/grpcpp/create_channel_posix.h', 'include/grpcpp/create_channel_posix.h',
'include/grpcpp/create_channel_posix_impl.h',
'include/grpcpp/ext/health_check_service_server_builder_option.h', 'include/grpcpp/ext/health_check_service_server_builder_option.h',
'include/grpcpp/generic/async_generic_service.h', 'include/grpcpp/generic/async_generic_service.h',
'include/grpcpp/generic/generic_stub.h', 'include/grpcpp/generic/generic_stub.h',

@ -1,6 +1,6 @@
/* /*
* *
* Copyright 2016 gRPC authors. * Copyright 2019 gRPC authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -19,46 +19,34 @@
#ifndef GRPCPP_CREATE_CHANNEL_POSIX_H #ifndef GRPCPP_CREATE_CHANNEL_POSIX_H
#define GRPCPP_CREATE_CHANNEL_POSIX_H #define GRPCPP_CREATE_CHANNEL_POSIX_H
#include <memory> #include <grpcpp/create_channel_posix_impl.h>
#include <grpc/support/port_platform.h>
#include <grpcpp/channel.h>
#include <grpcpp/support/channel_arguments.h>
namespace grpc { namespace grpc {
#ifdef GPR_SUPPORT_CHANNELS_FROM_FD #ifdef GPR_SUPPORT_CHANNELS_FROM_FD
/// Create a new \a Channel communicating over the given file descriptor. static inline std::shared_ptr<Channel> CreateInsecureChannelFromFd(
/// const grpc::string& target, int fd) {
/// \param target The name of the target. return ::grpc_impl::CreateInsecureChannelFromFd(target, fd);
/// \param fd The file descriptor representing a socket. }
std::shared_ptr<Channel> CreateInsecureChannelFromFd(const grpc::string& target,
int fd);
/// Create a new \a Channel communicating over given file descriptor with custom static inline std::shared_ptr<Channel> CreateCustomInsecureChannelFromFd(
/// channel arguments. const grpc::string& target, int fd, const ChannelArguments& args) {
/// return ::grpc_impl::CreateCustomInsecureChannelFromFd(target, fd, args);
/// \param target The name of the target. }
/// \param fd The file descriptor representing a socket.
/// \param args Options for channel creation.
std::shared_ptr<Channel> CreateCustomInsecureChannelFromFd(
const grpc::string& target, int fd, const ChannelArguments& args);
namespace experimental { namespace experimental {
/// Create a new \a Channel communicating over given file descriptor with custom static inline std::shared_ptr<Channel>
/// channel arguments. CreateCustomInsecureChannelWithInterceptorsFromFd(
///
/// \param target The name of the target.
/// \param fd The file descriptor representing a socket.
/// \param args Options for channel creation.
/// \param interceptor_creators Vector of interceptor factory objects.
std::shared_ptr<Channel> CreateCustomInsecureChannelWithInterceptorsFromFd(
const grpc::string& target, int fd, const ChannelArguments& args, const grpc::string& target, int fd, const ChannelArguments& args,
std::unique_ptr<std::vector< std::unique_ptr<std::vector<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>> std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>>
interceptor_creators); interceptor_creators) {
return ::grpc_impl::experimental::
CreateCustomInsecureChannelWithInterceptorsFromFd(
target, fd, args, std::move(interceptor_creators));
}
} // namespace experimental } // namespace experimental

@ -0,0 +1,70 @@
/*
*
* Copyright 2016 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GRPCPP_CREATE_CHANNEL_POSIX_IMPL_H
#define GRPCPP_CREATE_CHANNEL_POSIX_IMPL_H
#include <memory>
#include <grpc/support/port_platform.h>
#include <grpcpp/channel.h>
#include <grpcpp/support/channel_arguments.h>
namespace grpc_impl {
#ifdef GPR_SUPPORT_CHANNELS_FROM_FD
/// Create a new \a Channel communicating over the given file descriptor.
///
/// \param target The name of the target.
/// \param fd The file descriptor representing a socket.
std::shared_ptr<grpc::Channel> CreateInsecureChannelFromFd(
const grpc::string& target, int fd);
/// Create a new \a Channel communicating over given file descriptor with custom
/// channel arguments.
///
/// \param target The name of the target.
/// \param fd The file descriptor representing a socket.
/// \param args Options for channel creation.
std::shared_ptr<grpc::Channel> CreateCustomInsecureChannelFromFd(
const grpc::string& target, int fd, const grpc::ChannelArguments& args);
namespace experimental {
/// Create a new \a Channel communicating over given file descriptor with custom
/// channel arguments.
///
/// \param target The name of the target.
/// \param fd The file descriptor representing a socket.
/// \param args Options for channel creation.
/// \param interceptor_creators Vector of interceptor factory objects.
std::shared_ptr<grpc::Channel>
CreateCustomInsecureChannelWithInterceptorsFromFd(
const grpc::string& target, int fd, const grpc::ChannelArguments& args,
std::unique_ptr<std::vector<
std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>>>
interceptor_creators);
} // namespace experimental
#endif // GPR_SUPPORT_CHANNELS_FROM_FD
} // namespace grpc_impl
#endif // GRPCPP_CREATE_CHANNEL_POSIX_IMPL_H

@ -24,45 +24,46 @@
#include "src/cpp/client/create_channel_internal.h" #include "src/cpp/client/create_channel_internal.h"
namespace grpc { namespace grpc_impl {
#ifdef GPR_SUPPORT_CHANNELS_FROM_FD #ifdef GPR_SUPPORT_CHANNELS_FROM_FD
std::shared_ptr<Channel> CreateInsecureChannelFromFd(const grpc::string& target, std::shared_ptr<grpc::Channel> CreateInsecureChannelFromFd(
int fd) { const grpc::string& target, int fd) {
internal::GrpcLibrary init_lib; grpc::internal::GrpcLibrary init_lib;
init_lib.init(); init_lib.init();
return CreateChannelInternal( return grpc::CreateChannelInternal(
"", grpc_insecure_channel_create_from_fd(target.c_str(), fd, nullptr), "", grpc_insecure_channel_create_from_fd(target.c_str(), fd, nullptr),
std::vector< std::vector<std::unique_ptr<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>()); grpc::experimental::ClientInterceptorFactoryInterface>>());
} }
std::shared_ptr<Channel> CreateCustomInsecureChannelFromFd( std::shared_ptr<grpc::Channel> CreateCustomInsecureChannelFromFd(
const grpc::string& target, int fd, const ChannelArguments& args) { const grpc::string& target, int fd, const grpc::ChannelArguments& args) {
internal::GrpcLibrary init_lib; grpc::internal::GrpcLibrary init_lib;
init_lib.init(); init_lib.init();
grpc_channel_args channel_args; grpc_channel_args channel_args;
args.SetChannelArgs(&channel_args); args.SetChannelArgs(&channel_args);
return CreateChannelInternal( return grpc::CreateChannelInternal(
"", "",
grpc_insecure_channel_create_from_fd(target.c_str(), fd, &channel_args), grpc_insecure_channel_create_from_fd(target.c_str(), fd, &channel_args),
std::vector< std::vector<std::unique_ptr<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>()); grpc::experimental::ClientInterceptorFactoryInterface>>());
} }
namespace experimental { namespace experimental {
std::shared_ptr<Channel> CreateCustomInsecureChannelWithInterceptorsFromFd( std::shared_ptr<grpc::Channel>
const grpc::string& target, int fd, const ChannelArguments& args, CreateCustomInsecureChannelWithInterceptorsFromFd(
const grpc::string& target, int fd, const grpc::ChannelArguments& args,
std::vector< std::vector<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators) { interceptor_creators) {
internal::GrpcLibrary init_lib; grpc::internal::GrpcLibrary init_lib;
init_lib.init(); init_lib.init();
grpc_channel_args channel_args; grpc_channel_args channel_args;
args.SetChannelArgs(&channel_args); args.SetChannelArgs(&channel_args);
return CreateChannelInternal( return grpc::CreateChannelInternal(
"", "",
grpc_insecure_channel_create_from_fd(target.c_str(), fd, &channel_args), grpc_insecure_channel_create_from_fd(target.c_str(), fd, &channel_args),
std::move(interceptor_creators)); std::move(interceptor_creators));
@ -72,4 +73,4 @@ std::shared_ptr<Channel> CreateCustomInsecureChannelWithInterceptorsFromFd(
#endif // GPR_SUPPORT_CHANNELS_FROM_FD #endif // GPR_SUPPORT_CHANNELS_FROM_FD
} // namespace grpc } // namespace grpc_impl

@ -931,6 +931,7 @@ include/grpcpp/client_context.h \
include/grpcpp/completion_queue.h \ include/grpcpp/completion_queue.h \
include/grpcpp/create_channel.h \ include/grpcpp/create_channel.h \
include/grpcpp/create_channel_posix.h \ include/grpcpp/create_channel_posix.h \
include/grpcpp/create_channel_posix_impl.h \
include/grpcpp/ext/health_check_service_server_builder_option.h \ include/grpcpp/ext/health_check_service_server_builder_option.h \
include/grpcpp/generic/async_generic_service.h \ include/grpcpp/generic/async_generic_service.h \
include/grpcpp/generic/generic_stub.h \ include/grpcpp/generic/generic_stub.h \

@ -932,6 +932,7 @@ include/grpcpp/client_context.h \
include/grpcpp/completion_queue.h \ include/grpcpp/completion_queue.h \
include/grpcpp/create_channel.h \ include/grpcpp/create_channel.h \
include/grpcpp/create_channel_posix.h \ include/grpcpp/create_channel_posix.h \
include/grpcpp/create_channel_posix_impl.h \
include/grpcpp/ext/health_check_service_server_builder_option.h \ include/grpcpp/ext/health_check_service_server_builder_option.h \
include/grpcpp/generic/async_generic_service.h \ include/grpcpp/generic/async_generic_service.h \
include/grpcpp/generic/generic_stub.h \ include/grpcpp/generic/generic_stub.h \

@ -10067,6 +10067,7 @@
"include/grpcpp/completion_queue.h", "include/grpcpp/completion_queue.h",
"include/grpcpp/create_channel.h", "include/grpcpp/create_channel.h",
"include/grpcpp/create_channel_posix.h", "include/grpcpp/create_channel_posix.h",
"include/grpcpp/create_channel_posix_impl.h",
"include/grpcpp/ext/health_check_service_server_builder_option.h", "include/grpcpp/ext/health_check_service_server_builder_option.h",
"include/grpcpp/generic/async_generic_service.h", "include/grpcpp/generic/async_generic_service.h",
"include/grpcpp/generic/generic_stub.h", "include/grpcpp/generic/generic_stub.h",
@ -10177,6 +10178,7 @@
"include/grpcpp/completion_queue.h", "include/grpcpp/completion_queue.h",
"include/grpcpp/create_channel.h", "include/grpcpp/create_channel.h",
"include/grpcpp/create_channel_posix.h", "include/grpcpp/create_channel_posix.h",
"include/grpcpp/create_channel_posix_impl.h",
"include/grpcpp/ext/health_check_service_server_builder_option.h", "include/grpcpp/ext/health_check_service_server_builder_option.h",
"include/grpcpp/generic/async_generic_service.h", "include/grpcpp/generic/async_generic_service.h",
"include/grpcpp/generic/generic_stub.h", "include/grpcpp/generic/generic_stub.h",

Loading…
Cancel
Save