test.pb.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. // Code generated by protoc-gen-go. DO NOT EDIT.
  2. // source: grpc_testing/test.proto
  3. package grpc_testing
  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. Id int32 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"`
  22. XXX_NoUnkeyedLiteral struct{} `json:"-"`
  23. XXX_unrecognized []byte `json:"-"`
  24. XXX_sizecache int32 `json:"-"`
  25. }
  26. func (m *SimpleRequest) Reset() { *m = SimpleRequest{} }
  27. func (m *SimpleRequest) String() string { return proto.CompactTextString(m) }
  28. func (*SimpleRequest) ProtoMessage() {}
  29. func (*SimpleRequest) Descriptor() ([]byte, []int) {
  30. return fileDescriptor_test_dd7ffeaa75513a0a, []int{0}
  31. }
  32. func (m *SimpleRequest) XXX_Unmarshal(b []byte) error {
  33. return xxx_messageInfo_SimpleRequest.Unmarshal(m, b)
  34. }
  35. func (m *SimpleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
  36. return xxx_messageInfo_SimpleRequest.Marshal(b, m, deterministic)
  37. }
  38. func (dst *SimpleRequest) XXX_Merge(src proto.Message) {
  39. xxx_messageInfo_SimpleRequest.Merge(dst, src)
  40. }
  41. func (m *SimpleRequest) XXX_Size() int {
  42. return xxx_messageInfo_SimpleRequest.Size(m)
  43. }
  44. func (m *SimpleRequest) XXX_DiscardUnknown() {
  45. xxx_messageInfo_SimpleRequest.DiscardUnknown(m)
  46. }
  47. var xxx_messageInfo_SimpleRequest proto.InternalMessageInfo
  48. func (m *SimpleRequest) GetId() int32 {
  49. if m != nil {
  50. return m.Id
  51. }
  52. return 0
  53. }
  54. type SimpleResponse struct {
  55. Id int32 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"`
  56. XXX_NoUnkeyedLiteral struct{} `json:"-"`
  57. XXX_unrecognized []byte `json:"-"`
  58. XXX_sizecache int32 `json:"-"`
  59. }
  60. func (m *SimpleResponse) Reset() { *m = SimpleResponse{} }
  61. func (m *SimpleResponse) String() string { return proto.CompactTextString(m) }
  62. func (*SimpleResponse) ProtoMessage() {}
  63. func (*SimpleResponse) Descriptor() ([]byte, []int) {
  64. return fileDescriptor_test_dd7ffeaa75513a0a, []int{1}
  65. }
  66. func (m *SimpleResponse) XXX_Unmarshal(b []byte) error {
  67. return xxx_messageInfo_SimpleResponse.Unmarshal(m, b)
  68. }
  69. func (m *SimpleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
  70. return xxx_messageInfo_SimpleResponse.Marshal(b, m, deterministic)
  71. }
  72. func (dst *SimpleResponse) XXX_Merge(src proto.Message) {
  73. xxx_messageInfo_SimpleResponse.Merge(dst, src)
  74. }
  75. func (m *SimpleResponse) XXX_Size() int {
  76. return xxx_messageInfo_SimpleResponse.Size(m)
  77. }
  78. func (m *SimpleResponse) XXX_DiscardUnknown() {
  79. xxx_messageInfo_SimpleResponse.DiscardUnknown(m)
  80. }
  81. var xxx_messageInfo_SimpleResponse proto.InternalMessageInfo
  82. func (m *SimpleResponse) GetId() int32 {
  83. if m != nil {
  84. return m.Id
  85. }
  86. return 0
  87. }
  88. func init() {
  89. proto.RegisterType((*SimpleRequest)(nil), "grpc.testing.SimpleRequest")
  90. proto.RegisterType((*SimpleResponse)(nil), "grpc.testing.SimpleResponse")
  91. }
  92. // Reference imports to suppress errors if they are not otherwise used.
  93. var _ context.Context
  94. var _ grpc.ClientConn
  95. // This is a compile-time assertion to ensure that this generated file
  96. // is compatible with the grpc package it is being compiled against.
  97. const _ = grpc.SupportPackageIsVersion4
  98. // TestServiceClient is the client API for TestService service.
  99. //
  100. // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
  101. type TestServiceClient interface {
  102. // One request followed by one response.
  103. // The server returns the client id as-is.
  104. UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error)
  105. // A sequence of requests with each request served by the server immediately.
  106. // As one request could lead to multiple responses, this interface
  107. // demonstrates the idea of full duplexing.
  108. FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_FullDuplexCallClient, error)
  109. // Client stream
  110. ClientStreamCall(ctx context.Context, opts ...grpc.CallOption) (TestService_ClientStreamCallClient, error)
  111. // Server stream
  112. ServerStreamCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (TestService_ServerStreamCallClient, error)
  113. }
  114. type testServiceClient struct {
  115. cc *grpc.ClientConn
  116. }
  117. func NewTestServiceClient(cc *grpc.ClientConn) TestServiceClient {
  118. return &testServiceClient{cc}
  119. }
  120. func (c *testServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) {
  121. out := new(SimpleResponse)
  122. err := c.cc.Invoke(ctx, "/grpc.testing.TestService/UnaryCall", in, out, opts...)
  123. if err != nil {
  124. return nil, err
  125. }
  126. return out, nil
  127. }
  128. func (c *testServiceClient) FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_FullDuplexCallClient, error) {
  129. stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[0], "/grpc.testing.TestService/FullDuplexCall", opts...)
  130. if err != nil {
  131. return nil, err
  132. }
  133. x := &testServiceFullDuplexCallClient{stream}
  134. return x, nil
  135. }
  136. type TestService_FullDuplexCallClient interface {
  137. Send(*SimpleRequest) error
  138. Recv() (*SimpleResponse, error)
  139. grpc.ClientStream
  140. }
  141. type testServiceFullDuplexCallClient struct {
  142. grpc.ClientStream
  143. }
  144. func (x *testServiceFullDuplexCallClient) Send(m *SimpleRequest) error {
  145. return x.ClientStream.SendMsg(m)
  146. }
  147. func (x *testServiceFullDuplexCallClient) Recv() (*SimpleResponse, error) {
  148. m := new(SimpleResponse)
  149. if err := x.ClientStream.RecvMsg(m); err != nil {
  150. return nil, err
  151. }
  152. return m, nil
  153. }
  154. func (c *testServiceClient) ClientStreamCall(ctx context.Context, opts ...grpc.CallOption) (TestService_ClientStreamCallClient, error) {
  155. stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[1], "/grpc.testing.TestService/ClientStreamCall", opts...)
  156. if err != nil {
  157. return nil, err
  158. }
  159. x := &testServiceClientStreamCallClient{stream}
  160. return x, nil
  161. }
  162. type TestService_ClientStreamCallClient interface {
  163. Send(*SimpleRequest) error
  164. CloseAndRecv() (*SimpleResponse, error)
  165. grpc.ClientStream
  166. }
  167. type testServiceClientStreamCallClient struct {
  168. grpc.ClientStream
  169. }
  170. func (x *testServiceClientStreamCallClient) Send(m *SimpleRequest) error {
  171. return x.ClientStream.SendMsg(m)
  172. }
  173. func (x *testServiceClientStreamCallClient) CloseAndRecv() (*SimpleResponse, error) {
  174. if err := x.ClientStream.CloseSend(); err != nil {
  175. return nil, err
  176. }
  177. m := new(SimpleResponse)
  178. if err := x.ClientStream.RecvMsg(m); err != nil {
  179. return nil, err
  180. }
  181. return m, nil
  182. }
  183. func (c *testServiceClient) ServerStreamCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (TestService_ServerStreamCallClient, error) {
  184. stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[2], "/grpc.testing.TestService/ServerStreamCall", opts...)
  185. if err != nil {
  186. return nil, err
  187. }
  188. x := &testServiceServerStreamCallClient{stream}
  189. if err := x.ClientStream.SendMsg(in); err != nil {
  190. return nil, err
  191. }
  192. if err := x.ClientStream.CloseSend(); err != nil {
  193. return nil, err
  194. }
  195. return x, nil
  196. }
  197. type TestService_ServerStreamCallClient interface {
  198. Recv() (*SimpleResponse, error)
  199. grpc.ClientStream
  200. }
  201. type testServiceServerStreamCallClient struct {
  202. grpc.ClientStream
  203. }
  204. func (x *testServiceServerStreamCallClient) Recv() (*SimpleResponse, error) {
  205. m := new(SimpleResponse)
  206. if err := x.ClientStream.RecvMsg(m); err != nil {
  207. return nil, err
  208. }
  209. return m, nil
  210. }
  211. // TestServiceServer is the server API for TestService service.
  212. type TestServiceServer interface {
  213. // One request followed by one response.
  214. // The server returns the client id as-is.
  215. UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error)
  216. // A sequence of requests with each request served by the server immediately.
  217. // As one request could lead to multiple responses, this interface
  218. // demonstrates the idea of full duplexing.
  219. FullDuplexCall(TestService_FullDuplexCallServer) error
  220. // Client stream
  221. ClientStreamCall(TestService_ClientStreamCallServer) error
  222. // Server stream
  223. ServerStreamCall(*SimpleRequest, TestService_ServerStreamCallServer) error
  224. }
  225. func RegisterTestServiceServer(s *grpc.Server, srv TestServiceServer) {
  226. s.RegisterService(&_TestService_serviceDesc, srv)
  227. }
  228. func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  229. in := new(SimpleRequest)
  230. if err := dec(in); err != nil {
  231. return nil, err
  232. }
  233. if interceptor == nil {
  234. return srv.(TestServiceServer).UnaryCall(ctx, in)
  235. }
  236. info := &grpc.UnaryServerInfo{
  237. Server: srv,
  238. FullMethod: "/grpc.testing.TestService/UnaryCall",
  239. }
  240. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  241. return srv.(TestServiceServer).UnaryCall(ctx, req.(*SimpleRequest))
  242. }
  243. return interceptor(ctx, in, info, handler)
  244. }
  245. func _TestService_FullDuplexCall_Handler(srv interface{}, stream grpc.ServerStream) error {
  246. return srv.(TestServiceServer).FullDuplexCall(&testServiceFullDuplexCallServer{stream})
  247. }
  248. type TestService_FullDuplexCallServer interface {
  249. Send(*SimpleResponse) error
  250. Recv() (*SimpleRequest, error)
  251. grpc.ServerStream
  252. }
  253. type testServiceFullDuplexCallServer struct {
  254. grpc.ServerStream
  255. }
  256. func (x *testServiceFullDuplexCallServer) Send(m *SimpleResponse) error {
  257. return x.ServerStream.SendMsg(m)
  258. }
  259. func (x *testServiceFullDuplexCallServer) Recv() (*SimpleRequest, error) {
  260. m := new(SimpleRequest)
  261. if err := x.ServerStream.RecvMsg(m); err != nil {
  262. return nil, err
  263. }
  264. return m, nil
  265. }
  266. func _TestService_ClientStreamCall_Handler(srv interface{}, stream grpc.ServerStream) error {
  267. return srv.(TestServiceServer).ClientStreamCall(&testServiceClientStreamCallServer{stream})
  268. }
  269. type TestService_ClientStreamCallServer interface {
  270. SendAndClose(*SimpleResponse) error
  271. Recv() (*SimpleRequest, error)
  272. grpc.ServerStream
  273. }
  274. type testServiceClientStreamCallServer struct {
  275. grpc.ServerStream
  276. }
  277. func (x *testServiceClientStreamCallServer) SendAndClose(m *SimpleResponse) error {
  278. return x.ServerStream.SendMsg(m)
  279. }
  280. func (x *testServiceClientStreamCallServer) Recv() (*SimpleRequest, error) {
  281. m := new(SimpleRequest)
  282. if err := x.ServerStream.RecvMsg(m); err != nil {
  283. return nil, err
  284. }
  285. return m, nil
  286. }
  287. func _TestService_ServerStreamCall_Handler(srv interface{}, stream grpc.ServerStream) error {
  288. m := new(SimpleRequest)
  289. if err := stream.RecvMsg(m); err != nil {
  290. return err
  291. }
  292. return srv.(TestServiceServer).ServerStreamCall(m, &testServiceServerStreamCallServer{stream})
  293. }
  294. type TestService_ServerStreamCallServer interface {
  295. Send(*SimpleResponse) error
  296. grpc.ServerStream
  297. }
  298. type testServiceServerStreamCallServer struct {
  299. grpc.ServerStream
  300. }
  301. func (x *testServiceServerStreamCallServer) Send(m *SimpleResponse) error {
  302. return x.ServerStream.SendMsg(m)
  303. }
  304. var _TestService_serviceDesc = grpc.ServiceDesc{
  305. ServiceName: "grpc.testing.TestService",
  306. HandlerType: (*TestServiceServer)(nil),
  307. Methods: []grpc.MethodDesc{
  308. {
  309. MethodName: "UnaryCall",
  310. Handler: _TestService_UnaryCall_Handler,
  311. },
  312. },
  313. Streams: []grpc.StreamDesc{
  314. {
  315. StreamName: "FullDuplexCall",
  316. Handler: _TestService_FullDuplexCall_Handler,
  317. ServerStreams: true,
  318. ClientStreams: true,
  319. },
  320. {
  321. StreamName: "ClientStreamCall",
  322. Handler: _TestService_ClientStreamCall_Handler,
  323. ClientStreams: true,
  324. },
  325. {
  326. StreamName: "ServerStreamCall",
  327. Handler: _TestService_ServerStreamCall_Handler,
  328. ServerStreams: true,
  329. },
  330. },
  331. Metadata: "grpc_testing/test.proto",
  332. }
  333. func init() { proto.RegisterFile("grpc_testing/test.proto", fileDescriptor_test_dd7ffeaa75513a0a) }
  334. var fileDescriptor_test_dd7ffeaa75513a0a = []byte{
  335. // 202 bytes of a gzipped FileDescriptorProto
  336. 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0x2f, 0x2a, 0x48,
  337. 0x8e, 0x2f, 0x49, 0x2d, 0x2e, 0xc9, 0xcc, 0x4b, 0xd7, 0x07, 0xd1, 0x7a, 0x05, 0x45, 0xf9, 0x25,
  338. 0xf9, 0x42, 0x3c, 0x20, 0x09, 0x3d, 0xa8, 0x84, 0x92, 0x3c, 0x17, 0x6f, 0x70, 0x66, 0x6e, 0x41,
  339. 0x4e, 0x6a, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x89, 0x10, 0x1f, 0x17, 0x53, 0x66, 0x8a, 0x04,
  340. 0x93, 0x02, 0xa3, 0x06, 0x6b, 0x10, 0x53, 0x66, 0x8a, 0x92, 0x02, 0x17, 0x1f, 0x4c, 0x41, 0x71,
  341. 0x41, 0x7e, 0x5e, 0x71, 0x2a, 0x54, 0x05, 0x33, 0x4c, 0x85, 0xd1, 0x09, 0x26, 0x2e, 0xee, 0x90,
  342. 0xd4, 0xe2, 0x92, 0xe0, 0xd4, 0xa2, 0xb2, 0xcc, 0xe4, 0x54, 0x21, 0x37, 0x2e, 0xce, 0xd0, 0xbc,
  343. 0xc4, 0xa2, 0x4a, 0xe7, 0xc4, 0x9c, 0x1c, 0x21, 0x69, 0x3d, 0x64, 0xeb, 0xf4, 0x50, 0xec, 0x92,
  344. 0x92, 0xc1, 0x2e, 0x09, 0xb5, 0xc7, 0x9f, 0x8b, 0xcf, 0xad, 0x34, 0x27, 0xc7, 0xa5, 0xb4, 0x20,
  345. 0x27, 0xb5, 0x82, 0x42, 0xc3, 0x34, 0x18, 0x0d, 0x18, 0x85, 0xfc, 0xb9, 0x04, 0x9c, 0x73, 0x32,
  346. 0x53, 0xf3, 0x4a, 0x82, 0x4b, 0x8a, 0x52, 0x13, 0x73, 0x29, 0x36, 0x12, 0x64, 0x20, 0xc8, 0xd3,
  347. 0xa9, 0x45, 0x54, 0x31, 0xd0, 0x80, 0x31, 0x89, 0x0d, 0x1c, 0x45, 0xc6, 0x80, 0x00, 0x00, 0x00,
  348. 0xff, 0xff, 0x4c, 0x43, 0x27, 0x67, 0xbd, 0x01, 0x00, 0x00,
  349. }