1 // Copyright 2016 The gRPC Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 15 // Service exported by server reflection. A more complete description of how
16 // server reflection works can be found at
17 // https://github.com/grpc/grpc/blob/master/doc/server-reflection.md
18 //
19 // The canonical version of this proto can be found at
20 // https://github.com/grpc/grpc-proto/blob/master/grpc/reflection/v1/reflection.proto
21 22 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
23 // versions:
24 // - protoc-gen-go-grpc v1.6.0
25 // - protoc v5.27.1
26 // source: grpc/reflection/v1/reflection.proto
27 28 package grpc_reflection_v1
29 30 import (
31 context "context"
32 grpc "google.golang.org/grpc"
33 codes "google.golang.org/grpc/codes"
34 status "google.golang.org/grpc/status"
35 )
36 37 // This is a compile-time assertion to ensure that this generated file
38 // is compatible with the grpc package it is being compiled against.
39 // Requires gRPC-Go v1.64.0 or later.
40 const _ = grpc.SupportPackageIsVersion9
41 42 const (
43 ServerReflection_ServerReflectionInfo_FullMethodName = "/grpc.reflection.v1.ServerReflection/ServerReflectionInfo"
44 )
45 46 // ServerReflectionClient is the client API for ServerReflection service.
47 //
48 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
49 type ServerReflectionClient interface {
50 // The reflection service is structured as a bidirectional stream, ensuring
51 // all related requests go to a single server.
52 ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse], error)
53 }
54 55 type serverReflectionClient struct {
56 cc grpc.ClientConnInterface
57 }
58 59 func NewServerReflectionClient(cc grpc.ClientConnInterface) ServerReflectionClient {
60 return &serverReflectionClient{cc}
61 }
62 63 func (c *serverReflectionClient) ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse], error) {
64 cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
65 stream, err := c.cc.NewStream(ctx, &ServerReflection_ServiceDesc.Streams[0], ServerReflection_ServerReflectionInfo_FullMethodName, cOpts...)
66 if err != nil {
67 return nil, err
68 }
69 x := &grpc.GenericClientStream[ServerReflectionRequest, ServerReflectionResponse]{ClientStream: stream}
70 return x, nil
71 }
72 73 // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
74 type ServerReflection_ServerReflectionInfoClient = grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse]
75 76 // ServerReflectionServer is the server API for ServerReflection service.
77 // All implementations should embed UnimplementedServerReflectionServer
78 // for forward compatibility.
79 type ServerReflectionServer interface {
80 // The reflection service is structured as a bidirectional stream, ensuring
81 // all related requests go to a single server.
82 ServerReflectionInfo(grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse]) error
83 }
84 85 // UnimplementedServerReflectionServer should be embedded to have
86 // forward compatible implementations.
87 //
88 // NOTE: this should be embedded by value instead of pointer to avoid a nil
89 // pointer dereference when methods are called.
90 type UnimplementedServerReflectionServer struct{}
91 92 func (UnimplementedServerReflectionServer) ServerReflectionInfo(grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse]) error {
93 return status.Error(codes.Unimplemented, "method ServerReflectionInfo not implemented")
94 }
95 func (UnimplementedServerReflectionServer) testEmbeddedByValue() {}
96 97 // UnsafeServerReflectionServer may be embedded to opt out of forward compatibility for this service.
98 // Use of this interface is not recommended, as added methods to ServerReflectionServer will
99 // result in compilation errors.
100 type UnsafeServerReflectionServer interface {
101 mustEmbedUnimplementedServerReflectionServer()
102 }
103 104 func RegisterServerReflectionServer(s grpc.ServiceRegistrar, srv ServerReflectionServer) {
105 // If the following call panics, it indicates UnimplementedServerReflectionServer was
106 // embedded by pointer and is nil. This will cause panics if an
107 // unimplemented method is ever invoked, so we test this at initialization
108 // time to prevent it from happening at runtime later due to I/O.
109 if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
110 t.testEmbeddedByValue()
111 }
112 s.RegisterService(&ServerReflection_ServiceDesc, srv)
113 }
114 115 func _ServerReflection_ServerReflectionInfo_Handler(srv interface{}, stream grpc.ServerStream) error {
116 return srv.(ServerReflectionServer).ServerReflectionInfo(&grpc.GenericServerStream[ServerReflectionRequest, ServerReflectionResponse]{ServerStream: stream})
117 }
118 119 // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
120 type ServerReflection_ServerReflectionInfoServer = grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse]
121 122 // ServerReflection_ServiceDesc is the grpc.ServiceDesc for ServerReflection service.
123 // It's only intended for direct use with grpc.RegisterService,
124 // and not to be introspected or modified (even as a copy)
125 var ServerReflection_ServiceDesc = grpc.ServiceDesc{
126 ServiceName: "grpc.reflection.v1.ServerReflection",
127 HandlerType: (*ServerReflectionServer)(nil),
128 Methods: []grpc.MethodDesc{},
129 Streams: []grpc.StreamDesc{
130 {
131 StreamName: "ServerReflectionInfo",
132 Handler: _ServerReflection_ServerReflectionInfo_Handler,
133 ServerStreams: true,
134 ClientStreams: true,
135 },
136 },
137 Metadata: "grpc/reflection/v1/reflection.proto",
138 }
139