github.com/Asutorufa/yuhaiin@v0.3.6-0.20240502055049-7984da7023a0/pkg/protos/statistic/grpc/config_grpc.pb.go (about)

     1  // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
     2  // versions:
     3  // - protoc-gen-go-grpc v1.3.0
     4  // - protoc             v4.25.3
     5  // source: statistic/grpc/config.proto
     6  
     7  package service
     8  
     9  import (
    10  	context "context"
    11  	grpc "google.golang.org/grpc"
    12  	codes "google.golang.org/grpc/codes"
    13  	status "google.golang.org/grpc/status"
    14  	emptypb "google.golang.org/protobuf/types/known/emptypb"
    15  )
    16  
    17  // This is a compile-time assertion to ensure that this generated file
    18  // is compatible with the grpc package it is being compiled against.
    19  // Requires gRPC-Go v1.32.0 or later.
    20  const _ = grpc.SupportPackageIsVersion7
    21  
    22  const (
    23  	Connections_Conns_FullMethodName     = "/yuhaiin.protos.statistic.service.connections/conns"
    24  	Connections_CloseConn_FullMethodName = "/yuhaiin.protos.statistic.service.connections/close_conn"
    25  	Connections_Total_FullMethodName     = "/yuhaiin.protos.statistic.service.connections/total"
    26  	Connections_Notify_FullMethodName    = "/yuhaiin.protos.statistic.service.connections/notify"
    27  )
    28  
    29  // ConnectionsClient is the client API for Connections service.
    30  //
    31  // 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.
    32  type ConnectionsClient interface {
    33  	Conns(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*NotifyNewConnections, error)
    34  	CloseConn(ctx context.Context, in *NotifyRemoveConnections, opts ...grpc.CallOption) (*emptypb.Empty, error)
    35  	Total(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*TotalFlow, error)
    36  	Notify(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (Connections_NotifyClient, error)
    37  }
    38  
    39  type connectionsClient struct {
    40  	cc grpc.ClientConnInterface
    41  }
    42  
    43  func NewConnectionsClient(cc grpc.ClientConnInterface) ConnectionsClient {
    44  	return &connectionsClient{cc}
    45  }
    46  
    47  func (c *connectionsClient) Conns(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*NotifyNewConnections, error) {
    48  	out := new(NotifyNewConnections)
    49  	err := c.cc.Invoke(ctx, Connections_Conns_FullMethodName, in, out, opts...)
    50  	if err != nil {
    51  		return nil, err
    52  	}
    53  	return out, nil
    54  }
    55  
    56  func (c *connectionsClient) CloseConn(ctx context.Context, in *NotifyRemoveConnections, opts ...grpc.CallOption) (*emptypb.Empty, error) {
    57  	out := new(emptypb.Empty)
    58  	err := c.cc.Invoke(ctx, Connections_CloseConn_FullMethodName, in, out, opts...)
    59  	if err != nil {
    60  		return nil, err
    61  	}
    62  	return out, nil
    63  }
    64  
    65  func (c *connectionsClient) Total(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*TotalFlow, error) {
    66  	out := new(TotalFlow)
    67  	err := c.cc.Invoke(ctx, Connections_Total_FullMethodName, in, out, opts...)
    68  	if err != nil {
    69  		return nil, err
    70  	}
    71  	return out, nil
    72  }
    73  
    74  func (c *connectionsClient) Notify(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (Connections_NotifyClient, error) {
    75  	stream, err := c.cc.NewStream(ctx, &Connections_ServiceDesc.Streams[0], Connections_Notify_FullMethodName, opts...)
    76  	if err != nil {
    77  		return nil, err
    78  	}
    79  	x := &connectionsNotifyClient{stream}
    80  	if err := x.ClientStream.SendMsg(in); err != nil {
    81  		return nil, err
    82  	}
    83  	if err := x.ClientStream.CloseSend(); err != nil {
    84  		return nil, err
    85  	}
    86  	return x, nil
    87  }
    88  
    89  type Connections_NotifyClient interface {
    90  	Recv() (*NotifyData, error)
    91  	grpc.ClientStream
    92  }
    93  
    94  type connectionsNotifyClient struct {
    95  	grpc.ClientStream
    96  }
    97  
    98  func (x *connectionsNotifyClient) Recv() (*NotifyData, error) {
    99  	m := new(NotifyData)
   100  	if err := x.ClientStream.RecvMsg(m); err != nil {
   101  		return nil, err
   102  	}
   103  	return m, nil
   104  }
   105  
   106  // ConnectionsServer is the server API for Connections service.
   107  // All implementations must embed UnimplementedConnectionsServer
   108  // for forward compatibility
   109  type ConnectionsServer interface {
   110  	Conns(context.Context, *emptypb.Empty) (*NotifyNewConnections, error)
   111  	CloseConn(context.Context, *NotifyRemoveConnections) (*emptypb.Empty, error)
   112  	Total(context.Context, *emptypb.Empty) (*TotalFlow, error)
   113  	Notify(*emptypb.Empty, Connections_NotifyServer) error
   114  	mustEmbedUnimplementedConnectionsServer()
   115  }
   116  
   117  // UnimplementedConnectionsServer must be embedded to have forward compatible implementations.
   118  type UnimplementedConnectionsServer struct {
   119  }
   120  
   121  func (UnimplementedConnectionsServer) Conns(context.Context, *emptypb.Empty) (*NotifyNewConnections, error) {
   122  	return nil, status.Errorf(codes.Unimplemented, "method Conns not implemented")
   123  }
   124  func (UnimplementedConnectionsServer) CloseConn(context.Context, *NotifyRemoveConnections) (*emptypb.Empty, error) {
   125  	return nil, status.Errorf(codes.Unimplemented, "method CloseConn not implemented")
   126  }
   127  func (UnimplementedConnectionsServer) Total(context.Context, *emptypb.Empty) (*TotalFlow, error) {
   128  	return nil, status.Errorf(codes.Unimplemented, "method Total not implemented")
   129  }
   130  func (UnimplementedConnectionsServer) Notify(*emptypb.Empty, Connections_NotifyServer) error {
   131  	return status.Errorf(codes.Unimplemented, "method Notify not implemented")
   132  }
   133  func (UnimplementedConnectionsServer) mustEmbedUnimplementedConnectionsServer() {}
   134  
   135  // UnsafeConnectionsServer may be embedded to opt out of forward compatibility for this service.
   136  // Use of this interface is not recommended, as added methods to ConnectionsServer will
   137  // result in compilation errors.
   138  type UnsafeConnectionsServer interface {
   139  	mustEmbedUnimplementedConnectionsServer()
   140  }
   141  
   142  func RegisterConnectionsServer(s grpc.ServiceRegistrar, srv ConnectionsServer) {
   143  	s.RegisterService(&Connections_ServiceDesc, srv)
   144  }
   145  
   146  func _Connections_Conns_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   147  	in := new(emptypb.Empty)
   148  	if err := dec(in); err != nil {
   149  		return nil, err
   150  	}
   151  	if interceptor == nil {
   152  		return srv.(ConnectionsServer).Conns(ctx, in)
   153  	}
   154  	info := &grpc.UnaryServerInfo{
   155  		Server:     srv,
   156  		FullMethod: Connections_Conns_FullMethodName,
   157  	}
   158  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   159  		return srv.(ConnectionsServer).Conns(ctx, req.(*emptypb.Empty))
   160  	}
   161  	return interceptor(ctx, in, info, handler)
   162  }
   163  
   164  func _Connections_CloseConn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   165  	in := new(NotifyRemoveConnections)
   166  	if err := dec(in); err != nil {
   167  		return nil, err
   168  	}
   169  	if interceptor == nil {
   170  		return srv.(ConnectionsServer).CloseConn(ctx, in)
   171  	}
   172  	info := &grpc.UnaryServerInfo{
   173  		Server:     srv,
   174  		FullMethod: Connections_CloseConn_FullMethodName,
   175  	}
   176  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   177  		return srv.(ConnectionsServer).CloseConn(ctx, req.(*NotifyRemoveConnections))
   178  	}
   179  	return interceptor(ctx, in, info, handler)
   180  }
   181  
   182  func _Connections_Total_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   183  	in := new(emptypb.Empty)
   184  	if err := dec(in); err != nil {
   185  		return nil, err
   186  	}
   187  	if interceptor == nil {
   188  		return srv.(ConnectionsServer).Total(ctx, in)
   189  	}
   190  	info := &grpc.UnaryServerInfo{
   191  		Server:     srv,
   192  		FullMethod: Connections_Total_FullMethodName,
   193  	}
   194  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   195  		return srv.(ConnectionsServer).Total(ctx, req.(*emptypb.Empty))
   196  	}
   197  	return interceptor(ctx, in, info, handler)
   198  }
   199  
   200  func _Connections_Notify_Handler(srv interface{}, stream grpc.ServerStream) error {
   201  	m := new(emptypb.Empty)
   202  	if err := stream.RecvMsg(m); err != nil {
   203  		return err
   204  	}
   205  	return srv.(ConnectionsServer).Notify(m, &connectionsNotifyServer{stream})
   206  }
   207  
   208  type Connections_NotifyServer interface {
   209  	Send(*NotifyData) error
   210  	grpc.ServerStream
   211  }
   212  
   213  type connectionsNotifyServer struct {
   214  	grpc.ServerStream
   215  }
   216  
   217  func (x *connectionsNotifyServer) Send(m *NotifyData) error {
   218  	return x.ServerStream.SendMsg(m)
   219  }
   220  
   221  // Connections_ServiceDesc is the grpc.ServiceDesc for Connections service.
   222  // It's only intended for direct use with grpc.RegisterService,
   223  // and not to be introspected or modified (even as a copy)
   224  var Connections_ServiceDesc = grpc.ServiceDesc{
   225  	ServiceName: "yuhaiin.protos.statistic.service.connections",
   226  	HandlerType: (*ConnectionsServer)(nil),
   227  	Methods: []grpc.MethodDesc{
   228  		{
   229  			MethodName: "conns",
   230  			Handler:    _Connections_Conns_Handler,
   231  		},
   232  		{
   233  			MethodName: "close_conn",
   234  			Handler:    _Connections_CloseConn_Handler,
   235  		},
   236  		{
   237  			MethodName: "total",
   238  			Handler:    _Connections_Total_Handler,
   239  		},
   240  	},
   241  	Streams: []grpc.StreamDesc{
   242  		{
   243  			StreamName:    "notify",
   244  			Handler:       _Connections_Notify_Handler,
   245  			ServerStreams: true,
   246  		},
   247  	},
   248  	Metadata: "statistic/grpc/config.proto",
   249  }