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// Client API for Test service 162 163type TestClient interface { 164 UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) 165 // This RPC streams from the server only. 166 Downstream(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (Test_DownstreamClient, error) 167 // This RPC streams from the client. 168 Upstream(ctx context.Context, opts ...grpc.CallOption) (Test_UpstreamClient, error) 169 // This one streams in both directions. 170 Bidi(ctx context.Context, opts ...grpc.CallOption) (Test_BidiClient, error) 171} 172 173type testClient struct { 174 cc *grpc.ClientConn 175} 176 177func NewTestClient(cc *grpc.ClientConn) TestClient { 178 return &testClient{cc} 179} 180 181func (c *testClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) { 182 out := new(SimpleResponse) 183 err := grpc.Invoke(ctx, "/grpc.testing.Test/UnaryCall", in, out, c.cc, opts...) 184 if err != nil { 185 return nil, err 186 } 187 return out, nil 188} 189 190func (c *testClient) Downstream(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (Test_DownstreamClient, error) { 191 stream, err := grpc.NewClientStream(ctx, &_Test_serviceDesc.Streams[0], c.cc, "/grpc.testing.Test/Downstream", opts...) 192 if err != nil { 193 return nil, err 194 } 195 x := &testDownstreamClient{stream} 196 if err := x.ClientStream.SendMsg(in); err != nil { 197 return nil, err 198 } 199 if err := x.ClientStream.CloseSend(); err != nil { 200 return nil, err 201 } 202 return x, nil 203} 204 205type Test_DownstreamClient interface { 206 Recv() (*StreamMsg, error) 207 grpc.ClientStream 208} 209 210type testDownstreamClient struct { 211 grpc.ClientStream 212} 213 214func (x *testDownstreamClient) Recv() (*StreamMsg, error) { 215 m := new(StreamMsg) 216 if err := x.ClientStream.RecvMsg(m); err != nil { 217 return nil, err 218 } 219 return m, nil 220} 221 222func (c *testClient) Upstream(ctx context.Context, opts ...grpc.CallOption) (Test_UpstreamClient, error) { 223 stream, err := grpc.NewClientStream(ctx, &_Test_serviceDesc.Streams[1], c.cc, "/grpc.testing.Test/Upstream", opts...) 224 if err != nil { 225 return nil, err 226 } 227 x := &testUpstreamClient{stream} 228 return x, nil 229} 230 231type Test_UpstreamClient interface { 232 Send(*StreamMsg) error 233 CloseAndRecv() (*SimpleResponse, error) 234 grpc.ClientStream 235} 236 237type testUpstreamClient struct { 238 grpc.ClientStream 239} 240 241func (x *testUpstreamClient) Send(m *StreamMsg) error { 242 return x.ClientStream.SendMsg(m) 243} 244 245func (x *testUpstreamClient) CloseAndRecv() (*SimpleResponse, error) { 246 if err := x.ClientStream.CloseSend(); err != nil { 247 return nil, err 248 } 249 m := new(SimpleResponse) 250 if err := x.ClientStream.RecvMsg(m); err != nil { 251 return nil, err 252 } 253 return m, nil 254} 255 256func (c *testClient) Bidi(ctx context.Context, opts ...grpc.CallOption) (Test_BidiClient, error) { 257 stream, err := grpc.NewClientStream(ctx, &_Test_serviceDesc.Streams[2], c.cc, "/grpc.testing.Test/Bidi", opts...) 258 if err != nil { 259 return nil, err 260 } 261 x := &testBidiClient{stream} 262 return x, nil 263} 264 265type Test_BidiClient interface { 266 Send(*StreamMsg) error 267 Recv() (*StreamMsg2, error) 268 grpc.ClientStream 269} 270 271type testBidiClient struct { 272 grpc.ClientStream 273} 274 275func (x *testBidiClient) Send(m *StreamMsg) error { 276 return x.ClientStream.SendMsg(m) 277} 278 279func (x *testBidiClient) Recv() (*StreamMsg2, error) { 280 m := new(StreamMsg2) 281 if err := x.ClientStream.RecvMsg(m); err != nil { 282 return nil, err 283 } 284 return m, nil 285} 286 287// Server API for Test service 288 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