1// Code generated by protoc-gen-go. DO NOT EDIT. 2// source: grpc/grpc.proto 3 4package testing // import "github.com/golang/protobuf/protoc-gen-go/testdata/grpc" 5 6import proto "github.com/golang/protobuf/proto" 7import fmt "fmt" 8import math "math" 9 10import ( 11 context "golang.org/x/net/context" 12 grpc "google.golang.org/grpc" 13) 14 15// Reference imports to suppress errors if they are not otherwise used. 16var _ = proto.Marshal 17var _ = fmt.Errorf 18var _ = math.Inf 19 20// This is a compile-time assertion to ensure that this generated file 21// is compatible with the proto package it is being compiled against. 22// A compilation error at this line likely means your copy of the 23// proto package needs to be updated. 24const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package 25 26type SimpleRequest struct { 27 XXX_NoUnkeyedLiteral struct{} `json:"-"` 28 XXX_unrecognized []byte `json:"-"` 29 XXX_sizecache int32 `json:"-"` 30} 31 32func (m *SimpleRequest) Reset() { *m = SimpleRequest{} } 33func (m *SimpleRequest) String() string { return proto.CompactTextString(m) } 34func (*SimpleRequest) ProtoMessage() {} 35func (*SimpleRequest) Descriptor() ([]byte, []int) { 36 return fileDescriptor_grpc_65bf3902e49ee873, []int{0} 37} 38func (m *SimpleRequest) XXX_Unmarshal(b []byte) error { 39 return xxx_messageInfo_SimpleRequest.Unmarshal(m, b) 40} 41func (m *SimpleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 42 return xxx_messageInfo_SimpleRequest.Marshal(b, m, deterministic) 43} 44func (dst *SimpleRequest) XXX_Merge(src proto.Message) { 45 xxx_messageInfo_SimpleRequest.Merge(dst, src) 46} 47func (m *SimpleRequest) XXX_Size() int { 48 return xxx_messageInfo_SimpleRequest.Size(m) 49} 50func (m *SimpleRequest) XXX_DiscardUnknown() { 51 xxx_messageInfo_SimpleRequest.DiscardUnknown(m) 52} 53 54var xxx_messageInfo_SimpleRequest proto.InternalMessageInfo 55 56type SimpleResponse struct { 57 XXX_NoUnkeyedLiteral struct{} `json:"-"` 58 XXX_unrecognized []byte `json:"-"` 59 XXX_sizecache int32 `json:"-"` 60} 61 62func (m *SimpleResponse) Reset() { *m = SimpleResponse{} } 63func (m *SimpleResponse) String() string { return proto.CompactTextString(m) } 64func (*SimpleResponse) ProtoMessage() {} 65func (*SimpleResponse) Descriptor() ([]byte, []int) { 66 return fileDescriptor_grpc_65bf3902e49ee873, []int{1} 67} 68func (m *SimpleResponse) XXX_Unmarshal(b []byte) error { 69 return xxx_messageInfo_SimpleResponse.Unmarshal(m, b) 70} 71func (m *SimpleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 72 return xxx_messageInfo_SimpleResponse.Marshal(b, m, deterministic) 73} 74func (dst *SimpleResponse) XXX_Merge(src proto.Message) { 75 xxx_messageInfo_SimpleResponse.Merge(dst, src) 76} 77func (m *SimpleResponse) XXX_Size() int { 78 return xxx_messageInfo_SimpleResponse.Size(m) 79} 80func (m *SimpleResponse) XXX_DiscardUnknown() { 81 xxx_messageInfo_SimpleResponse.DiscardUnknown(m) 82} 83 84var xxx_messageInfo_SimpleResponse proto.InternalMessageInfo 85 86type StreamMsg struct { 87 XXX_NoUnkeyedLiteral struct{} `json:"-"` 88 XXX_unrecognized []byte `json:"-"` 89 XXX_sizecache int32 `json:"-"` 90} 91 92func (m *StreamMsg) Reset() { *m = StreamMsg{} } 93func (m *StreamMsg) String() string { return proto.CompactTextString(m) } 94func (*StreamMsg) ProtoMessage() {} 95func (*StreamMsg) Descriptor() ([]byte, []int) { 96 return fileDescriptor_grpc_65bf3902e49ee873, []int{2} 97} 98func (m *StreamMsg) XXX_Unmarshal(b []byte) error { 99 return xxx_messageInfo_StreamMsg.Unmarshal(m, b) 100} 101func (m *StreamMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 102 return xxx_messageInfo_StreamMsg.Marshal(b, m, deterministic) 103} 104func (dst *StreamMsg) XXX_Merge(src proto.Message) { 105 xxx_messageInfo_StreamMsg.Merge(dst, src) 106} 107func (m *StreamMsg) XXX_Size() int { 108 return xxx_messageInfo_StreamMsg.Size(m) 109} 110func (m *StreamMsg) XXX_DiscardUnknown() { 111 xxx_messageInfo_StreamMsg.DiscardUnknown(m) 112} 113 114var xxx_messageInfo_StreamMsg proto.InternalMessageInfo 115 116type StreamMsg2 struct { 117 XXX_NoUnkeyedLiteral struct{} `json:"-"` 118 XXX_unrecognized []byte `json:"-"` 119 XXX_sizecache int32 `json:"-"` 120} 121 122func (m *StreamMsg2) Reset() { *m = StreamMsg2{} } 123func (m *StreamMsg2) String() string { return proto.CompactTextString(m) } 124func (*StreamMsg2) ProtoMessage() {} 125func (*StreamMsg2) Descriptor() ([]byte, []int) { 126 return fileDescriptor_grpc_65bf3902e49ee873, []int{3} 127} 128func (m *StreamMsg2) XXX_Unmarshal(b []byte) error { 129 return xxx_messageInfo_StreamMsg2.Unmarshal(m, b) 130} 131func (m *StreamMsg2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 132 return xxx_messageInfo_StreamMsg2.Marshal(b, m, deterministic) 133} 134func (dst *StreamMsg2) XXX_Merge(src proto.Message) { 135 xxx_messageInfo_StreamMsg2.Merge(dst, src) 136} 137func (m *StreamMsg2) XXX_Size() int { 138 return xxx_messageInfo_StreamMsg2.Size(m) 139} 140func (m *StreamMsg2) XXX_DiscardUnknown() { 141 xxx_messageInfo_StreamMsg2.DiscardUnknown(m) 142} 143 144var xxx_messageInfo_StreamMsg2 proto.InternalMessageInfo 145 146func init() { 147 proto.RegisterType((*SimpleRequest)(nil), "grpc.testing.SimpleRequest") 148 proto.RegisterType((*SimpleResponse)(nil), "grpc.testing.SimpleResponse") 149 proto.RegisterType((*StreamMsg)(nil), "grpc.testing.StreamMsg") 150 proto.RegisterType((*StreamMsg2)(nil), "grpc.testing.StreamMsg2") 151} 152 153// Reference imports to suppress errors if they are not otherwise used. 154var _ context.Context 155var _ grpc.ClientConn 156 157// This is a compile-time assertion to ensure that this generated file 158// is compatible with the grpc package it is being compiled against. 159const _ = grpc.SupportPackageIsVersion4 160 161// TestClient is the client API for Test service. 162// 163// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. 164type TestClient interface { 165 UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) 166 // This RPC streams from the server only. 167 Downstream(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (Test_DownstreamClient, error) 168 // This RPC streams from the client. 169 Upstream(ctx context.Context, opts ...grpc.CallOption) (Test_UpstreamClient, error) 170 // This one streams in both directions. 171 Bidi(ctx context.Context, opts ...grpc.CallOption) (Test_BidiClient, error) 172} 173 174type testClient struct { 175 cc *grpc.ClientConn 176} 177 178func NewTestClient(cc *grpc.ClientConn) TestClient { 179 return &testClient{cc} 180} 181 182func (c *testClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) { 183 out := new(SimpleResponse) 184 err := c.cc.Invoke(ctx, "/grpc.testing.Test/UnaryCall", in, out, opts...) 185 if err != nil { 186 return nil, err 187 } 188 return out, nil 189} 190 191func (c *testClient) Downstream(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (Test_DownstreamClient, error) { 192 stream, err := c.cc.NewStream(ctx, &_Test_serviceDesc.Streams[0], "/grpc.testing.Test/Downstream", opts...) 193 if err != nil { 194 return nil, err 195 } 196 x := &testDownstreamClient{stream} 197 if err := x.ClientStream.SendMsg(in); err != nil { 198 return nil, err 199 } 200 if err := x.ClientStream.CloseSend(); err != nil { 201 return nil, err 202 } 203 return x, nil 204} 205 206type Test_DownstreamClient interface { 207 Recv() (*StreamMsg, error) 208 grpc.ClientStream 209} 210 211type testDownstreamClient struct { 212 grpc.ClientStream 213} 214 215func (x *testDownstreamClient) Recv() (*StreamMsg, error) { 216 m := new(StreamMsg) 217 if err := x.ClientStream.RecvMsg(m); err != nil { 218 return nil, err 219 } 220 return m, nil 221} 222 223func (c *testClient) Upstream(ctx context.Context, opts ...grpc.CallOption) (Test_UpstreamClient, error) { 224 stream, err := c.cc.NewStream(ctx, &_Test_serviceDesc.Streams[1], "/grpc.testing.Test/Upstream", opts...) 225 if err != nil { 226 return nil, err 227 } 228 x := &testUpstreamClient{stream} 229 return x, nil 230} 231 232type Test_UpstreamClient interface { 233 Send(*StreamMsg) error 234 CloseAndRecv() (*SimpleResponse, error) 235 grpc.ClientStream 236} 237 238type testUpstreamClient struct { 239 grpc.ClientStream 240} 241 242func (x *testUpstreamClient) Send(m *StreamMsg) error { 243 return x.ClientStream.SendMsg(m) 244} 245 246func (x *testUpstreamClient) CloseAndRecv() (*SimpleResponse, error) { 247 if err := x.ClientStream.CloseSend(); err != nil { 248 return nil, err 249 } 250 m := new(SimpleResponse) 251 if err := x.ClientStream.RecvMsg(m); err != nil { 252 return nil, err 253 } 254 return m, nil 255} 256 257func (c *testClient) Bidi(ctx context.Context, opts ...grpc.CallOption) (Test_BidiClient, error) { 258 stream, err := c.cc.NewStream(ctx, &_Test_serviceDesc.Streams[2], "/grpc.testing.Test/Bidi", opts...) 259 if err != nil { 260 return nil, err 261 } 262 x := &testBidiClient{stream} 263 return x, nil 264} 265 266type Test_BidiClient interface { 267 Send(*StreamMsg) error 268 Recv() (*StreamMsg2, error) 269 grpc.ClientStream 270} 271 272type testBidiClient struct { 273 grpc.ClientStream 274} 275 276func (x *testBidiClient) Send(m *StreamMsg) error { 277 return x.ClientStream.SendMsg(m) 278} 279 280func (x *testBidiClient) Recv() (*StreamMsg2, error) { 281 m := new(StreamMsg2) 282 if err := x.ClientStream.RecvMsg(m); err != nil { 283 return nil, err 284 } 285 return m, nil 286} 287 288// TestServer is the server API for Test service. 289type TestServer interface { 290 UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error) 291 // This RPC streams from the server only. 292 Downstream(*SimpleRequest, Test_DownstreamServer) error 293 // This RPC streams from the client. 294 Upstream(Test_UpstreamServer) error 295 // This one streams in both directions. 296 Bidi(Test_BidiServer) error 297} 298 299func RegisterTestServer(s *grpc.Server, srv TestServer) { 300 s.RegisterService(&_Test_serviceDesc, srv) 301} 302 303func _Test_UnaryCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 304 in := new(SimpleRequest) 305 if err := dec(in); err != nil { 306 return nil, err 307 } 308 if interceptor == nil { 309 return srv.(TestServer).UnaryCall(ctx, in) 310 } 311 info := &grpc.UnaryServerInfo{ 312 Server: srv, 313 FullMethod: "/grpc.testing.Test/UnaryCall", 314 } 315 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 316 return srv.(TestServer).UnaryCall(ctx, req.(*SimpleRequest)) 317 } 318 return interceptor(ctx, in, info, handler) 319} 320 321func _Test_Downstream_Handler(srv interface{}, stream grpc.ServerStream) error { 322 m := new(SimpleRequest) 323 if err := stream.RecvMsg(m); err != nil { 324 return err 325 } 326 return srv.(TestServer).Downstream(m, &testDownstreamServer{stream}) 327} 328 329type Test_DownstreamServer interface { 330 Send(*StreamMsg) error 331 grpc.ServerStream 332} 333 334type testDownstreamServer struct { 335 grpc.ServerStream 336} 337 338func (x *testDownstreamServer) Send(m *StreamMsg) error { 339 return x.ServerStream.SendMsg(m) 340} 341 342func _Test_Upstream_Handler(srv interface{}, stream grpc.ServerStream) error { 343 return srv.(TestServer).Upstream(&testUpstreamServer{stream}) 344} 345 346type Test_UpstreamServer interface { 347 SendAndClose(*SimpleResponse) error 348 Recv() (*StreamMsg, error) 349 grpc.ServerStream 350} 351 352type testUpstreamServer struct { 353 grpc.ServerStream 354} 355 356func (x *testUpstreamServer) SendAndClose(m *SimpleResponse) error { 357 return x.ServerStream.SendMsg(m) 358} 359 360func (x *testUpstreamServer) Recv() (*StreamMsg, error) { 361 m := new(StreamMsg) 362 if err := x.ServerStream.RecvMsg(m); err != nil { 363 return nil, err 364 } 365 return m, nil 366} 367 368func _Test_Bidi_Handler(srv interface{}, stream grpc.ServerStream) error { 369 return srv.(TestServer).Bidi(&testBidiServer{stream}) 370} 371 372type Test_BidiServer interface { 373 Send(*StreamMsg2) error 374 Recv() (*StreamMsg, error) 375 grpc.ServerStream 376} 377 378type testBidiServer struct { 379 grpc.ServerStream 380} 381 382func (x *testBidiServer) Send(m *StreamMsg2) error { 383 return x.ServerStream.SendMsg(m) 384} 385 386func (x *testBidiServer) Recv() (*StreamMsg, error) { 387 m := new(StreamMsg) 388 if err := x.ServerStream.RecvMsg(m); err != nil { 389 return nil, err 390 } 391 return m, nil 392} 393 394var _Test_serviceDesc = grpc.ServiceDesc{ 395 ServiceName: "grpc.testing.Test", 396 HandlerType: (*TestServer)(nil), 397 Methods: []grpc.MethodDesc{ 398 { 399 MethodName: "UnaryCall", 400 Handler: _Test_UnaryCall_Handler, 401 }, 402 }, 403 Streams: []grpc.StreamDesc{ 404 { 405 StreamName: "Downstream", 406 Handler: _Test_Downstream_Handler, 407 ServerStreams: true, 408 }, 409 { 410 StreamName: "Upstream", 411 Handler: _Test_Upstream_Handler, 412 ClientStreams: true, 413 }, 414 { 415 StreamName: "Bidi", 416 Handler: _Test_Bidi_Handler, 417 ServerStreams: true, 418 ClientStreams: true, 419 }, 420 }, 421 Metadata: "grpc/grpc.proto", 422} 423 424func init() { proto.RegisterFile("grpc/grpc.proto", fileDescriptor_grpc_65bf3902e49ee873) } 425 426var fileDescriptor_grpc_65bf3902e49ee873 = []byte{ 427 // 244 bytes of a gzipped FileDescriptorProto 428 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4f, 0x2f, 0x2a, 0x48, 429 0xd6, 0x07, 0x11, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x3c, 0x60, 0x76, 0x49, 0x6a, 0x71, 430 0x49, 0x66, 0x5e, 0xba, 0x12, 0x3f, 0x17, 0x6f, 0x70, 0x66, 0x6e, 0x41, 0x4e, 0x6a, 0x50, 0x6a, 431 0x61, 0x69, 0x6a, 0x71, 0x89, 0x92, 0x00, 0x17, 0x1f, 0x4c, 0xa0, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 432 0x55, 0x89, 0x9b, 0x8b, 0x33, 0xb8, 0xa4, 0x28, 0x35, 0x31, 0xd7, 0xb7, 0x38, 0x5d, 0x89, 0x87, 433 0x8b, 0x0b, 0xce, 0x31, 0x32, 0x9a, 0xc1, 0xc4, 0xc5, 0x12, 0x92, 0x5a, 0x5c, 0x22, 0xe4, 0xc6, 434 0xc5, 0x19, 0x9a, 0x97, 0x58, 0x54, 0xe9, 0x9c, 0x98, 0x93, 0x23, 0x24, 0xad, 0x87, 0x6c, 0x85, 435 0x1e, 0x8a, 0xf9, 0x52, 0x32, 0xd8, 0x25, 0x21, 0x76, 0x09, 0xb9, 0x70, 0x71, 0xb9, 0xe4, 0x97, 436 0xe7, 0x15, 0x83, 0xad, 0xc0, 0x6f, 0x90, 0x38, 0x9a, 0x24, 0xcc, 0x55, 0x06, 0x8c, 0x42, 0xce, 437 0x5c, 0x1c, 0xa1, 0x05, 0x50, 0x33, 0x70, 0x29, 0xc3, 0xef, 0x10, 0x0d, 0x46, 0x21, 0x5b, 0x2e, 438 0x16, 0xa7, 0xcc, 0x94, 0x4c, 0xdc, 0x06, 0x48, 0xe0, 0x90, 0x30, 0xd2, 0x60, 0x34, 0x60, 0x74, 439 0x72, 0x88, 0xb2, 0x4b, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 440 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0x07, 0xc7, 0x40, 0x52, 0x69, 0x1a, 0x84, 0x91, 0xac, 0x9b, 0x9e, 441 0x9a, 0xa7, 0x9b, 0x9e, 0xaf, 0x0f, 0x32, 0x22, 0x25, 0xb1, 0x24, 0x11, 0x1c, 0x4d, 0xd6, 0x50, 442 0x03, 0x93, 0xd8, 0xc0, 0x8a, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x90, 0xb9, 0x95, 0x42, 443 0xc2, 0x01, 0x00, 0x00, 444} 445