gitee.com/zhaochuninhefei/gmgo@v0.0.31-0.20240209061119-069254a02979/grpc/test/grpc_testing/test_grpc.pb.go (about) 1 // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 2 // versions: 3 // - protoc-gen-go-grpc v1.2.0 4 // - protoc v3.14.0 5 // source: test/grpc_testing/test.proto 6 7 package grpc_testing 8 9 import ( 10 context "context" 11 grpc "gitee.com/zhaochuninhefei/gmgo/grpc" 12 codes "gitee.com/zhaochuninhefei/gmgo/grpc/codes" 13 status "gitee.com/zhaochuninhefei/gmgo/grpc/status" 14 ) 15 16 // This is a compile-time assertion to ensure that this generated file 17 // is compatible with the grpc package it is being compiled against. 18 // Requires gRPC-Go v1.32.0 or later. 19 const _ = grpc.SupportPackageIsVersion7 20 21 // TestServiceClient is the client API for TestService service. 22 // 23 // 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. 24 type TestServiceClient interface { 25 // One empty request followed by one empty response. 26 EmptyCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) 27 // One request followed by one response. 28 // The server returns the client payload as-is. 29 UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) 30 // One request followed by a sequence of responses (streamed download). 31 // The server returns the payload with client desired type and sizes. 32 StreamingOutputCall(ctx context.Context, in *StreamingOutputCallRequest, opts ...grpc.CallOption) (TestService_StreamingOutputCallClient, error) 33 // A sequence of requests followed by one response (streamed upload). 34 // The server returns the aggregated size of client payload as the result. 35 StreamingInputCall(ctx context.Context, opts ...grpc.CallOption) (TestService_StreamingInputCallClient, error) 36 // A sequence of requests with each request served by the server immediately. 37 // As one request could lead to multiple responses, this interface 38 // demonstrates the idea of full duplexing. 39 FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_FullDuplexCallClient, error) 40 // A sequence of requests followed by a sequence of responses. 41 // The server buffers all the client requests and then serves them in order. A 42 // stream of responses are returned to the client when the server starts with 43 // first request. 44 HalfDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_HalfDuplexCallClient, error) 45 } 46 47 type testServiceClient struct { 48 cc grpc.ClientConnInterface 49 } 50 51 func NewTestServiceClient(cc grpc.ClientConnInterface) TestServiceClient { 52 return &testServiceClient{cc} 53 } 54 55 func (c *testServiceClient) EmptyCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) { 56 out := new(Empty) 57 err := c.cc.Invoke(ctx, "/grpc.testing.TestService/EmptyCall", in, out, opts...) 58 if err != nil { 59 return nil, err 60 } 61 return out, nil 62 } 63 64 func (c *testServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) { 65 out := new(SimpleResponse) 66 err := c.cc.Invoke(ctx, "/grpc.testing.TestService/UnaryCall", in, out, opts...) 67 if err != nil { 68 return nil, err 69 } 70 return out, nil 71 } 72 73 func (c *testServiceClient) StreamingOutputCall(ctx context.Context, in *StreamingOutputCallRequest, opts ...grpc.CallOption) (TestService_StreamingOutputCallClient, error) { 74 stream, err := c.cc.NewStream(ctx, &TestService_ServiceDesc.Streams[0], "/grpc.testing.TestService/StreamingOutputCall", opts...) 75 if err != nil { 76 return nil, err 77 } 78 x := &testServiceStreamingOutputCallClient{stream} 79 if err := x.ClientStream.SendMsg(in); err != nil { 80 return nil, err 81 } 82 if err := x.ClientStream.CloseSend(); err != nil { 83 return nil, err 84 } 85 return x, nil 86 } 87 88 type TestService_StreamingOutputCallClient interface { 89 Recv() (*StreamingOutputCallResponse, error) 90 grpc.ClientStream 91 } 92 93 type testServiceStreamingOutputCallClient struct { 94 grpc.ClientStream 95 } 96 97 func (x *testServiceStreamingOutputCallClient) Recv() (*StreamingOutputCallResponse, error) { 98 m := new(StreamingOutputCallResponse) 99 if err := x.ClientStream.RecvMsg(m); err != nil { 100 return nil, err 101 } 102 return m, nil 103 } 104 105 func (c *testServiceClient) StreamingInputCall(ctx context.Context, opts ...grpc.CallOption) (TestService_StreamingInputCallClient, error) { 106 stream, err := c.cc.NewStream(ctx, &TestService_ServiceDesc.Streams[1], "/grpc.testing.TestService/StreamingInputCall", opts...) 107 if err != nil { 108 return nil, err 109 } 110 x := &testServiceStreamingInputCallClient{stream} 111 return x, nil 112 } 113 114 type TestService_StreamingInputCallClient interface { 115 Send(*StreamingInputCallRequest) error 116 CloseAndRecv() (*StreamingInputCallResponse, error) 117 grpc.ClientStream 118 } 119 120 type testServiceStreamingInputCallClient struct { 121 grpc.ClientStream 122 } 123 124 func (x *testServiceStreamingInputCallClient) Send(m *StreamingInputCallRequest) error { 125 return x.ClientStream.SendMsg(m) 126 } 127 128 func (x *testServiceStreamingInputCallClient) CloseAndRecv() (*StreamingInputCallResponse, error) { 129 if err := x.ClientStream.CloseSend(); err != nil { 130 return nil, err 131 } 132 m := new(StreamingInputCallResponse) 133 if err := x.ClientStream.RecvMsg(m); err != nil { 134 return nil, err 135 } 136 return m, nil 137 } 138 139 func (c *testServiceClient) FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_FullDuplexCallClient, error) { 140 stream, err := c.cc.NewStream(ctx, &TestService_ServiceDesc.Streams[2], "/grpc.testing.TestService/FullDuplexCall", opts...) 141 if err != nil { 142 return nil, err 143 } 144 x := &testServiceFullDuplexCallClient{stream} 145 return x, nil 146 } 147 148 type TestService_FullDuplexCallClient interface { 149 Send(*StreamingOutputCallRequest) error 150 Recv() (*StreamingOutputCallResponse, error) 151 grpc.ClientStream 152 } 153 154 type testServiceFullDuplexCallClient struct { 155 grpc.ClientStream 156 } 157 158 func (x *testServiceFullDuplexCallClient) Send(m *StreamingOutputCallRequest) error { 159 return x.ClientStream.SendMsg(m) 160 } 161 162 func (x *testServiceFullDuplexCallClient) Recv() (*StreamingOutputCallResponse, error) { 163 m := new(StreamingOutputCallResponse) 164 if err := x.ClientStream.RecvMsg(m); err != nil { 165 return nil, err 166 } 167 return m, nil 168 } 169 170 func (c *testServiceClient) HalfDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_HalfDuplexCallClient, error) { 171 stream, err := c.cc.NewStream(ctx, &TestService_ServiceDesc.Streams[3], "/grpc.testing.TestService/HalfDuplexCall", opts...) 172 if err != nil { 173 return nil, err 174 } 175 x := &testServiceHalfDuplexCallClient{stream} 176 return x, nil 177 } 178 179 type TestService_HalfDuplexCallClient interface { 180 Send(*StreamingOutputCallRequest) error 181 Recv() (*StreamingOutputCallResponse, error) 182 grpc.ClientStream 183 } 184 185 type testServiceHalfDuplexCallClient struct { 186 grpc.ClientStream 187 } 188 189 func (x *testServiceHalfDuplexCallClient) Send(m *StreamingOutputCallRequest) error { 190 return x.ClientStream.SendMsg(m) 191 } 192 193 func (x *testServiceHalfDuplexCallClient) Recv() (*StreamingOutputCallResponse, error) { 194 m := new(StreamingOutputCallResponse) 195 if err := x.ClientStream.RecvMsg(m); err != nil { 196 return nil, err 197 } 198 return m, nil 199 } 200 201 // TestServiceServer is the server API for TestService service. 202 // All implementations must embed UnimplementedTestServiceServer 203 // for forward compatibility 204 type TestServiceServer interface { 205 // One empty request followed by one empty response. 206 EmptyCall(context.Context, *Empty) (*Empty, error) 207 // One request followed by one response. 208 // The server returns the client payload as-is. 209 UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error) 210 // One request followed by a sequence of responses (streamed download). 211 // The server returns the payload with client desired type and sizes. 212 StreamingOutputCall(*StreamingOutputCallRequest, TestService_StreamingOutputCallServer) error 213 // A sequence of requests followed by one response (streamed upload). 214 // The server returns the aggregated size of client payload as the result. 215 StreamingInputCall(TestService_StreamingInputCallServer) error 216 // A sequence of requests with each request served by the server immediately. 217 // As one request could lead to multiple responses, this interface 218 // demonstrates the idea of full duplexing. 219 FullDuplexCall(TestService_FullDuplexCallServer) error 220 // A sequence of requests followed by a sequence of responses. 221 // The server buffers all the client requests and then serves them in order. A 222 // stream of responses are returned to the client when the server starts with 223 // first request. 224 HalfDuplexCall(TestService_HalfDuplexCallServer) error 225 mustEmbedUnimplementedTestServiceServer() 226 } 227 228 // UnimplementedTestServiceServer must be embedded to have forward compatible implementations. 229 type UnimplementedTestServiceServer struct { 230 } 231 232 func (UnimplementedTestServiceServer) EmptyCall(context.Context, *Empty) (*Empty, error) { 233 return nil, status.Errorf(codes.Unimplemented, "method EmptyCall not implemented") 234 } 235 func (UnimplementedTestServiceServer) UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error) { 236 return nil, status.Errorf(codes.Unimplemented, "method UnaryCall not implemented") 237 } 238 func (UnimplementedTestServiceServer) StreamingOutputCall(*StreamingOutputCallRequest, TestService_StreamingOutputCallServer) error { 239 return status.Errorf(codes.Unimplemented, "method StreamingOutputCall not implemented") 240 } 241 func (UnimplementedTestServiceServer) StreamingInputCall(TestService_StreamingInputCallServer) error { 242 return status.Errorf(codes.Unimplemented, "method StreamingInputCall not implemented") 243 } 244 func (UnimplementedTestServiceServer) FullDuplexCall(TestService_FullDuplexCallServer) error { 245 return status.Errorf(codes.Unimplemented, "method FullDuplexCall not implemented") 246 } 247 func (UnimplementedTestServiceServer) HalfDuplexCall(TestService_HalfDuplexCallServer) error { 248 return status.Errorf(codes.Unimplemented, "method HalfDuplexCall not implemented") 249 } 250 func (UnimplementedTestServiceServer) mustEmbedUnimplementedTestServiceServer() {} 251 252 // UnsafeTestServiceServer may be embedded to opt out of forward compatibility for this service. 253 // Use of this interface is not recommended, as added methods to TestServiceServer will 254 // result in compilation errors. 255 type UnsafeTestServiceServer interface { 256 mustEmbedUnimplementedTestServiceServer() 257 } 258 259 func RegisterTestServiceServer(s grpc.ServiceRegistrar, srv TestServiceServer) { 260 s.RegisterService(&TestService_ServiceDesc, srv) 261 } 262 263 func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 264 in := new(Empty) 265 if err := dec(in); err != nil { 266 return nil, err 267 } 268 if interceptor == nil { 269 return srv.(TestServiceServer).EmptyCall(ctx, in) 270 } 271 info := &grpc.UnaryServerInfo{ 272 Server: srv, 273 FullMethod: "/grpc.testing.TestService/EmptyCall", 274 } 275 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 276 return srv.(TestServiceServer).EmptyCall(ctx, req.(*Empty)) 277 } 278 return interceptor(ctx, in, info, handler) 279 } 280 281 func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 282 in := new(SimpleRequest) 283 if err := dec(in); err != nil { 284 return nil, err 285 } 286 if interceptor == nil { 287 return srv.(TestServiceServer).UnaryCall(ctx, in) 288 } 289 info := &grpc.UnaryServerInfo{ 290 Server: srv, 291 FullMethod: "/grpc.testing.TestService/UnaryCall", 292 } 293 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 294 return srv.(TestServiceServer).UnaryCall(ctx, req.(*SimpleRequest)) 295 } 296 return interceptor(ctx, in, info, handler) 297 } 298 299 func _TestService_StreamingOutputCall_Handler(srv interface{}, stream grpc.ServerStream) error { 300 m := new(StreamingOutputCallRequest) 301 if err := stream.RecvMsg(m); err != nil { 302 return err 303 } 304 return srv.(TestServiceServer).StreamingOutputCall(m, &testServiceStreamingOutputCallServer{stream}) 305 } 306 307 type TestService_StreamingOutputCallServer interface { 308 Send(*StreamingOutputCallResponse) error 309 grpc.ServerStream 310 } 311 312 type testServiceStreamingOutputCallServer struct { 313 grpc.ServerStream 314 } 315 316 func (x *testServiceStreamingOutputCallServer) Send(m *StreamingOutputCallResponse) error { 317 return x.ServerStream.SendMsg(m) 318 } 319 320 func _TestService_StreamingInputCall_Handler(srv interface{}, stream grpc.ServerStream) error { 321 return srv.(TestServiceServer).StreamingInputCall(&testServiceStreamingInputCallServer{stream}) 322 } 323 324 type TestService_StreamingInputCallServer interface { 325 SendAndClose(*StreamingInputCallResponse) error 326 Recv() (*StreamingInputCallRequest, error) 327 grpc.ServerStream 328 } 329 330 type testServiceStreamingInputCallServer struct { 331 grpc.ServerStream 332 } 333 334 func (x *testServiceStreamingInputCallServer) SendAndClose(m *StreamingInputCallResponse) error { 335 return x.ServerStream.SendMsg(m) 336 } 337 338 func (x *testServiceStreamingInputCallServer) Recv() (*StreamingInputCallRequest, error) { 339 m := new(StreamingInputCallRequest) 340 if err := x.ServerStream.RecvMsg(m); err != nil { 341 return nil, err 342 } 343 return m, nil 344 } 345 346 func _TestService_FullDuplexCall_Handler(srv interface{}, stream grpc.ServerStream) error { 347 return srv.(TestServiceServer).FullDuplexCall(&testServiceFullDuplexCallServer{stream}) 348 } 349 350 type TestService_FullDuplexCallServer interface { 351 Send(*StreamingOutputCallResponse) error 352 Recv() (*StreamingOutputCallRequest, error) 353 grpc.ServerStream 354 } 355 356 type testServiceFullDuplexCallServer struct { 357 grpc.ServerStream 358 } 359 360 func (x *testServiceFullDuplexCallServer) Send(m *StreamingOutputCallResponse) error { 361 return x.ServerStream.SendMsg(m) 362 } 363 364 func (x *testServiceFullDuplexCallServer) Recv() (*StreamingOutputCallRequest, error) { 365 m := new(StreamingOutputCallRequest) 366 if err := x.ServerStream.RecvMsg(m); err != nil { 367 return nil, err 368 } 369 return m, nil 370 } 371 372 func _TestService_HalfDuplexCall_Handler(srv interface{}, stream grpc.ServerStream) error { 373 return srv.(TestServiceServer).HalfDuplexCall(&testServiceHalfDuplexCallServer{stream}) 374 } 375 376 type TestService_HalfDuplexCallServer interface { 377 Send(*StreamingOutputCallResponse) error 378 Recv() (*StreamingOutputCallRequest, error) 379 grpc.ServerStream 380 } 381 382 type testServiceHalfDuplexCallServer struct { 383 grpc.ServerStream 384 } 385 386 func (x *testServiceHalfDuplexCallServer) Send(m *StreamingOutputCallResponse) error { 387 return x.ServerStream.SendMsg(m) 388 } 389 390 func (x *testServiceHalfDuplexCallServer) Recv() (*StreamingOutputCallRequest, error) { 391 m := new(StreamingOutputCallRequest) 392 if err := x.ServerStream.RecvMsg(m); err != nil { 393 return nil, err 394 } 395 return m, nil 396 } 397 398 // TestService_ServiceDesc is the grpc.ServiceDesc for TestService service. 399 // It's only intended for direct use with grpc.RegisterService, 400 // and not to be introspected or modified (even as a copy) 401 var TestService_ServiceDesc = grpc.ServiceDesc{ 402 ServiceName: "grpc.testing.TestService", 403 HandlerType: (*TestServiceServer)(nil), 404 Methods: []grpc.MethodDesc{ 405 { 406 MethodName: "EmptyCall", 407 Handler: _TestService_EmptyCall_Handler, 408 }, 409 { 410 MethodName: "UnaryCall", 411 Handler: _TestService_UnaryCall_Handler, 412 }, 413 }, 414 Streams: []grpc.StreamDesc{ 415 { 416 StreamName: "StreamingOutputCall", 417 Handler: _TestService_StreamingOutputCall_Handler, 418 ServerStreams: true, 419 }, 420 { 421 StreamName: "StreamingInputCall", 422 Handler: _TestService_StreamingInputCall_Handler, 423 ClientStreams: true, 424 }, 425 { 426 StreamName: "FullDuplexCall", 427 Handler: _TestService_FullDuplexCall_Handler, 428 ServerStreams: true, 429 ClientStreams: true, 430 }, 431 { 432 StreamName: "HalfDuplexCall", 433 Handler: _TestService_HalfDuplexCall_Handler, 434 ServerStreams: true, 435 ClientStreams: true, 436 }, 437 }, 438 Metadata: "test/grpc_testing/test.proto", 439 }