2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
19
20
21
26#include <unordered_set>
29#include <grpcpp/grpcpp.h>
30#include <grpcpp/impl/codegen/config_protobuf.h>
31#include <grpcpp/support/config.h>
32#include <grpcpp/support/status.h>
33#include <grpcpp/support/sync_stream.h>
35#include <reflection.grpc.pb.h>
36#include <reflection.pb.h>
37#include <reflection_service.usrv.pb.hpp>
39#include <userver/concurrent/variable.hpp>
41USERVER_NAMESPACE_BEGIN
45class ProtoServerReflection
final :
public grpc::reflection::v1alpha::ServerReflectionBase {
47 ProtoServerReflection();
50 void AddService(std::string_view service);
53 void AddServiceList(
const std::vector<std::string_view>& services);
57 ServerReflectionInfoResult ServerReflectionInfo(CallContext& context, ServerReflectionInfoReaderWriter& stream)
61 grpc::Status ListService(grpc::reflection::v1alpha::ListServiceResponse& response);
64 GetFileByName(std::string_view file_name, grpc::reflection::v1alpha::ServerReflectionResponse& response);
67 GetFileContainingSymbol(std::string_view symbol, grpc::reflection::v1alpha::ServerReflectionResponse& response);
69 grpc::Status GetFileContainingExtension(
70 const grpc::reflection::v1alpha::ExtensionRequest& request,
71 grpc::reflection::v1alpha::ServerReflectionResponse& response
75 GetAllExtensionNumbers(std::string_view type, grpc::reflection::v1alpha::ExtensionNumberResponse& response);
77 void FillFileDescriptorResponse(
78 const grpc::protobuf::FileDescriptor& file_desc,
79 grpc::reflection::v1alpha::ServerReflectionResponse& response,
80 std::unordered_set<std::string_view>& seen_files
83 void FillErrorResponse(
const grpc::Status& status, grpc::reflection::v1alpha::ErrorResponse& error_response);
85 const grpc::protobuf::DescriptorPool* descriptor_pool_;
86 concurrent::Variable<std::unordered_set<std::string_view>> services_;