google.golang.org/grpc@v1.72.2/reflection/grpc_reflection_v1alpha/reflection_grpc.pb.go (about) 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 // Service exported by server reflection 15 16 // Warning: this entire file is deprecated. Use this instead: 17 // https://github.com/grpc/grpc-proto/blob/master/grpc/reflection/v1/reflection.proto 18 19 // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 20 // versions: 21 // - protoc-gen-go-grpc v1.5.1 22 // - protoc v5.27.1 23 // grpc/reflection/v1alpha/reflection.proto is a deprecated file. 24 25 package grpc_reflection_v1alpha 26 27 import ( 28 context "context" 29 grpc "google.golang.org/grpc" 30 codes "google.golang.org/grpc/codes" 31 status "google.golang.org/grpc/status" 32 ) 33 34 // This is a compile-time assertion to ensure that this generated file 35 // is compatible with the grpc package it is being compiled against. 36 // Requires gRPC-Go v1.64.0 or later. 37 const _ = grpc.SupportPackageIsVersion9 38 39 const ( 40 ServerReflection_ServerReflectionInfo_FullMethodName = "/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo" 41 ) 42 43 // ServerReflectionClient is the client API for ServerReflection service. 44 // 45 // 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. 46 type ServerReflectionClient interface { 47 // The reflection service is structured as a bidirectional stream, ensuring 48 // all related requests go to a single server. 49 ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse], error) 50 } 51 52 type serverReflectionClient struct { 53 cc grpc.ClientConnInterface 54 } 55 56 func NewServerReflectionClient(cc grpc.ClientConnInterface) ServerReflectionClient { 57 return &serverReflectionClient{cc} 58 } 59 60 func (c *serverReflectionClient) ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse], error) { 61 cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 62 stream, err := c.cc.NewStream(ctx, &ServerReflection_ServiceDesc.Streams[0], ServerReflection_ServerReflectionInfo_FullMethodName, cOpts...) 63 if err != nil { 64 return nil, err 65 } 66 x := &grpc.GenericClientStream[ServerReflectionRequest, ServerReflectionResponse]{ClientStream: stream} 67 return x, nil 68 } 69 70 // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. 71 type ServerReflection_ServerReflectionInfoClient = grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse] 72 73 // ServerReflectionServer is the server API for ServerReflection service. 74 // All implementations should embed UnimplementedServerReflectionServer 75 // for forward compatibility. 76 type ServerReflectionServer interface { 77 // The reflection service is structured as a bidirectional stream, ensuring 78 // all related requests go to a single server. 79 ServerReflectionInfo(grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse]) error 80 } 81 82 // UnimplementedServerReflectionServer should be embedded to have 83 // forward compatible implementations. 84 // 85 // NOTE: this should be embedded by value instead of pointer to avoid a nil 86 // pointer dereference when methods are called. 87 type UnimplementedServerReflectionServer struct{} 88 89 func (UnimplementedServerReflectionServer) ServerReflectionInfo(grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse]) error { 90 return status.Errorf(codes.Unimplemented, "method ServerReflectionInfo not implemented") 91 } 92 func (UnimplementedServerReflectionServer) testEmbeddedByValue() {} 93 94 // UnsafeServerReflectionServer may be embedded to opt out of forward compatibility for this service. 95 // Use of this interface is not recommended, as added methods to ServerReflectionServer will 96 // result in compilation errors. 97 type UnsafeServerReflectionServer interface { 98 mustEmbedUnimplementedServerReflectionServer() 99 } 100 101 func RegisterServerReflectionServer(s grpc.ServiceRegistrar, srv ServerReflectionServer) { 102 // If the following call panics, it indicates UnimplementedServerReflectionServer was 103 // embedded by pointer and is nil. This will cause panics if an 104 // unimplemented method is ever invoked, so we test this at initialization 105 // time to prevent it from happening at runtime later due to I/O. 106 if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { 107 t.testEmbeddedByValue() 108 } 109 s.RegisterService(&ServerReflection_ServiceDesc, srv) 110 } 111 112 func _ServerReflection_ServerReflectionInfo_Handler(srv interface{}, stream grpc.ServerStream) error { 113 return srv.(ServerReflectionServer).ServerReflectionInfo(&grpc.GenericServerStream[ServerReflectionRequest, ServerReflectionResponse]{ServerStream: stream}) 114 } 115 116 // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. 117 type ServerReflection_ServerReflectionInfoServer = grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse] 118 119 // ServerReflection_ServiceDesc is the grpc.ServiceDesc for ServerReflection service. 120 // It's only intended for direct use with grpc.RegisterService, 121 // and not to be introspected or modified (even as a copy) 122 var ServerReflection_ServiceDesc = grpc.ServiceDesc{ 123 ServiceName: "grpc.reflection.v1alpha.ServerReflection", 124 HandlerType: (*ServerReflectionServer)(nil), 125 Methods: []grpc.MethodDesc{}, 126 Streams: []grpc.StreamDesc{ 127 { 128 StreamName: "ServerReflectionInfo", 129 Handler: _ServerReflection_ServerReflectionInfo_Handler, 130 ServerStreams: true, 131 ClientStreams: true, 132 }, 133 }, 134 Metadata: "grpc/reflection/v1alpha/reflection.proto", 135 }