grpc_grpc.pb.go 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
  2. package grpc
  3. import (
  4. context "context"
  5. grpc "google.golang.org/grpc"
  6. )
  7. // Reference imports to suppress errors if they are not otherwise used.
  8. var _ context.Context
  9. var _ grpc.ClientConn
  10. // This is a compile-time assertion to ensure that this generated file
  11. // is compatible with the grpc package it is being compiled against.
  12. const _ = grpc.SupportPackageIsVersion4
  13. // TestServiceClient is the client API for TestService service.
  14. //
  15. // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
  16. type TestServiceClient interface {
  17. UnaryCall(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
  18. // This RPC streams from the server only.
  19. DownstreamCall(ctx context.Context, in *Request, opts ...grpc.CallOption) (TestService_DownstreamCallClient, error)
  20. // This RPC streams from the client.
  21. UpstreamCall(ctx context.Context, opts ...grpc.CallOption) (TestService_UpstreamCallClient, error)
  22. // This one streams in both directions.
  23. BidiCall(ctx context.Context, opts ...grpc.CallOption) (TestService_BidiCallClient, error)
  24. }
  25. type testServiceClient struct {
  26. cc *grpc.ClientConn
  27. }
  28. func NewTestServiceClient(cc *grpc.ClientConn) TestServiceClient {
  29. return &testServiceClient{cc}
  30. }
  31. func (c *testServiceClient) UnaryCall(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) {
  32. out := new(Response)
  33. err := c.cc.Invoke(ctx, "/goproto.protoc.grpc.test_service/unary_call", in, out, opts...)
  34. if err != nil {
  35. return nil, err
  36. }
  37. return out, nil
  38. }
  39. func (c *testServiceClient) DownstreamCall(ctx context.Context, in *Request, opts ...grpc.CallOption) (TestService_DownstreamCallClient, error) {
  40. stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[0], "/goproto.protoc.grpc.test_service/downstream_call", opts...)
  41. if err != nil {
  42. return nil, err
  43. }
  44. x := &testServiceDownstreamCallClient{stream}
  45. if err := x.ClientStream.SendMsg(in); err != nil {
  46. return nil, err
  47. }
  48. if err := x.ClientStream.CloseSend(); err != nil {
  49. return nil, err
  50. }
  51. return x, nil
  52. }
  53. type TestService_DownstreamCallClient interface {
  54. Recv() (*Response, error)
  55. grpc.ClientStream
  56. }
  57. type testServiceDownstreamCallClient struct {
  58. grpc.ClientStream
  59. }
  60. func (x *testServiceDownstreamCallClient) Recv() (*Response, error) {
  61. m := new(Response)
  62. if err := x.ClientStream.RecvMsg(m); err != nil {
  63. return nil, err
  64. }
  65. return m, nil
  66. }
  67. func (c *testServiceClient) UpstreamCall(ctx context.Context, opts ...grpc.CallOption) (TestService_UpstreamCallClient, error) {
  68. stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[1], "/goproto.protoc.grpc.test_service/upstream_call", opts...)
  69. if err != nil {
  70. return nil, err
  71. }
  72. x := &testServiceUpstreamCallClient{stream}
  73. return x, nil
  74. }
  75. type TestService_UpstreamCallClient interface {
  76. Send(*Request) error
  77. CloseAndRecv() (*Response, error)
  78. grpc.ClientStream
  79. }
  80. type testServiceUpstreamCallClient struct {
  81. grpc.ClientStream
  82. }
  83. func (x *testServiceUpstreamCallClient) Send(m *Request) error {
  84. return x.ClientStream.SendMsg(m)
  85. }
  86. func (x *testServiceUpstreamCallClient) CloseAndRecv() (*Response, error) {
  87. if err := x.ClientStream.CloseSend(); err != nil {
  88. return nil, err
  89. }
  90. m := new(Response)
  91. if err := x.ClientStream.RecvMsg(m); err != nil {
  92. return nil, err
  93. }
  94. return m, nil
  95. }
  96. func (c *testServiceClient) BidiCall(ctx context.Context, opts ...grpc.CallOption) (TestService_BidiCallClient, error) {
  97. stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[2], "/goproto.protoc.grpc.test_service/bidi_call", opts...)
  98. if err != nil {
  99. return nil, err
  100. }
  101. x := &testServiceBidiCallClient{stream}
  102. return x, nil
  103. }
  104. type TestService_BidiCallClient interface {
  105. Send(*Request) error
  106. Recv() (*Response, error)
  107. grpc.ClientStream
  108. }
  109. type testServiceBidiCallClient struct {
  110. grpc.ClientStream
  111. }
  112. func (x *testServiceBidiCallClient) Send(m *Request) error {
  113. return x.ClientStream.SendMsg(m)
  114. }
  115. func (x *testServiceBidiCallClient) Recv() (*Response, error) {
  116. m := new(Response)
  117. if err := x.ClientStream.RecvMsg(m); err != nil {
  118. return nil, err
  119. }
  120. return m, nil
  121. }
  122. // TestServiceServer is the server API for TestService service.
  123. type TestServiceServer interface {
  124. UnaryCall(context.Context, *Request) (*Response, error)
  125. // This RPC streams from the server only.
  126. DownstreamCall(*Request, TestService_DownstreamCallServer) error
  127. // This RPC streams from the client.
  128. UpstreamCall(TestService_UpstreamCallServer) error
  129. // This one streams in both directions.
  130. BidiCall(TestService_BidiCallServer) error
  131. }
  132. func RegisterTestServiceServer(s *grpc.Server, srv TestServiceServer) {
  133. s.RegisterService(&_TestService_serviceDesc, srv)
  134. }
  135. func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  136. in := new(Request)
  137. if err := dec(in); err != nil {
  138. return nil, err
  139. }
  140. if interceptor == nil {
  141. return srv.(TestServiceServer).UnaryCall(ctx, in)
  142. }
  143. info := &grpc.UnaryServerInfo{
  144. Server: srv,
  145. FullMethod: "/goproto.protoc.grpc.test_service/UnaryCall",
  146. }
  147. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  148. return srv.(TestServiceServer).UnaryCall(ctx, req.(*Request))
  149. }
  150. return interceptor(ctx, in, info, handler)
  151. }
  152. func _TestService_DownstreamCall_Handler(srv interface{}, stream grpc.ServerStream) error {
  153. m := new(Request)
  154. if err := stream.RecvMsg(m); err != nil {
  155. return err
  156. }
  157. return srv.(TestServiceServer).DownstreamCall(m, &testServiceDownstreamCallServer{stream})
  158. }
  159. type TestService_DownstreamCallServer interface {
  160. Send(*Response) error
  161. grpc.ServerStream
  162. }
  163. type testServiceDownstreamCallServer struct {
  164. grpc.ServerStream
  165. }
  166. func (x *testServiceDownstreamCallServer) Send(m *Response) error {
  167. return x.ServerStream.SendMsg(m)
  168. }
  169. func _TestService_UpstreamCall_Handler(srv interface{}, stream grpc.ServerStream) error {
  170. return srv.(TestServiceServer).UpstreamCall(&testServiceUpstreamCallServer{stream})
  171. }
  172. type TestService_UpstreamCallServer interface {
  173. SendAndClose(*Response) error
  174. Recv() (*Request, error)
  175. grpc.ServerStream
  176. }
  177. type testServiceUpstreamCallServer struct {
  178. grpc.ServerStream
  179. }
  180. func (x *testServiceUpstreamCallServer) SendAndClose(m *Response) error {
  181. return x.ServerStream.SendMsg(m)
  182. }
  183. func (x *testServiceUpstreamCallServer) Recv() (*Request, error) {
  184. m := new(Request)
  185. if err := x.ServerStream.RecvMsg(m); err != nil {
  186. return nil, err
  187. }
  188. return m, nil
  189. }
  190. func _TestService_BidiCall_Handler(srv interface{}, stream grpc.ServerStream) error {
  191. return srv.(TestServiceServer).BidiCall(&testServiceBidiCallServer{stream})
  192. }
  193. type TestService_BidiCallServer interface {
  194. Send(*Response) error
  195. Recv() (*Request, error)
  196. grpc.ServerStream
  197. }
  198. type testServiceBidiCallServer struct {
  199. grpc.ServerStream
  200. }
  201. func (x *testServiceBidiCallServer) Send(m *Response) error {
  202. return x.ServerStream.SendMsg(m)
  203. }
  204. func (x *testServiceBidiCallServer) Recv() (*Request, error) {
  205. m := new(Request)
  206. if err := x.ServerStream.RecvMsg(m); err != nil {
  207. return nil, err
  208. }
  209. return m, nil
  210. }
  211. var _TestService_serviceDesc = grpc.ServiceDesc{
  212. ServiceName: "goproto.protoc.grpc.test_service",
  213. HandlerType: (*TestServiceServer)(nil),
  214. Methods: []grpc.MethodDesc{
  215. {
  216. MethodName: "unary_call",
  217. Handler: _TestService_UnaryCall_Handler,
  218. },
  219. },
  220. Streams: []grpc.StreamDesc{
  221. {
  222. StreamName: "downstream_call",
  223. Handler: _TestService_DownstreamCall_Handler,
  224. ServerStreams: true,
  225. },
  226. {
  227. StreamName: "upstream_call",
  228. Handler: _TestService_UpstreamCall_Handler,
  229. ClientStreams: true,
  230. },
  231. {
  232. StreamName: "bidi_call",
  233. Handler: _TestService_BidiCall_Handler,
  234. ServerStreams: true,
  235. ClientStreams: true,
  236. },
  237. },
  238. Metadata: "grpc/grpc.proto",
  239. }