grpc.pb.go 14 KB

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