From f9fac8a6b7ca7a7c660decf9d29b6c32a6691c3e Mon Sep 17 00:00:00 2001 From: Karthik Ravi Shankar Date: Mon, 13 Jul 2020 14:57:01 -0700 Subject: [PATCH] Move ProtoServerReflectionPlugin from grpc_impl to grpc namespace Reverts: https://github.com/grpc/grpc/pull/18600 --- BUILD | 1 - CMakeLists.txt | 1 - Makefile | 1 - .../ext/proto_server_reflection_plugin.h | 32 ++++++++--- .../ext/proto_server_reflection_plugin_impl.h | 55 ------------------- src/cpp/ext/proto_server_reflection_plugin.cc | 4 +- 6 files changed, 27 insertions(+), 67 deletions(-) delete mode 100644 include/grpcpp/ext/proto_server_reflection_plugin_impl.h diff --git a/BUILD b/BUILD index 48fa1dfdb4a..f1447b10838 100644 --- a/BUILD +++ b/BUILD @@ -2345,7 +2345,6 @@ grpc_cc_library( public_hdrs = [ "include/grpc++/ext/proto_server_reflection_plugin.h", "include/grpcpp/ext/proto_server_reflection_plugin.h", - "include/grpcpp/ext/proto_server_reflection_plugin_impl.h", ], deps = [ ":grpc++", diff --git a/CMakeLists.txt b/CMakeLists.txt index 61842a31b40..17368115ae8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3139,7 +3139,6 @@ target_link_libraries(grpc++_reflection foreach(_hdr include/grpc++/ext/proto_server_reflection_plugin.h include/grpcpp/ext/proto_server_reflection_plugin.h - include/grpcpp/ext/proto_server_reflection_plugin_impl.h ) string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) diff --git a/Makefile b/Makefile index 0cc937ebd15..ec80aee920a 100644 --- a/Makefile +++ b/Makefile @@ -5348,7 +5348,6 @@ LIBGRPC++_REFLECTION_SRC = \ PUBLIC_HEADERS_CXX += \ include/grpc++/ext/proto_server_reflection_plugin.h \ include/grpcpp/ext/proto_server_reflection_plugin.h \ - include/grpcpp/ext/proto_server_reflection_plugin_impl.h \ LIBGRPC++_REFLECTION_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC++_REFLECTION_SRC)))) diff --git a/include/grpcpp/ext/proto_server_reflection_plugin.h b/include/grpcpp/ext/proto_server_reflection_plugin.h index f6f2202ffb3..14b58cdfe0e 100644 --- a/include/grpcpp/ext/proto_server_reflection_plugin.h +++ b/include/grpcpp/ext/proto_server_reflection_plugin.h @@ -1,6 +1,6 @@ /* * - * Copyright 2019 gRPC authors. + * Copyright 2015 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,17 +19,35 @@ #ifndef GRPCPP_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H #define GRPCPP_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H -#include +#include +#include + +namespace grpc_impl { +class ServerInitializer; +} // namespace grpc_impl namespace grpc { +class ProtoServerReflection; + namespace reflection { -typedef ::grpc_impl::reflection::ProtoServerReflectionPlugin - ProtoServerReflectionPlugin; +class ProtoServerReflectionPlugin : public ::grpc::ServerBuilderPlugin { + public: + ProtoServerReflectionPlugin(); + ::std::string name() override; + void InitServer(::grpc_impl::ServerInitializer* si) override; + void Finish(::grpc_impl::ServerInitializer* si) override; + void ChangeArguments(const ::std::string& name, void* value) override; + bool has_async_methods() const override; + bool has_sync_methods() const override; + + private: + std::shared_ptr reflection_service_; +}; -static inline void InitProtoReflectionServerBuilderPlugin() { - ::grpc_impl::reflection::InitProtoReflectionServerBuilderPlugin(); -} +/// Add proto reflection plugin to \a ServerBuilder. +/// This function should be called at the static initialization time. +void InitProtoReflectionServerBuilderPlugin(); } // namespace reflection } // namespace grpc diff --git a/include/grpcpp/ext/proto_server_reflection_plugin_impl.h b/include/grpcpp/ext/proto_server_reflection_plugin_impl.h deleted file mode 100644 index bc51c2dda37..00000000000 --- a/include/grpcpp/ext/proto_server_reflection_plugin_impl.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * - * Copyright 2015 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_EXT_PROTO_SERVER_REFLECTION_PLUGIN_IMPL_H -#define GRPCPP_EXT_PROTO_SERVER_REFLECTION_PLUGIN_IMPL_H - -#include -#include - -namespace grpc { -class ProtoServerReflection; -} // namespace grpc - -namespace grpc_impl { -class ServerInitializer; - -namespace reflection { - -class ProtoServerReflectionPlugin : public ::grpc::ServerBuilderPlugin { - public: - ProtoServerReflectionPlugin(); - ::std::string name() override; - void InitServer(::grpc_impl::ServerInitializer* si) override; - void Finish(::grpc_impl::ServerInitializer* si) override; - void ChangeArguments(const ::std::string& name, void* value) override; - bool has_async_methods() const override; - bool has_sync_methods() const override; - - private: - std::shared_ptr reflection_service_; -}; - -/// Add proto reflection plugin to \a ServerBuilder. -/// This function should be called at the static initialization time. -void InitProtoReflectionServerBuilderPlugin(); - -} // namespace reflection -} // namespace grpc_impl - -#endif // GRPCPP_EXT_PROTO_SERVER_REFLECTION_PLUGIN_IMPL_H diff --git a/src/cpp/ext/proto_server_reflection_plugin.cc b/src/cpp/ext/proto_server_reflection_plugin.cc index 18d9cee6871..0a892d84c21 100644 --- a/src/cpp/ext/proto_server_reflection_plugin.cc +++ b/src/cpp/ext/proto_server_reflection_plugin.cc @@ -23,7 +23,7 @@ #include "src/cpp/ext/proto_server_reflection.h" -namespace grpc_impl { +namespace grpc { namespace reflection { ProtoServerReflectionPlugin::ProtoServerReflectionPlugin() @@ -80,4 +80,4 @@ struct StaticProtoReflectionPluginInitializer { } static_proto_reflection_plugin_initializer; } // namespace reflection -} // namespace grpc_impl +} // namespace grpc