grpc.pb.go 14 KB

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