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