gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/grpc/stress/grpc_testing/metrics_grpc.pb.go (about)

     1  // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
     2  // versions:
     3  // - protoc-gen-go-grpc v1.2.0
     4  // - protoc             v3.14.0
     5  // source: stress/grpc_testing/metrics.proto
     6  
     7  package grpc_testing
     8  
     9  import (
    10  	context "context"
    11  	grpc "gitee.com/ks-custle/core-gm/grpc"
    12  	codes "gitee.com/ks-custle/core-gm/grpc/codes"
    13  	status "gitee.com/ks-custle/core-gm/grpc/status"
    14  )
    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  
    21  // MetricsServiceClient is the client API for MetricsService service.
    22  //
    23  // 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.
    24  type MetricsServiceClient interface {
    25  	// Returns the values of all the gauges that are currently being maintained by
    26  	// the service
    27  	GetAllGauges(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (MetricsService_GetAllGaugesClient, error)
    28  	// Returns the value of one gauge
    29  	GetGauge(ctx context.Context, in *GaugeRequest, opts ...grpc.CallOption) (*GaugeResponse, error)
    30  }
    31  
    32  type metricsServiceClient struct {
    33  	cc grpc.ClientConnInterface
    34  }
    35  
    36  func NewMetricsServiceClient(cc grpc.ClientConnInterface) MetricsServiceClient {
    37  	return &metricsServiceClient{cc}
    38  }
    39  
    40  func (c *metricsServiceClient) GetAllGauges(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (MetricsService_GetAllGaugesClient, error) {
    41  	stream, err := c.cc.NewStream(ctx, &MetricsService_ServiceDesc.Streams[0], "/grpc.testing.MetricsService/GetAllGauges", opts...)
    42  	if err != nil {
    43  		return nil, err
    44  	}
    45  	x := &metricsServiceGetAllGaugesClient{stream}
    46  	if err := x.ClientStream.SendMsg(in); err != nil {
    47  		return nil, err
    48  	}
    49  	if err := x.ClientStream.CloseSend(); err != nil {
    50  		return nil, err
    51  	}
    52  	return x, nil
    53  }
    54  
    55  type MetricsService_GetAllGaugesClient interface {
    56  	Recv() (*GaugeResponse, error)
    57  	grpc.ClientStream
    58  }
    59  
    60  type metricsServiceGetAllGaugesClient struct {
    61  	grpc.ClientStream
    62  }
    63  
    64  func (x *metricsServiceGetAllGaugesClient) Recv() (*GaugeResponse, error) {
    65  	m := new(GaugeResponse)
    66  	if err := x.ClientStream.RecvMsg(m); err != nil {
    67  		return nil, err
    68  	}
    69  	return m, nil
    70  }
    71  
    72  func (c *metricsServiceClient) GetGauge(ctx context.Context, in *GaugeRequest, opts ...grpc.CallOption) (*GaugeResponse, error) {
    73  	out := new(GaugeResponse)
    74  	err := c.cc.Invoke(ctx, "/grpc.testing.MetricsService/GetGauge", in, out, opts...)
    75  	if err != nil {
    76  		return nil, err
    77  	}
    78  	return out, nil
    79  }
    80  
    81  // MetricsServiceServer is the server API for MetricsService service.
    82  // All implementations must embed UnimplementedMetricsServiceServer
    83  // for forward compatibility
    84  type MetricsServiceServer interface {
    85  	// Returns the values of all the gauges that are currently being maintained by
    86  	// the service
    87  	GetAllGauges(*EmptyMessage, MetricsService_GetAllGaugesServer) error
    88  	// Returns the value of one gauge
    89  	GetGauge(context.Context, *GaugeRequest) (*GaugeResponse, error)
    90  	mustEmbedUnimplementedMetricsServiceServer()
    91  }
    92  
    93  // UnimplementedMetricsServiceServer must be embedded to have forward compatible implementations.
    94  type UnimplementedMetricsServiceServer struct {
    95  }
    96  
    97  func (UnimplementedMetricsServiceServer) GetAllGauges(*EmptyMessage, MetricsService_GetAllGaugesServer) error {
    98  	return status.Errorf(codes.Unimplemented, "method GetAllGauges not implemented")
    99  }
   100  func (UnimplementedMetricsServiceServer) GetGauge(context.Context, *GaugeRequest) (*GaugeResponse, error) {
   101  	return nil, status.Errorf(codes.Unimplemented, "method GetGauge not implemented")
   102  }
   103  func (UnimplementedMetricsServiceServer) mustEmbedUnimplementedMetricsServiceServer() {}
   104  
   105  // UnsafeMetricsServiceServer may be embedded to opt out of forward compatibility for this service.
   106  // Use of this interface is not recommended, as added methods to MetricsServiceServer will
   107  // result in compilation errors.
   108  type UnsafeMetricsServiceServer interface {
   109  	mustEmbedUnimplementedMetricsServiceServer()
   110  }
   111  
   112  func RegisterMetricsServiceServer(s grpc.ServiceRegistrar, srv MetricsServiceServer) {
   113  	s.RegisterService(&MetricsService_ServiceDesc, srv)
   114  }
   115  
   116  func _MetricsService_GetAllGauges_Handler(srv interface{}, stream grpc.ServerStream) error {
   117  	m := new(EmptyMessage)
   118  	if err := stream.RecvMsg(m); err != nil {
   119  		return err
   120  	}
   121  	return srv.(MetricsServiceServer).GetAllGauges(m, &metricsServiceGetAllGaugesServer{stream})
   122  }
   123  
   124  type MetricsService_GetAllGaugesServer interface {
   125  	Send(*GaugeResponse) error
   126  	grpc.ServerStream
   127  }
   128  
   129  type metricsServiceGetAllGaugesServer struct {
   130  	grpc.ServerStream
   131  }
   132  
   133  func (x *metricsServiceGetAllGaugesServer) Send(m *GaugeResponse) error {
   134  	return x.ServerStream.SendMsg(m)
   135  }
   136  
   137  func _MetricsService_GetGauge_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   138  	in := new(GaugeRequest)
   139  	if err := dec(in); err != nil {
   140  		return nil, err
   141  	}
   142  	if interceptor == nil {
   143  		return srv.(MetricsServiceServer).GetGauge(ctx, in)
   144  	}
   145  	info := &grpc.UnaryServerInfo{
   146  		Server:     srv,
   147  		FullMethod: "/grpc.testing.MetricsService/GetGauge",
   148  	}
   149  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   150  		return srv.(MetricsServiceServer).GetGauge(ctx, req.(*GaugeRequest))
   151  	}
   152  	return interceptor(ctx, in, info, handler)
   153  }
   154  
   155  // MetricsService_ServiceDesc is the grpc.ServiceDesc for MetricsService service.
   156  // It's only intended for direct use with grpc.RegisterService,
   157  // and not to be introspected or modified (even as a copy)
   158  var MetricsService_ServiceDesc = grpc.ServiceDesc{
   159  	ServiceName: "grpc.testing.MetricsService",
   160  	HandlerType: (*MetricsServiceServer)(nil),
   161  	Methods: []grpc.MethodDesc{
   162  		{
   163  			MethodName: "GetGauge",
   164  			Handler:    _MetricsService_GetGauge_Handler,
   165  		},
   166  	},
   167  	Streams: []grpc.StreamDesc{
   168  		{
   169  			StreamName:    "GetAllGauges",
   170  			Handler:       _MetricsService_GetAllGauges_Handler,
   171  			ServerStreams: true,
   172  		},
   173  	},
   174  	Metadata: "stress/grpc_testing/metrics.proto",
   175  }