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. // Client API for Test service
  141. type TestClient interface {
  142. UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error)
  143. // This RPC streams from the server only.
  144. Downstream(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (Test_DownstreamClient, error)
  145. // This RPC streams from the client.
  146. Upstream(ctx context.Context, opts ...grpc.CallOption) (Test_UpstreamClient, error)
  147. // This one streams in both directions.
  148. Bidi(ctx context.Context, opts ...grpc.CallOption) (Test_BidiClient, error)
  149. }
  150. type testClient struct {
  151. cc *grpc.ClientConn
  152. }
  153. func NewTestClient(cc *grpc.ClientConn) TestClient {
  154. return &testClient{cc}
  155. }
  156. func (c *testClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) {
  157. out := new(SimpleResponse)
  158. err := grpc.Invoke(ctx, "/grpc.testing.Test/UnaryCall", in, out, c.cc, opts...)
  159. if err != nil {
  160. return nil, err
  161. }
  162. return out, nil
  163. }
  164. func (c *testClient) Downstream(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (Test_DownstreamClient, error) {
  165. stream, err := grpc.NewClientStream(ctx, &_Test_serviceDesc.Streams[0], c.cc, "/grpc.testing.Test/Downstream", opts...)
  166. if err != nil {
  167. return nil, err
  168. }
  169. x := &testDownstreamClient{stream}
  170. if err := x.ClientStream.SendMsg(in); err != nil {
  171. return nil, err
  172. }
  173. if err := x.ClientStream.CloseSend(); err != nil {
  174. return nil, err
  175. }
  176. return x, nil
  177. }
  178. type Test_DownstreamClient interface {
  179. Recv() (*StreamMsg, error)
  180. grpc.ClientStream
  181. }
  182. type testDownstreamClient struct {
  183. grpc.ClientStream
  184. }
  185. func (x *testDownstreamClient) Recv() (*StreamMsg, error) {
  186. m := new(StreamMsg)
  187. if err := x.ClientStream.RecvMsg(m); err != nil {
  188. return nil, err
  189. }
  190. return m, nil
  191. }
  192. func (c *testClient) Upstream(ctx context.Context, opts ...grpc.CallOption) (Test_UpstreamClient, error) {
  193. stream, err := grpc.NewClientStream(ctx, &_Test_serviceDesc.Streams[1], c.cc, "/grpc.testing.Test/Upstream", opts...)
  194. if err != nil {
  195. return nil, err
  196. }
  197. x := &testUpstreamClient{stream}
  198. return x, nil
  199. }
  200. type Test_UpstreamClient interface {
  201. Send(*StreamMsg) error
  202. CloseAndRecv() (*SimpleResponse, error)
  203. grpc.ClientStream
  204. }
  205. type testUpstreamClient struct {
  206. grpc.ClientStream
  207. }
  208. func (x *testUpstreamClient) Send(m *StreamMsg) error {
  209. return x.ClientStream.SendMsg(m)
  210. }
  211. func (x *testUpstreamClient) CloseAndRecv() (*SimpleResponse, error) {
  212. if err := x.ClientStream.CloseSend(); err != nil {
  213. return nil, err
  214. }
  215. m := new(SimpleResponse)
  216. if err := x.ClientStream.RecvMsg(m); err != nil {
  217. return nil, err
  218. }
  219. return m, nil
  220. }
  221. func (c *testClient) Bidi(ctx context.Context, opts ...grpc.CallOption) (Test_BidiClient, error) {
  222. stream, err := grpc.NewClientStream(ctx, &_Test_serviceDesc.Streams[2], c.cc, "/grpc.testing.Test/Bidi", opts...)
  223. if err != nil {
  224. return nil, err
  225. }
  226. x := &testBidiClient{stream}
  227. return x, nil
  228. }
  229. type Test_BidiClient interface {
  230. Send(*StreamMsg) error
  231. Recv() (*StreamMsg2, error)
  232. grpc.ClientStream
  233. }
  234. type testBidiClient struct {
  235. grpc.ClientStream
  236. }
  237. func (x *testBidiClient) Send(m *StreamMsg) error {
  238. return x.ClientStream.SendMsg(m)
  239. }
  240. func (x *testBidiClient) Recv() (*StreamMsg2, error) {
  241. m := new(StreamMsg2)
  242. if err := x.ClientStream.RecvMsg(m); err != nil {
  243. return nil, err
  244. }
  245. return m, nil
  246. }
  247. // Server API for Test service
  248. type TestServer interface {
  249. UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error)
  250. // This RPC streams from the server only.
  251. Downstream(*SimpleRequest, Test_DownstreamServer) error
  252. // This RPC streams from the client.
  253. Upstream(Test_UpstreamServer) error
  254. // This one streams in both directions.
  255. Bidi(Test_BidiServer) error
  256. }
  257. func RegisterTestServer(s *grpc.Server, srv TestServer) {
  258. s.RegisterService(&_Test_serviceDesc, srv)
  259. }
  260. func _Test_UnaryCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  261. in := new(SimpleRequest)
  262. if err := dec(in); err != nil {
  263. return nil, err
  264. }
  265. if interceptor == nil {
  266. return srv.(TestServer).UnaryCall(ctx, in)
  267. }
  268. info := &grpc.UnaryServerInfo{
  269. Server: srv,
  270. FullMethod: "/grpc.testing.Test/UnaryCall",
  271. }
  272. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  273. return srv.(TestServer).UnaryCall(ctx, req.(*SimpleRequest))
  274. }
  275. return interceptor(ctx, in, info, handler)
  276. }
  277. func _Test_Downstream_Handler(srv interface{}, stream grpc.ServerStream) error {
  278. m := new(SimpleRequest)
  279. if err := stream.RecvMsg(m); err != nil {
  280. return err
  281. }
  282. return srv.(TestServer).Downstream(m, &testDownstreamServer{stream})
  283. }
  284. type Test_DownstreamServer interface {
  285. Send(*StreamMsg) error
  286. grpc.ServerStream
  287. }
  288. type testDownstreamServer struct {
  289. grpc.ServerStream
  290. }
  291. func (x *testDownstreamServer) Send(m *StreamMsg) error {
  292. return x.ServerStream.SendMsg(m)
  293. }
  294. func _Test_Upstream_Handler(srv interface{}, stream grpc.ServerStream) error {
  295. return srv.(TestServer).Upstream(&testUpstreamServer{stream})
  296. }
  297. type Test_UpstreamServer interface {
  298. SendAndClose(*SimpleResponse) error
  299. Recv() (*StreamMsg, error)
  300. grpc.ServerStream
  301. }
  302. type testUpstreamServer struct {
  303. grpc.ServerStream
  304. }
  305. func (x *testUpstreamServer) SendAndClose(m *SimpleResponse) error {
  306. return x.ServerStream.SendMsg(m)
  307. }
  308. func (x *testUpstreamServer) Recv() (*StreamMsg, error) {
  309. m := new(StreamMsg)
  310. if err := x.ServerStream.RecvMsg(m); err != nil {
  311. return nil, err
  312. }
  313. return m, nil
  314. }
  315. func _Test_Bidi_Handler(srv interface{}, stream grpc.ServerStream) error {
  316. return srv.(TestServer).Bidi(&testBidiServer{stream})
  317. }
  318. type Test_BidiServer interface {
  319. Send(*StreamMsg2) error
  320. Recv() (*StreamMsg, error)
  321. grpc.ServerStream
  322. }
  323. type testBidiServer struct {
  324. grpc.ServerStream
  325. }
  326. func (x *testBidiServer) Send(m *StreamMsg2) error {
  327. return x.ServerStream.SendMsg(m)
  328. }
  329. func (x *testBidiServer) Recv() (*StreamMsg, error) {
  330. m := new(StreamMsg)
  331. if err := x.ServerStream.RecvMsg(m); err != nil {
  332. return nil, err
  333. }
  334. return m, nil
  335. }
  336. var _Test_serviceDesc = grpc.ServiceDesc{
  337. ServiceName: "grpc.testing.Test",
  338. HandlerType: (*TestServer)(nil),
  339. Methods: []grpc.MethodDesc{
  340. {
  341. MethodName: "UnaryCall",
  342. Handler: _Test_UnaryCall_Handler,
  343. },
  344. },
  345. Streams: []grpc.StreamDesc{
  346. {
  347. StreamName: "Downstream",
  348. Handler: _Test_Downstream_Handler,
  349. ServerStreams: true,
  350. },
  351. {
  352. StreamName: "Upstream",
  353. Handler: _Test_Upstream_Handler,
  354. ClientStreams: true,
  355. },
  356. {
  357. StreamName: "Bidi",
  358. Handler: _Test_Bidi_Handler,
  359. ServerStreams: true,
  360. ClientStreams: true,
  361. },
  362. },
  363. Metadata: "grpc/grpc.proto",
  364. }
  365. func init() { proto.RegisterFile("grpc/grpc.proto", fileDescriptor_grpc_65bf3902e49ee873) }
  366. var fileDescriptor_grpc_65bf3902e49ee873 = []byte{
  367. // 244 bytes of a gzipped FileDescriptorProto
  368. 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4f, 0x2f, 0x2a, 0x48,
  369. 0xd6, 0x07, 0x11, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x3c, 0x60, 0x76, 0x49, 0x6a, 0x71,
  370. 0x49, 0x66, 0x5e, 0xba, 0x12, 0x3f, 0x17, 0x6f, 0x70, 0x66, 0x6e, 0x41, 0x4e, 0x6a, 0x50, 0x6a,
  371. 0x61, 0x69, 0x6a, 0x71, 0x89, 0x92, 0x00, 0x17, 0x1f, 0x4c, 0xa0, 0xb8, 0x20, 0x3f, 0xaf, 0x38,
  372. 0x55, 0x89, 0x9b, 0x8b, 0x33, 0xb8, 0xa4, 0x28, 0x35, 0x31, 0xd7, 0xb7, 0x38, 0x5d, 0x89, 0x87,
  373. 0x8b, 0x0b, 0xce, 0x31, 0x32, 0x9a, 0xc1, 0xc4, 0xc5, 0x12, 0x92, 0x5a, 0x5c, 0x22, 0xe4, 0xc6,
  374. 0xc5, 0x19, 0x9a, 0x97, 0x58, 0x54, 0xe9, 0x9c, 0x98, 0x93, 0x23, 0x24, 0xad, 0x87, 0x6c, 0x85,
  375. 0x1e, 0x8a, 0xf9, 0x52, 0x32, 0xd8, 0x25, 0x21, 0x76, 0x09, 0xb9, 0x70, 0x71, 0xb9, 0xe4, 0x97,
  376. 0xe7, 0x15, 0x83, 0xad, 0xc0, 0x6f, 0x90, 0x38, 0x9a, 0x24, 0xcc, 0x55, 0x06, 0x8c, 0x42, 0xce,
  377. 0x5c, 0x1c, 0xa1, 0x05, 0x50, 0x33, 0x70, 0x29, 0xc3, 0xef, 0x10, 0x0d, 0x46, 0x21, 0x5b, 0x2e,
  378. 0x16, 0xa7, 0xcc, 0x94, 0x4c, 0xdc, 0x06, 0x48, 0xe0, 0x90, 0x30, 0xd2, 0x60, 0x34, 0x60, 0x74,
  379. 0x72, 0x88, 0xb2, 0x4b, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf,
  380. 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0x07, 0xc7, 0x40, 0x52, 0x69, 0x1a, 0x84, 0x91, 0xac, 0x9b, 0x9e,
  381. 0x9a, 0xa7, 0x9b, 0x9e, 0xaf, 0x0f, 0x32, 0x22, 0x25, 0xb1, 0x24, 0x11, 0x1c, 0x4d, 0xd6, 0x50,
  382. 0x03, 0x93, 0xd8, 0xc0, 0x8a, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x90, 0xb9, 0x95, 0x42,
  383. 0xc2, 0x01, 0x00, 0x00,
  384. }