data_grpc.pb.go 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
  2. package fho_forward_proto
  3. import (
  4. context "context"
  5. grpc "google.golang.org/grpc"
  6. codes "google.golang.org/grpc/codes"
  7. status "google.golang.org/grpc/status"
  8. )
  9. // This is a compile-time assertion to ensure that this generated file
  10. // is compatible with the grpc package it is being compiled against.
  11. // Requires gRPC-Go v1.32.0 or later.
  12. const _ = grpc.SupportPackageIsVersion7
  13. // DataServiceClient is the client API for DataService service.
  14. //
  15. // 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.
  16. type DataServiceClient interface {
  17. GetData(ctx context.Context, in *DataRequest, opts ...grpc.CallOption) (*DataReply, error)
  18. StreamData(ctx context.Context, in *DataRequest, opts ...grpc.CallOption) (DataService_StreamDataClient, error)
  19. }
  20. type dataServiceClient struct {
  21. cc grpc.ClientConnInterface
  22. }
  23. func NewDataServiceClient(cc grpc.ClientConnInterface) DataServiceClient {
  24. return &dataServiceClient{cc}
  25. }
  26. func (c *dataServiceClient) GetData(ctx context.Context, in *DataRequest, opts ...grpc.CallOption) (*DataReply, error) {
  27. out := new(DataReply)
  28. err := c.cc.Invoke(ctx, "/fho.DataService/GetData", in, out, opts...)
  29. if err != nil {
  30. return nil, err
  31. }
  32. return out, nil
  33. }
  34. func (c *dataServiceClient) StreamData(ctx context.Context, in *DataRequest, opts ...grpc.CallOption) (DataService_StreamDataClient, error) {
  35. stream, err := c.cc.NewStream(ctx, &DataService_ServiceDesc.Streams[0], "/fho.DataService/StreamData", opts...)
  36. if err != nil {
  37. return nil, err
  38. }
  39. x := &dataServiceStreamDataClient{stream}
  40. if err := x.ClientStream.SendMsg(in); err != nil {
  41. return nil, err
  42. }
  43. if err := x.ClientStream.CloseSend(); err != nil {
  44. return nil, err
  45. }
  46. return x, nil
  47. }
  48. type DataService_StreamDataClient interface {
  49. Recv() (*DataReply, error)
  50. grpc.ClientStream
  51. }
  52. type dataServiceStreamDataClient struct {
  53. grpc.ClientStream
  54. }
  55. func (x *dataServiceStreamDataClient) Recv() (*DataReply, error) {
  56. m := new(DataReply)
  57. if err := x.ClientStream.RecvMsg(m); err != nil {
  58. return nil, err
  59. }
  60. return m, nil
  61. }
  62. // DataServiceServer is the server API for DataService service.
  63. // All implementations must embed UnimplementedDataServiceServer
  64. // for forward compatibility
  65. type DataServiceServer interface {
  66. GetData(context.Context, *DataRequest) (*DataReply, error)
  67. StreamData(*DataRequest, DataService_StreamDataServer) error
  68. mustEmbedUnimplementedDataServiceServer()
  69. }
  70. // UnimplementedDataServiceServer must be embedded to have forward compatible implementations.
  71. type UnimplementedDataServiceServer struct {
  72. }
  73. func (UnimplementedDataServiceServer) GetData(context.Context, *DataRequest) (*DataReply, error) {
  74. return nil, status.Errorf(codes.Unimplemented, "method GetData not implemented")
  75. }
  76. func (UnimplementedDataServiceServer) StreamData(*DataRequest, DataService_StreamDataServer) error {
  77. return status.Errorf(codes.Unimplemented, "method StreamData not implemented")
  78. }
  79. func (UnimplementedDataServiceServer) mustEmbedUnimplementedDataServiceServer() {}
  80. // UnsafeDataServiceServer may be embedded to opt out of forward compatibility for this service.
  81. // Use of this interface is not recommended, as added methods to DataServiceServer will
  82. // result in compilation errors.
  83. type UnsafeDataServiceServer interface {
  84. mustEmbedUnimplementedDataServiceServer()
  85. }
  86. func RegisterDataServiceServer(s grpc.ServiceRegistrar, srv DataServiceServer) {
  87. s.RegisterService(&DataService_ServiceDesc, srv)
  88. }
  89. func _DataService_GetData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  90. in := new(DataRequest)
  91. if err := dec(in); err != nil {
  92. return nil, err
  93. }
  94. if interceptor == nil {
  95. return srv.(DataServiceServer).GetData(ctx, in)
  96. }
  97. info := &grpc.UnaryServerInfo{
  98. Server: srv,
  99. FullMethod: "/fho.DataService/GetData",
  100. }
  101. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  102. return srv.(DataServiceServer).GetData(ctx, req.(*DataRequest))
  103. }
  104. return interceptor(ctx, in, info, handler)
  105. }
  106. func _DataService_StreamData_Handler(srv interface{}, stream grpc.ServerStream) error {
  107. m := new(DataRequest)
  108. if err := stream.RecvMsg(m); err != nil {
  109. return err
  110. }
  111. return srv.(DataServiceServer).StreamData(m, &dataServiceStreamDataServer{stream})
  112. }
  113. type DataService_StreamDataServer interface {
  114. Send(*DataReply) error
  115. grpc.ServerStream
  116. }
  117. type dataServiceStreamDataServer struct {
  118. grpc.ServerStream
  119. }
  120. func (x *dataServiceStreamDataServer) Send(m *DataReply) error {
  121. return x.ServerStream.SendMsg(m)
  122. }
  123. // DataService_ServiceDesc is the grpc.ServiceDesc for DataService service.
  124. // It's only intended for direct use with grpc.RegisterService,
  125. // and not to be introspected or modified (even as a copy)
  126. var DataService_ServiceDesc = grpc.ServiceDesc{
  127. ServiceName: "fho.DataService",
  128. HandlerType: (*DataServiceServer)(nil),
  129. Methods: []grpc.MethodDesc{
  130. {
  131. MethodName: "GetData",
  132. Handler: _DataService_GetData_Handler,
  133. },
  134. },
  135. Streams: []grpc.StreamDesc{
  136. {
  137. StreamName: "StreamData",
  138. Handler: _DataService_StreamData_Handler,
  139. ServerStreams: true,
  140. },
  141. },
  142. Metadata: "data.proto",
  143. }