proto_server_reflection_plugin.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
22 #include <grpcpp/server_builder.h>
23 
25 
26 namespace grpc {
27 namespace reflection {
28 
30  : reflection_service_(new grpc::ProtoServerReflection()) {}
31 
33  return "proto_server_reflection";
34 }
35 
38 }
39 
41  reflection_service_->SetServiceList(si->GetServiceList());
42 }
43 
45  void* /*value*/) {}
46 
48  if (reflection_service_) {
49  return reflection_service_->has_synchronous_methods();
50  }
51  return false;
52 }
53 
55  if (reflection_service_) {
56  return reflection_service_->has_async_methods();
57  }
58  return false;
59 }
60 
61 static std::unique_ptr<grpc::ServerBuilderPlugin> CreateProtoReflection() {
62  return std::unique_ptr<grpc::ServerBuilderPlugin>(
64 }
65 
67  static struct Initialize {
68  Initialize() {
70  }
71  } initializer;
72 }
73 
74 // Force InitProtoReflectionServerBuilderPlugin() to be called at static
75 // initialization time.
79  }
81 
82 } // namespace reflection
83 } // namespace grpc
server_initializer.h
grpc
Definition: grpcpp/alarm.h:33
grpc::reflection::ProtoServerReflectionPlugin::reflection_service_
std::shared_ptr< grpc::ProtoServerReflection > reflection_service_
Definition: grpcpp/ext/proto_server_reflection_plugin.h:42
grpc::reflection::ProtoServerReflectionPlugin::has_sync_methods
bool has_sync_methods() const override
Definition: proto_server_reflection_plugin.cc:47
grpc::reflection::ProtoServerReflectionPlugin::ChangeArguments
void ChangeArguments(const ::std::string &name, void *value) override
Definition: proto_server_reflection_plugin.cc:44
proto_server_reflection_plugin.h
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
grpc::reflection::ProtoServerReflectionPlugin::name
::std::string name() override
Definition: proto_server_reflection_plugin.cc:32
grpc::reflection::ProtoServerReflectionPlugin::ProtoServerReflectionPlugin
ProtoServerReflectionPlugin()
Definition: proto_server_reflection_plugin.cc:29
env.new
def new
Definition: env.py:51
grpc::reflection::ProtoServerReflectionPlugin::Finish
void Finish(ServerInitializer *si) override
Finish will be called at the end of ServerBuilder::BuildAndStart().
Definition: proto_server_reflection_plugin.cc:40
server_builder_plugin.h
grpc::reflection::StaticProtoReflectionPluginInitializer::StaticProtoReflectionPluginInitializer
StaticProtoReflectionPluginInitializer()
Definition: proto_server_reflection_plugin.cc:77
grpc::ServerInitializer::GetServiceList
const std::vector< std::string > * GetServiceList()
Definition: grpcpp/impl/server_initializer.h:43
benchmark::Initialize
void Initialize(int *argc, char **argv)
Definition: benchmark/src/benchmark.cc:602
grpc::ProtoServerReflection
Definition: proto_server_reflection.h:37
grpc::reflection::ProtoServerReflectionPlugin::InitServer
void InitServer(ServerInitializer *si) override
Definition: proto_server_reflection_plugin.cc:36
grpc::reflection::StaticProtoReflectionPluginInitializer
Definition: proto_server_reflection_plugin.cc:76
grpc::reflection::ProtoServerReflectionPlugin
Definition: grpcpp/ext/proto_server_reflection_plugin.h:31
grpc::reflection::static_proto_reflection_plugin_initializer
struct grpc::reflection::StaticProtoReflectionPluginInitializer static_proto_reflection_plugin_initializer
grpc::ServerInitializer::RegisterService
bool RegisterService(std::shared_ptr< grpc::Service > service)
Definition: grpcpp/impl/server_initializer.h:35
grpc::ServerBuilder::InternalAddPluginFactory
static void InternalAddPluginFactory(std::unique_ptr< grpc::ServerBuilderPlugin >(*CreatePlugin)())
For internal use only: Register a ServerBuilderPlugin factory function.
Definition: server_builder.cc:458
proto_server_reflection.h
grpc::ServerInitializer
Definition: grpcpp/impl/server_initializer.h:31
grpc::reflection::InitProtoReflectionServerBuilderPlugin
void InitProtoReflectionServerBuilderPlugin()
Definition: proto_server_reflection_plugin.cc:66
server_builder.h
grpc::reflection::ProtoServerReflectionPlugin::has_async_methods
bool has_async_methods() const override
Definition: proto_server_reflection_plugin.cc:54
grpc::reflection::CreateProtoReflection
static std::unique_ptr< grpc::ServerBuilderPlugin > CreateProtoReflection()
Definition: proto_server_reflection_plugin.cc:61


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:56