gobus_grpc.pb.go 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
  2. // versions:
  3. // - protoc-gen-go-grpc v1.2.0
  4. // - protoc v3.19.4
  5. // source: api/gobus.proto
  6. package netapi
  7. import (
  8. context "context"
  9. grpc "google.golang.org/grpc"
  10. codes "google.golang.org/grpc/codes"
  11. status "google.golang.org/grpc/status"
  12. )
  13. // This is a compile-time assertion to ensure that this generated file
  14. // is compatible with the grpc package it is being compiled against.
  15. // Requires gRPC-Go v1.32.0 or later.
  16. const _ = grpc.SupportPackageIsVersion7
  17. // GoBusClient is the client API for GoBus service.
  18. //
  19. // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
  20. type GoBusClient interface {
  21. // Public -- создаёт запись в открытом разделе хранилище
  22. Public(ctx context.Context, in *PublicRequest, opts ...grpc.CallOption) (*DefaultResponse, error)
  23. // SendSync -- синхронный запрос в топик
  24. SendSync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error)
  25. // Subscribe -- подписка по шаблону
  26. Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (GoBus_SubscribeClient, error)
  27. // SubscribeBuffer -- подписка по шаблону с буфером на выход
  28. SubscribeBuffer(ctx context.Context, in *BuffRequest, opts ...grpc.CallOption) (GoBus_SubscribeBufferClient, error)
  29. // Get -- возвращает значения топиков по шаблону
  30. Get(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (*SyncResponse, error)
  31. }
  32. type goBusClient struct {
  33. cc grpc.ClientConnInterface
  34. }
  35. func NewGoBusClient(cc grpc.ClientConnInterface) GoBusClient {
  36. return &goBusClient{cc}
  37. }
  38. func (c *goBusClient) Public(ctx context.Context, in *PublicRequest, opts ...grpc.CallOption) (*DefaultResponse, error) {
  39. out := new(DefaultResponse)
  40. err := c.cc.Invoke(ctx, "/parserin.GoBus/Public", in, out, opts...)
  41. if err != nil {
  42. return nil, err
  43. }
  44. return out, nil
  45. }
  46. func (c *goBusClient) SendSync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error) {
  47. out := new(SyncResponse)
  48. err := c.cc.Invoke(ctx, "/parserin.GoBus/SendSync", in, out, opts...)
  49. if err != nil {
  50. return nil, err
  51. }
  52. return out, nil
  53. }
  54. func (c *goBusClient) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (GoBus_SubscribeClient, error) {
  55. stream, err := c.cc.NewStream(ctx, &GoBus_ServiceDesc.Streams[0], "/parserin.GoBus/Subscribe", opts...)
  56. if err != nil {
  57. return nil, err
  58. }
  59. x := &goBusSubscribeClient{stream}
  60. if err := x.ClientStream.SendMsg(in); err != nil {
  61. return nil, err
  62. }
  63. if err := x.ClientStream.CloseSend(); err != nil {
  64. return nil, err
  65. }
  66. return x, nil
  67. }
  68. type GoBus_SubscribeClient interface {
  69. Recv() (*SyncResponse, error)
  70. grpc.ClientStream
  71. }
  72. type goBusSubscribeClient struct {
  73. grpc.ClientStream
  74. }
  75. func (x *goBusSubscribeClient) Recv() (*SyncResponse, error) {
  76. m := new(SyncResponse)
  77. if err := x.ClientStream.RecvMsg(m); err != nil {
  78. return nil, err
  79. }
  80. return m, nil
  81. }
  82. func (c *goBusClient) SubscribeBuffer(ctx context.Context, in *BuffRequest, opts ...grpc.CallOption) (GoBus_SubscribeBufferClient, error) {
  83. stream, err := c.cc.NewStream(ctx, &GoBus_ServiceDesc.Streams[1], "/parserin.GoBus/SubscribeBuffer", opts...)
  84. if err != nil {
  85. return nil, err
  86. }
  87. x := &goBusSubscribeBufferClient{stream}
  88. if err := x.ClientStream.SendMsg(in); err != nil {
  89. return nil, err
  90. }
  91. if err := x.ClientStream.CloseSend(); err != nil {
  92. return nil, err
  93. }
  94. return x, nil
  95. }
  96. type GoBus_SubscribeBufferClient interface {
  97. Recv() (*BuffResponse, error)
  98. grpc.ClientStream
  99. }
  100. type goBusSubscribeBufferClient struct {
  101. grpc.ClientStream
  102. }
  103. func (x *goBusSubscribeBufferClient) Recv() (*BuffResponse, error) {
  104. m := new(BuffResponse)
  105. if err := x.ClientStream.RecvMsg(m); err != nil {
  106. return nil, err
  107. }
  108. return m, nil
  109. }
  110. func (c *goBusClient) Get(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (*SyncResponse, error) {
  111. out := new(SyncResponse)
  112. err := c.cc.Invoke(ctx, "/parserin.GoBus/Get", in, out, opts...)
  113. if err != nil {
  114. return nil, err
  115. }
  116. return out, nil
  117. }
  118. // GoBusServer is the server API for GoBus service.
  119. // All implementations must embed UnimplementedGoBusServer
  120. // for forward compatibility
  121. type GoBusServer interface {
  122. // Public -- создаёт запись в открытом разделе хранилище
  123. Public(context.Context, *PublicRequest) (*DefaultResponse, error)
  124. // SendSync -- синхронный запрос в топик
  125. SendSync(context.Context, *SyncRequest) (*SyncResponse, error)
  126. // Subscribe -- подписка по шаблону
  127. Subscribe(*SubscribeRequest, GoBus_SubscribeServer) error
  128. // SubscribeBuffer -- подписка по шаблону с буфером на выход
  129. SubscribeBuffer(*BuffRequest, GoBus_SubscribeBufferServer) error
  130. // Get -- возвращает значения топиков по шаблону
  131. Get(context.Context, *SubscribeRequest) (*SyncResponse, error)
  132. mustEmbedUnimplementedGoBusServer()
  133. }
  134. // UnimplementedGoBusServer must be embedded to have forward compatible implementations.
  135. type UnimplementedGoBusServer struct {
  136. }
  137. func (UnimplementedGoBusServer) Public(context.Context, *PublicRequest) (*DefaultResponse, error) {
  138. return nil, status.Errorf(codes.Unimplemented, "method Public not implemented")
  139. }
  140. func (UnimplementedGoBusServer) SendSync(context.Context, *SyncRequest) (*SyncResponse, error) {
  141. return nil, status.Errorf(codes.Unimplemented, "method SendSync not implemented")
  142. }
  143. func (UnimplementedGoBusServer) Subscribe(*SubscribeRequest, GoBus_SubscribeServer) error {
  144. return status.Errorf(codes.Unimplemented, "method Subscribe not implemented")
  145. }
  146. func (UnimplementedGoBusServer) SubscribeBuffer(*BuffRequest, GoBus_SubscribeBufferServer) error {
  147. return status.Errorf(codes.Unimplemented, "method SubscribeBuffer not implemented")
  148. }
  149. func (UnimplementedGoBusServer) Get(context.Context, *SubscribeRequest) (*SyncResponse, error) {
  150. return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
  151. }
  152. func (UnimplementedGoBusServer) mustEmbedUnimplementedGoBusServer() {}
  153. // UnsafeGoBusServer may be embedded to opt out of forward compatibility for this service.
  154. // Use of this interface is not recommended, as added methods to GoBusServer will
  155. // result in compilation errors.
  156. type UnsafeGoBusServer interface {
  157. mustEmbedUnimplementedGoBusServer()
  158. }
  159. func RegisterGoBusServer(s grpc.ServiceRegistrar, srv GoBusServer) {
  160. s.RegisterService(&GoBus_ServiceDesc, srv)
  161. }
  162. func _GoBus_Public_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  163. in := new(PublicRequest)
  164. if err := dec(in); err != nil {
  165. return nil, err
  166. }
  167. if interceptor == nil {
  168. return srv.(GoBusServer).Public(ctx, in)
  169. }
  170. info := &grpc.UnaryServerInfo{
  171. Server: srv,
  172. FullMethod: "/parserin.GoBus/Public",
  173. }
  174. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  175. return srv.(GoBusServer).Public(ctx, req.(*PublicRequest))
  176. }
  177. return interceptor(ctx, in, info, handler)
  178. }
  179. func _GoBus_SendSync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  180. in := new(SyncRequest)
  181. if err := dec(in); err != nil {
  182. return nil, err
  183. }
  184. if interceptor == nil {
  185. return srv.(GoBusServer).SendSync(ctx, in)
  186. }
  187. info := &grpc.UnaryServerInfo{
  188. Server: srv,
  189. FullMethod: "/parserin.GoBus/SendSync",
  190. }
  191. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  192. return srv.(GoBusServer).SendSync(ctx, req.(*SyncRequest))
  193. }
  194. return interceptor(ctx, in, info, handler)
  195. }
  196. func _GoBus_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) error {
  197. m := new(SubscribeRequest)
  198. if err := stream.RecvMsg(m); err != nil {
  199. return err
  200. }
  201. return srv.(GoBusServer).Subscribe(m, &goBusSubscribeServer{stream})
  202. }
  203. type GoBus_SubscribeServer interface {
  204. Send(*SyncResponse) error
  205. grpc.ServerStream
  206. }
  207. type goBusSubscribeServer struct {
  208. grpc.ServerStream
  209. }
  210. func (x *goBusSubscribeServer) Send(m *SyncResponse) error {
  211. return x.ServerStream.SendMsg(m)
  212. }
  213. func _GoBus_SubscribeBuffer_Handler(srv interface{}, stream grpc.ServerStream) error {
  214. m := new(BuffRequest)
  215. if err := stream.RecvMsg(m); err != nil {
  216. return err
  217. }
  218. return srv.(GoBusServer).SubscribeBuffer(m, &goBusSubscribeBufferServer{stream})
  219. }
  220. type GoBus_SubscribeBufferServer interface {
  221. Send(*BuffResponse) error
  222. grpc.ServerStream
  223. }
  224. type goBusSubscribeBufferServer struct {
  225. grpc.ServerStream
  226. }
  227. func (x *goBusSubscribeBufferServer) Send(m *BuffResponse) error {
  228. return x.ServerStream.SendMsg(m)
  229. }
  230. func _GoBus_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  231. in := new(SubscribeRequest)
  232. if err := dec(in); err != nil {
  233. return nil, err
  234. }
  235. if interceptor == nil {
  236. return srv.(GoBusServer).Get(ctx, in)
  237. }
  238. info := &grpc.UnaryServerInfo{
  239. Server: srv,
  240. FullMethod: "/parserin.GoBus/Get",
  241. }
  242. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  243. return srv.(GoBusServer).Get(ctx, req.(*SubscribeRequest))
  244. }
  245. return interceptor(ctx, in, info, handler)
  246. }
  247. // GoBus_ServiceDesc is the grpc.ServiceDesc for GoBus service.
  248. // It's only intended for direct use with grpc.RegisterService,
  249. // and not to be introspected or modified (even as a copy)
  250. var GoBus_ServiceDesc = grpc.ServiceDesc{
  251. ServiceName: "parserin.GoBus",
  252. HandlerType: (*GoBusServer)(nil),
  253. Methods: []grpc.MethodDesc{
  254. {
  255. MethodName: "Public",
  256. Handler: _GoBus_Public_Handler,
  257. },
  258. {
  259. MethodName: "SendSync",
  260. Handler: _GoBus_SendSync_Handler,
  261. },
  262. {
  263. MethodName: "Get",
  264. Handler: _GoBus_Get_Handler,
  265. },
  266. },
  267. Streams: []grpc.StreamDesc{
  268. {
  269. StreamName: "Subscribe",
  270. Handler: _GoBus_Subscribe_Handler,
  271. ServerStreams: true,
  272. },
  273. {
  274. StreamName: "SubscribeBuffer",
  275. Handler: _GoBus_SubscribeBuffer_Handler,
  276. ServerStreams: true,
  277. },
  278. },
  279. Metadata: "api/gobus.proto",
  280. }