gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/grpc/interop/grpc_testing/benchmark_service_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: grpc/testing/benchmark_service.proto 6 7 package grpc_testing 8 9 import ( 10 context "context" 11 grpc "gitee.com/ks-custle/core-gm/grpc" 12 codes "gitee.com/ks-custle/core-gm/grpc/codes" 13 status "gitee.com/ks-custle/core-gm/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 // BenchmarkServiceClient is the client API for BenchmarkService 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 BenchmarkServiceClient interface { 25 // One request followed by one response. 26 // The server returns the client payload as-is. 27 UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) 28 // Repeated sequence of one request followed by one response. 29 // Should be called streaming ping-pong 30 // The server returns the client payload as-is on each response 31 StreamingCall(ctx context.Context, opts ...grpc.CallOption) (BenchmarkService_StreamingCallClient, error) 32 // Single-sided unbounded streaming from client to server 33 // The server returns the client payload as-is once the client does WritesDone 34 StreamingFromClient(ctx context.Context, opts ...grpc.CallOption) (BenchmarkService_StreamingFromClientClient, error) 35 // Single-sided unbounded streaming from server to client 36 // The server repeatedly returns the client payload as-is 37 StreamingFromServer(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (BenchmarkService_StreamingFromServerClient, error) 38 // Two-sided unbounded streaming between server to client 39 // Both sides send the content of their own choice to the other 40 StreamingBothWays(ctx context.Context, opts ...grpc.CallOption) (BenchmarkService_StreamingBothWaysClient, error) 41 } 42 43 type benchmarkServiceClient struct { 44 cc grpc.ClientConnInterface 45 } 46 47 func NewBenchmarkServiceClient(cc grpc.ClientConnInterface) BenchmarkServiceClient { 48 return &benchmarkServiceClient{cc} 49 } 50 51 func (c *benchmarkServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) { 52 out := new(SimpleResponse) 53 err := c.cc.Invoke(ctx, "/grpc.testing.BenchmarkService/UnaryCall", in, out, opts...) 54 if err != nil { 55 return nil, err 56 } 57 return out, nil 58 } 59 60 func (c *benchmarkServiceClient) StreamingCall(ctx context.Context, opts ...grpc.CallOption) (BenchmarkService_StreamingCallClient, error) { 61 stream, err := c.cc.NewStream(ctx, &BenchmarkService_ServiceDesc.Streams[0], "/grpc.testing.BenchmarkService/StreamingCall", opts...) 62 if err != nil { 63 return nil, err 64 } 65 x := &benchmarkServiceStreamingCallClient{stream} 66 return x, nil 67 } 68 69 type BenchmarkService_StreamingCallClient interface { 70 Send(*SimpleRequest) error 71 Recv() (*SimpleResponse, error) 72 grpc.ClientStream 73 } 74 75 type benchmarkServiceStreamingCallClient struct { 76 grpc.ClientStream 77 } 78 79 func (x *benchmarkServiceStreamingCallClient) Send(m *SimpleRequest) error { 80 return x.ClientStream.SendMsg(m) 81 } 82 83 func (x *benchmarkServiceStreamingCallClient) Recv() (*SimpleResponse, error) { 84 m := new(SimpleResponse) 85 if err := x.ClientStream.RecvMsg(m); err != nil { 86 return nil, err 87 } 88 return m, nil 89 } 90 91 func (c *benchmarkServiceClient) StreamingFromClient(ctx context.Context, opts ...grpc.CallOption) (BenchmarkService_StreamingFromClientClient, error) { 92 stream, err := c.cc.NewStream(ctx, &BenchmarkService_ServiceDesc.Streams[1], "/grpc.testing.BenchmarkService/StreamingFromClient", opts...) 93 if err != nil { 94 return nil, err 95 } 96 x := &benchmarkServiceStreamingFromClientClient{stream} 97 return x, nil 98 } 99 100 type BenchmarkService_StreamingFromClientClient interface { 101 Send(*SimpleRequest) error 102 CloseAndRecv() (*SimpleResponse, error) 103 grpc.ClientStream 104 } 105 106 type benchmarkServiceStreamingFromClientClient struct { 107 grpc.ClientStream 108 } 109 110 func (x *benchmarkServiceStreamingFromClientClient) Send(m *SimpleRequest) error { 111 return x.ClientStream.SendMsg(m) 112 } 113 114 func (x *benchmarkServiceStreamingFromClientClient) CloseAndRecv() (*SimpleResponse, error) { 115 if err := x.ClientStream.CloseSend(); err != nil { 116 return nil, err 117 } 118 m := new(SimpleResponse) 119 if err := x.ClientStream.RecvMsg(m); err != nil { 120 return nil, err 121 } 122 return m, nil 123 } 124 125 func (c *benchmarkServiceClient) StreamingFromServer(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (BenchmarkService_StreamingFromServerClient, error) { 126 stream, err := c.cc.NewStream(ctx, &BenchmarkService_ServiceDesc.Streams[2], "/grpc.testing.BenchmarkService/StreamingFromServer", opts...) 127 if err != nil { 128 return nil, err 129 } 130 x := &benchmarkServiceStreamingFromServerClient{stream} 131 if err := x.ClientStream.SendMsg(in); err != nil { 132 return nil, err 133 } 134 if err := x.ClientStream.CloseSend(); err != nil { 135 return nil, err 136 } 137 return x, nil 138 } 139 140 type BenchmarkService_StreamingFromServerClient interface { 141 Recv() (*SimpleResponse, error) 142 grpc.ClientStream 143 } 144 145 type benchmarkServiceStreamingFromServerClient struct { 146 grpc.ClientStream 147 } 148 149 func (x *benchmarkServiceStreamingFromServerClient) Recv() (*SimpleResponse, error) { 150 m := new(SimpleResponse) 151 if err := x.ClientStream.RecvMsg(m); err != nil { 152 return nil, err 153 } 154 return m, nil 155 } 156 157 func (c *benchmarkServiceClient) StreamingBothWays(ctx context.Context, opts ...grpc.CallOption) (BenchmarkService_StreamingBothWaysClient, error) { 158 stream, err := c.cc.NewStream(ctx, &BenchmarkService_ServiceDesc.Streams[3], "/grpc.testing.BenchmarkService/StreamingBothWays", opts...) 159 if err != nil { 160 return nil, err 161 } 162 x := &benchmarkServiceStreamingBothWaysClient{stream} 163 return x, nil 164 } 165 166 type BenchmarkService_StreamingBothWaysClient interface { 167 Send(*SimpleRequest) error 168 Recv() (*SimpleResponse, error) 169 grpc.ClientStream 170 } 171 172 type benchmarkServiceStreamingBothWaysClient struct { 173 grpc.ClientStream 174 } 175 176 func (x *benchmarkServiceStreamingBothWaysClient) Send(m *SimpleRequest) error { 177 return x.ClientStream.SendMsg(m) 178 } 179 180 func (x *benchmarkServiceStreamingBothWaysClient) Recv() (*SimpleResponse, error) { 181 m := new(SimpleResponse) 182 if err := x.ClientStream.RecvMsg(m); err != nil { 183 return nil, err 184 } 185 return m, nil 186 } 187 188 // BenchmarkServiceServer is the server API for BenchmarkService service. 189 // All implementations must embed UnimplementedBenchmarkServiceServer 190 // for forward compatibility 191 type BenchmarkServiceServer interface { 192 // One request followed by one response. 193 // The server returns the client payload as-is. 194 UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error) 195 // Repeated sequence of one request followed by one response. 196 // Should be called streaming ping-pong 197 // The server returns the client payload as-is on each response 198 StreamingCall(BenchmarkService_StreamingCallServer) error 199 // Single-sided unbounded streaming from client to server 200 // The server returns the client payload as-is once the client does WritesDone 201 StreamingFromClient(BenchmarkService_StreamingFromClientServer) error 202 // Single-sided unbounded streaming from server to client 203 // The server repeatedly returns the client payload as-is 204 StreamingFromServer(*SimpleRequest, BenchmarkService_StreamingFromServerServer) error 205 // Two-sided unbounded streaming between server to client 206 // Both sides send the content of their own choice to the other 207 StreamingBothWays(BenchmarkService_StreamingBothWaysServer) error 208 mustEmbedUnimplementedBenchmarkServiceServer() 209 } 210 211 // UnimplementedBenchmarkServiceServer must be embedded to have forward compatible implementations. 212 type UnimplementedBenchmarkServiceServer struct { 213 } 214 215 func (UnimplementedBenchmarkServiceServer) UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error) { 216 return nil, status.Errorf(codes.Unimplemented, "method UnaryCall not implemented") 217 } 218 func (UnimplementedBenchmarkServiceServer) StreamingCall(BenchmarkService_StreamingCallServer) error { 219 return status.Errorf(codes.Unimplemented, "method StreamingCall not implemented") 220 } 221 func (UnimplementedBenchmarkServiceServer) StreamingFromClient(BenchmarkService_StreamingFromClientServer) error { 222 return status.Errorf(codes.Unimplemented, "method StreamingFromClient not implemented") 223 } 224 func (UnimplementedBenchmarkServiceServer) StreamingFromServer(*SimpleRequest, BenchmarkService_StreamingFromServerServer) error { 225 return status.Errorf(codes.Unimplemented, "method StreamingFromServer not implemented") 226 } 227 func (UnimplementedBenchmarkServiceServer) StreamingBothWays(BenchmarkService_StreamingBothWaysServer) error { 228 return status.Errorf(codes.Unimplemented, "method StreamingBothWays not implemented") 229 } 230 func (UnimplementedBenchmarkServiceServer) mustEmbedUnimplementedBenchmarkServiceServer() {} 231 232 // UnsafeBenchmarkServiceServer may be embedded to opt out of forward compatibility for this service. 233 // Use of this interface is not recommended, as added methods to BenchmarkServiceServer will 234 // result in compilation errors. 235 type UnsafeBenchmarkServiceServer interface { 236 mustEmbedUnimplementedBenchmarkServiceServer() 237 } 238 239 func RegisterBenchmarkServiceServer(s grpc.ServiceRegistrar, srv BenchmarkServiceServer) { 240 s.RegisterService(&BenchmarkService_ServiceDesc, srv) 241 } 242 243 func _BenchmarkService_UnaryCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 244 in := new(SimpleRequest) 245 if err := dec(in); err != nil { 246 return nil, err 247 } 248 if interceptor == nil { 249 return srv.(BenchmarkServiceServer).UnaryCall(ctx, in) 250 } 251 info := &grpc.UnaryServerInfo{ 252 Server: srv, 253 FullMethod: "/grpc.testing.BenchmarkService/UnaryCall", 254 } 255 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 256 return srv.(BenchmarkServiceServer).UnaryCall(ctx, req.(*SimpleRequest)) 257 } 258 return interceptor(ctx, in, info, handler) 259 } 260 261 func _BenchmarkService_StreamingCall_Handler(srv interface{}, stream grpc.ServerStream) error { 262 return srv.(BenchmarkServiceServer).StreamingCall(&benchmarkServiceStreamingCallServer{stream}) 263 } 264 265 type BenchmarkService_StreamingCallServer interface { 266 Send(*SimpleResponse) error 267 Recv() (*SimpleRequest, error) 268 grpc.ServerStream 269 } 270 271 type benchmarkServiceStreamingCallServer struct { 272 grpc.ServerStream 273 } 274 275 func (x *benchmarkServiceStreamingCallServer) Send(m *SimpleResponse) error { 276 return x.ServerStream.SendMsg(m) 277 } 278 279 func (x *benchmarkServiceStreamingCallServer) Recv() (*SimpleRequest, error) { 280 m := new(SimpleRequest) 281 if err := x.ServerStream.RecvMsg(m); err != nil { 282 return nil, err 283 } 284 return m, nil 285 } 286 287 func _BenchmarkService_StreamingFromClient_Handler(srv interface{}, stream grpc.ServerStream) error { 288 return srv.(BenchmarkServiceServer).StreamingFromClient(&benchmarkServiceStreamingFromClientServer{stream}) 289 } 290 291 type BenchmarkService_StreamingFromClientServer interface { 292 SendAndClose(*SimpleResponse) error 293 Recv() (*SimpleRequest, error) 294 grpc.ServerStream 295 } 296 297 type benchmarkServiceStreamingFromClientServer struct { 298 grpc.ServerStream 299 } 300 301 func (x *benchmarkServiceStreamingFromClientServer) SendAndClose(m *SimpleResponse) error { 302 return x.ServerStream.SendMsg(m) 303 } 304 305 func (x *benchmarkServiceStreamingFromClientServer) Recv() (*SimpleRequest, error) { 306 m := new(SimpleRequest) 307 if err := x.ServerStream.RecvMsg(m); err != nil { 308 return nil, err 309 } 310 return m, nil 311 } 312 313 func _BenchmarkService_StreamingFromServer_Handler(srv interface{}, stream grpc.ServerStream) error { 314 m := new(SimpleRequest) 315 if err := stream.RecvMsg(m); err != nil { 316 return err 317 } 318 return srv.(BenchmarkServiceServer).StreamingFromServer(m, &benchmarkServiceStreamingFromServerServer{stream}) 319 } 320 321 type BenchmarkService_StreamingFromServerServer interface { 322 Send(*SimpleResponse) error 323 grpc.ServerStream 324 } 325 326 type benchmarkServiceStreamingFromServerServer struct { 327 grpc.ServerStream 328 } 329 330 func (x *benchmarkServiceStreamingFromServerServer) Send(m *SimpleResponse) error { 331 return x.ServerStream.SendMsg(m) 332 } 333 334 func _BenchmarkService_StreamingBothWays_Handler(srv interface{}, stream grpc.ServerStream) error { 335 return srv.(BenchmarkServiceServer).StreamingBothWays(&benchmarkServiceStreamingBothWaysServer{stream}) 336 } 337 338 type BenchmarkService_StreamingBothWaysServer interface { 339 Send(*SimpleResponse) error 340 Recv() (*SimpleRequest, error) 341 grpc.ServerStream 342 } 343 344 type benchmarkServiceStreamingBothWaysServer struct { 345 grpc.ServerStream 346 } 347 348 func (x *benchmarkServiceStreamingBothWaysServer) Send(m *SimpleResponse) error { 349 return x.ServerStream.SendMsg(m) 350 } 351 352 func (x *benchmarkServiceStreamingBothWaysServer) Recv() (*SimpleRequest, error) { 353 m := new(SimpleRequest) 354 if err := x.ServerStream.RecvMsg(m); err != nil { 355 return nil, err 356 } 357 return m, nil 358 } 359 360 // BenchmarkService_ServiceDesc is the grpc.ServiceDesc for BenchmarkService service. 361 // It's only intended for direct use with grpc.RegisterService, 362 // and not to be introspected or modified (even as a copy) 363 var BenchmarkService_ServiceDesc = grpc.ServiceDesc{ 364 ServiceName: "grpc.testing.BenchmarkService", 365 HandlerType: (*BenchmarkServiceServer)(nil), 366 Methods: []grpc.MethodDesc{ 367 { 368 MethodName: "UnaryCall", 369 Handler: _BenchmarkService_UnaryCall_Handler, 370 }, 371 }, 372 Streams: []grpc.StreamDesc{ 373 { 374 StreamName: "StreamingCall", 375 Handler: _BenchmarkService_StreamingCall_Handler, 376 ServerStreams: true, 377 ClientStreams: true, 378 }, 379 { 380 StreamName: "StreamingFromClient", 381 Handler: _BenchmarkService_StreamingFromClient_Handler, 382 ClientStreams: true, 383 }, 384 { 385 StreamName: "StreamingFromServer", 386 Handler: _BenchmarkService_StreamingFromServer_Handler, 387 ServerStreams: true, 388 }, 389 { 390 StreamName: "StreamingBothWays", 391 Handler: _BenchmarkService_StreamingBothWays_Handler, 392 ServerStreams: true, 393 ClientStreams: true, 394 }, 395 }, 396 Metadata: "grpc/testing/benchmark_service.proto", 397 }