dubbo.apache.org/dubbo-go/v3@v3.1.1/protocol/dubbo3/reflection/triple_reflection_v1alpha/reflection_triple.pb.go (about) 1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. 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 // Code generated by protoc-gen-go-triple. DO NOT EDIT. 19 // versions: 20 // - protoc-gen-go-triple v1.0.8 21 // - protoc v3.14.0 22 // source: reflection.proto 23 24 package triple_reflection_v1alpha 25 26 import ( 27 context "context" 28 fmt "fmt" 29 ) 30 31 import ( 32 grpc_go "github.com/dubbogo/grpc-go" 33 codes "github.com/dubbogo/grpc-go/codes" 34 metadata "github.com/dubbogo/grpc-go/metadata" 35 status "github.com/dubbogo/grpc-go/status" 36 37 constant "github.com/dubbogo/triple/pkg/common/constant" 38 triple "github.com/dubbogo/triple/pkg/triple" 39 ) 40 41 import ( 42 constant1 "dubbo.apache.org/dubbo-go/v3/common/constant" 43 protocol "dubbo.apache.org/dubbo-go/v3/protocol" 44 dubbo3 "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3" 45 invocation "dubbo.apache.org/dubbo-go/v3/protocol/invocation" 46 ) 47 48 // This is a compile-time assertion to ensure that this generated file 49 // is compatible with the grpc package it is being compiled against. 50 const _ = grpc_go.SupportPackageIsVersion7 51 52 // ServerReflectionClient is the client API for ServerReflection service. 53 // 54 // 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. 55 type ServerReflectionClient interface { 56 // The reflection service is structured as a bidirectional stream, ensuring 57 // all related requests go to a single server. 58 ServerReflectionInfo(ctx context.Context, opts ...grpc_go.CallOption) (ServerReflection_ServerReflectionInfoClient, error) 59 } 60 61 type serverReflectionClient struct { 62 cc *triple.TripleConn 63 } 64 65 type ServerReflectionClientImpl struct { 66 ServerReflectionInfo func(ctx context.Context) (ServerReflection_ServerReflectionInfoClient, error) 67 } 68 69 func (c *ServerReflectionClientImpl) GetDubboStub(cc *triple.TripleConn) ServerReflectionClient { 70 return NewServerReflectionClient(cc) 71 } 72 73 func (c *ServerReflectionClientImpl) XXX_InterfaceName() string { 74 return "triple.reflection.v1alpha.ServerReflection" 75 } 76 77 func NewServerReflectionClient(cc *triple.TripleConn) ServerReflectionClient { 78 return &serverReflectionClient{cc} 79 } 80 81 func (c *serverReflectionClient) ServerReflectionInfo(ctx context.Context, opts ...grpc_go.CallOption) (ServerReflection_ServerReflectionInfoClient, error) { 82 interfaceKey := ctx.Value(constant.InterfaceKey).(string) 83 stream, err := c.cc.NewStream(ctx, "/"+interfaceKey+"/ServerReflectionInfo", opts...) 84 if err != nil { 85 return nil, err 86 } 87 x := &serverReflectionServerReflectionInfoClient{stream} 88 return x, nil 89 } 90 91 type ServerReflection_ServerReflectionInfoClient interface { 92 Send(*ServerReflectionRequest) error 93 Recv() (*ServerReflectionResponse, error) 94 grpc_go.ClientStream 95 } 96 97 type serverReflectionServerReflectionInfoClient struct { 98 grpc_go.ClientStream 99 } 100 101 func (x *serverReflectionServerReflectionInfoClient) Send(m *ServerReflectionRequest) error { 102 return x.ClientStream.SendMsg(m) 103 } 104 105 func (x *serverReflectionServerReflectionInfoClient) Recv() (*ServerReflectionResponse, error) { 106 m := new(ServerReflectionResponse) 107 if err := x.ClientStream.RecvMsg(m); err != nil { 108 return nil, err 109 } 110 return m, nil 111 } 112 113 // ServerReflectionServer is the server API for ServerReflection service. 114 // All implementations must embed UnimplementedServerReflectionServer 115 // for forward compatibility 116 type ServerReflectionServer interface { 117 // The reflection service is structured as a bidirectional stream, ensuring 118 // all related requests go to a single server. 119 ServerReflectionInfo(ServerReflection_ServerReflectionInfoServer) error 120 mustEmbedUnimplementedServerReflectionServer() 121 } 122 123 // UnimplementedServerReflectionServer must be embedded to have forward compatible implementations. 124 type UnimplementedServerReflectionServer struct { 125 proxyImpl protocol.Invoker 126 } 127 128 func (UnimplementedServerReflectionServer) ServerReflectionInfo(ServerReflection_ServerReflectionInfoServer) error { 129 return status.Errorf(codes.Unimplemented, "method ServerReflectionInfo not implemented") 130 } 131 func (s *UnimplementedServerReflectionServer) XXX_SetProxyImpl(impl protocol.Invoker) { 132 s.proxyImpl = impl 133 } 134 135 func (s *UnimplementedServerReflectionServer) XXX_GetProxyImpl() protocol.Invoker { 136 return s.proxyImpl 137 } 138 139 func (s *UnimplementedServerReflectionServer) XXX_ServiceDesc() *grpc_go.ServiceDesc { 140 return &ServerReflection_ServiceDesc 141 } 142 func (s *UnimplementedServerReflectionServer) XXX_InterfaceName() string { 143 return "triple.reflection.v1alpha.ServerReflection" 144 } 145 146 func (UnimplementedServerReflectionServer) mustEmbedUnimplementedServerReflectionServer() {} 147 148 // UnsafeServerReflectionServer may be embedded to opt out of forward compatibility for this service. 149 // Use of this interface is not recommended, as added methods to ServerReflectionServer will 150 // result in compilation errors. 151 type UnsafeServerReflectionServer interface { 152 mustEmbedUnimplementedServerReflectionServer() 153 } 154 155 func RegisterServerReflectionServer(s grpc_go.ServiceRegistrar, srv ServerReflectionServer) { 156 s.RegisterService(&ServerReflection_ServiceDesc, srv) 157 } 158 159 func _ServerReflection_ServerReflectionInfo_Handler(srv interface{}, stream grpc_go.ServerStream) error { 160 _, ok := srv.(dubbo3.Dubbo3GrpcService) 161 ctx := stream.Context() 162 md, _ := metadata.FromIncomingContext(ctx) 163 invAttachment := make(map[string]interface{}, len(md)) 164 for k, v := range md { 165 invAttachment[k] = v 166 } 167 stream.(grpc_go.CtxSetterStream).SetContext(context.WithValue(ctx, constant1.AttachmentKey, invAttachment)) 168 invo := invocation.NewRPCInvocation("ServerReflectionInfo", nil, nil) 169 if !ok { 170 fmt.Println(invo) 171 return nil 172 } 173 return srv.(ServerReflectionServer).ServerReflectionInfo(&serverReflectionServerReflectionInfoServer{stream}) 174 } 175 176 type ServerReflection_ServerReflectionInfoServer interface { 177 Send(*ServerReflectionResponse) error 178 Recv() (*ServerReflectionRequest, error) 179 grpc_go.ServerStream 180 } 181 182 type serverReflectionServerReflectionInfoServer struct { 183 grpc_go.ServerStream 184 } 185 186 func (x *serverReflectionServerReflectionInfoServer) Send(m *ServerReflectionResponse) error { 187 return x.ServerStream.SendMsg(m) 188 } 189 190 func (x *serverReflectionServerReflectionInfoServer) Recv() (*ServerReflectionRequest, error) { 191 m := new(ServerReflectionRequest) 192 if err := x.ServerStream.RecvMsg(m); err != nil { 193 return nil, err 194 } 195 return m, nil 196 } 197 198 // ServerReflection_ServiceDesc is the grpc_go.ServiceDesc for ServerReflection service. 199 // It's only intended for direct use with grpc_go.RegisterService, 200 // and not to be introspected or modified (even as a copy) 201 var ServerReflection_ServiceDesc = grpc_go.ServiceDesc{ 202 ServiceName: "triple.reflection.v1alpha.ServerReflection", 203 HandlerType: (*ServerReflectionServer)(nil), 204 Methods: []grpc_go.MethodDesc{}, 205 Streams: []grpc_go.StreamDesc{ 206 { 207 StreamName: "ServerReflectionInfo", 208 Handler: _ServerReflection_ServerReflectionInfo_Handler, 209 ServerStreams: true, 210 ClientStreams: true, 211 }, 212 }, 213 Metadata: "reflection.proto", 214 }