gobus_grpc.pb.go 11 KB

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