1// Code generated by protoc-gen-go-grpc. DO NOT EDIT. 2 3package grpc_testing 4 5import ( 6 context "context" 7 grpc "google.golang.org/grpc" 8 codes "google.golang.org/grpc/codes" 9 status "google.golang.org/grpc/status" 10) 11 12// This is a compile-time assertion to ensure that this generated file 13// is compatible with the grpc package it is being compiled against. 14const _ = grpc.SupportPackageIsVersion7 15 16// TestServiceClient is the client API for TestService service. 17// 18// 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. 19type TestServiceClient interface { 20 // One request followed by one response. 21 // The server returns the client id as-is. 22 UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) 23 // A sequence of requests with each request served by the server immediately. 24 // As one request could lead to multiple responses, this interface 25 // demonstrates the idea of full duplexing. 26 FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_FullDuplexCallClient, error) 27 // Client stream 28 ClientStreamCall(ctx context.Context, opts ...grpc.CallOption) (TestService_ClientStreamCallClient, error) 29 // Server stream 30 ServerStreamCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (TestService_ServerStreamCallClient, error) 31} 32 33type testServiceClient struct { 34 cc grpc.ClientConnInterface 35} 36 37func NewTestServiceClient(cc grpc.ClientConnInterface) TestServiceClient { 38 return &testServiceClient{cc} 39} 40 41func (c *testServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) { 42 out := new(SimpleResponse) 43 err := c.cc.Invoke(ctx, "/grpc.testing.TestService/UnaryCall", in, out, opts...) 44 if err != nil { 45 return nil, err 46 } 47 return out, nil 48} 49 50func (c *testServiceClient) FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_FullDuplexCallClient, error) { 51 stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[0], "/grpc.testing.TestService/FullDuplexCall", opts...) 52 if err != nil { 53 return nil, err 54 } 55 x := &testServiceFullDuplexCallClient{stream} 56 return x, nil 57} 58 59type TestService_FullDuplexCallClient interface { 60 Send(*SimpleRequest) error 61 Recv() (*SimpleResponse, error) 62 grpc.ClientStream 63} 64 65type testServiceFullDuplexCallClient struct { 66 grpc.ClientStream 67} 68 69func (x *testServiceFullDuplexCallClient) Send(m *SimpleRequest) error { 70 return x.ClientStream.SendMsg(m) 71} 72 73func (x *testServiceFullDuplexCallClient) Recv() (*SimpleResponse, error) { 74 m := new(SimpleResponse) 75 if err := x.ClientStream.RecvMsg(m); err != nil { 76 return nil, err 77 } 78 return m, nil 79} 80 81func (c *testServiceClient) ClientStreamCall(ctx context.Context, opts ...grpc.CallOption) (TestService_ClientStreamCallClient, error) { 82 stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[1], "/grpc.testing.TestService/ClientStreamCall", opts...) 83 if err != nil { 84 return nil, err 85 } 86 x := &testServiceClientStreamCallClient{stream} 87 return x, nil 88} 89 90type TestService_ClientStreamCallClient interface { 91 Send(*SimpleRequest) error 92 CloseAndRecv() (*SimpleResponse, error) 93 grpc.ClientStream 94} 95 96type testServiceClientStreamCallClient struct { 97 grpc.ClientStream 98} 99 100func (x *testServiceClientStreamCallClient) Send(m *SimpleRequest) error { 101 return x.ClientStream.SendMsg(m) 102} 103 104func (x *testServiceClientStreamCallClient) CloseAndRecv() (*SimpleResponse, error) { 105 if err := x.ClientStream.CloseSend(); err != nil { 106 return nil, err 107 } 108 m := new(SimpleResponse) 109 if err := x.ClientStream.RecvMsg(m); err != nil { 110 return nil, err 111 } 112 return m, nil 113} 114 115func (c *testServiceClient) ServerStreamCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (TestService_ServerStreamCallClient, error) { 116 stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[2], "/grpc.testing.TestService/ServerStreamCall", opts...) 117 if err != nil { 118 return nil, err 119 } 120 x := &testServiceServerStreamCallClient{stream} 121 if err := x.ClientStream.SendMsg(in); err != nil { 122 return nil, err 123 } 124 if err := x.ClientStream.CloseSend(); err != nil { 125 return nil, err 126 } 127 return x, nil 128} 129 130type TestService_ServerStreamCallClient interface { 131 Recv() (*SimpleResponse, error) 132 grpc.ClientStream 133} 134 135type testServiceServerStreamCallClient struct { 136 grpc.ClientStream 137} 138 139func (x *testServiceServerStreamCallClient) Recv() (*SimpleResponse, error) { 140 m := new(SimpleResponse) 141 if err := x.ClientStream.RecvMsg(m); err != nil { 142 return nil, err 143 } 144 return m, nil 145} 146 147// TestServiceServer is the server API for TestService service. 148// All implementations must embed UnimplementedTestServiceServer 149// for forward compatibility 150type TestServiceServer interface { 151 // One request followed by one response. 152 // The server returns the client id as-is. 153 UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error) 154 // A sequence of requests with each request served by the server immediately. 155 // As one request could lead to multiple responses, this interface 156 // demonstrates the idea of full duplexing. 157 FullDuplexCall(TestService_FullDuplexCallServer) error 158 // Client stream 159 ClientStreamCall(TestService_ClientStreamCallServer) error 160 // Server stream 161 ServerStreamCall(*SimpleRequest, TestService_ServerStreamCallServer) error 162 mustEmbedUnimplementedTestServiceServer() 163} 164 165// UnimplementedTestServiceServer must be embedded to have forward compatible implementations. 166type UnimplementedTestServiceServer struct { 167} 168 169func (UnimplementedTestServiceServer) UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error) { 170 return nil, status.Errorf(codes.Unimplemented, "method UnaryCall not implemented") 171} 172func (UnimplementedTestServiceServer) FullDuplexCall(TestService_FullDuplexCallServer) error { 173 return status.Errorf(codes.Unimplemented, "method FullDuplexCall not implemented") 174} 175func (UnimplementedTestServiceServer) ClientStreamCall(TestService_ClientStreamCallServer) error { 176 return status.Errorf(codes.Unimplemented, "method ClientStreamCall not implemented") 177} 178func (UnimplementedTestServiceServer) ServerStreamCall(*SimpleRequest, TestService_ServerStreamCallServer) error { 179 return status.Errorf(codes.Unimplemented, "method ServerStreamCall not implemented") 180} 181func (UnimplementedTestServiceServer) mustEmbedUnimplementedTestServiceServer() {} 182 183// UnsafeTestServiceServer may be embedded to opt out of forward compatibility for this service. 184// Use of this interface is not recommended, as added methods to TestServiceServer will 185// result in compilation errors. 186type UnsafeTestServiceServer interface { 187 mustEmbedUnimplementedTestServiceServer() 188} 189 190func RegisterTestServiceServer(s grpc.ServiceRegistrar, srv TestServiceServer) { 191 s.RegisterService(&_TestService_serviceDesc, srv) 192} 193 194func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 195 in := new(SimpleRequest) 196 if err := dec(in); err != nil { 197 return nil, err 198 } 199 if interceptor == nil { 200 return srv.(TestServiceServer).UnaryCall(ctx, in) 201 } 202 info := &grpc.UnaryServerInfo{ 203 Server: srv, 204 FullMethod: "/grpc.testing.TestService/UnaryCall", 205 } 206 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 207 return srv.(TestServiceServer).UnaryCall(ctx, req.(*SimpleRequest)) 208 } 209 return interceptor(ctx, in, info, handler) 210} 211 212func _TestService_FullDuplexCall_Handler(srv interface{}, stream grpc.ServerStream) error { 213 return srv.(TestServiceServer).FullDuplexCall(&testServiceFullDuplexCallServer{stream}) 214} 215 216type TestService_FullDuplexCallServer interface { 217 Send(*SimpleResponse) error 218 Recv() (*SimpleRequest, error) 219 grpc.ServerStream 220} 221 222type testServiceFullDuplexCallServer struct { 223 grpc.ServerStream 224} 225 226func (x *testServiceFullDuplexCallServer) Send(m *SimpleResponse) error { 227 return x.ServerStream.SendMsg(m) 228} 229 230func (x *testServiceFullDuplexCallServer) Recv() (*SimpleRequest, error) { 231 m := new(SimpleRequest) 232 if err := x.ServerStream.RecvMsg(m); err != nil { 233 return nil, err 234 } 235 return m, nil 236} 237 238func _TestService_ClientStreamCall_Handler(srv interface{}, stream grpc.ServerStream) error { 239 return srv.(TestServiceServer).ClientStreamCall(&testServiceClientStreamCallServer{stream}) 240} 241 242type TestService_ClientStreamCallServer interface { 243 SendAndClose(*SimpleResponse) error 244 Recv() (*SimpleRequest, error) 245 grpc.ServerStream 246} 247 248type testServiceClientStreamCallServer struct { 249 grpc.ServerStream 250} 251 252func (x *testServiceClientStreamCallServer) SendAndClose(m *SimpleResponse) error { 253 return x.ServerStream.SendMsg(m) 254} 255 256func (x *testServiceClientStreamCallServer) Recv() (*SimpleRequest, error) { 257 m := new(SimpleRequest) 258 if err := x.ServerStream.RecvMsg(m); err != nil { 259 return nil, err 260 } 261 return m, nil 262} 263 264func _TestService_ServerStreamCall_Handler(srv interface{}, stream grpc.ServerStream) error { 265 m := new(SimpleRequest) 266 if err := stream.RecvMsg(m); err != nil { 267 return err 268 } 269 return srv.(TestServiceServer).ServerStreamCall(m, &testServiceServerStreamCallServer{stream}) 270} 271 272type TestService_ServerStreamCallServer interface { 273 Send(*SimpleResponse) error 274 grpc.ServerStream 275} 276 277type testServiceServerStreamCallServer struct { 278 grpc.ServerStream 279} 280 281func (x *testServiceServerStreamCallServer) Send(m *SimpleResponse) error { 282 return x.ServerStream.SendMsg(m) 283} 284 285var _TestService_serviceDesc = grpc.ServiceDesc{ 286 ServiceName: "grpc.testing.TestService", 287 HandlerType: (*TestServiceServer)(nil), 288 Methods: []grpc.MethodDesc{ 289 { 290 MethodName: "UnaryCall", 291 Handler: _TestService_UnaryCall_Handler, 292 }, 293 }, 294 Streams: []grpc.StreamDesc{ 295 { 296 StreamName: "FullDuplexCall", 297 Handler: _TestService_FullDuplexCall_Handler, 298 ServerStreams: true, 299 ClientStreams: true, 300 }, 301 { 302 StreamName: "ClientStreamCall", 303 Handler: _TestService_ClientStreamCall_Handler, 304 ClientStreams: true, 305 }, 306 { 307 StreamName: "ServerStreamCall", 308 Handler: _TestService_ServerStreamCall_Handler, 309 ServerStreams: true, 310 }, 311 }, 312 Metadata: "stats/grpc_testing/test.proto", 313} 314