| // Code generated by protoc-gen-go-grpc. DO NOT EDIT. |
| |
| package grpc_testing |
| |
| import ( |
| context "context" |
| grpc "google.golang.org/grpc" |
| codes "google.golang.org/grpc/codes" |
| status "google.golang.org/grpc/status" |
| ) |
| |
| // This is a compile-time assertion to ensure that this generated file |
| // is compatible with the grpc package it is being compiled against. |
| const _ = grpc.SupportPackageIsVersion7 |
| |
| // MetricsServiceClient is the client API for MetricsService service. |
| // |
| // 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. |
| type MetricsServiceClient interface { |
| // Returns the values of all the gauges that are currently being maintained by |
| // the service |
| GetAllGauges(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (MetricsService_GetAllGaugesClient, error) |
| // Returns the value of one gauge |
| GetGauge(ctx context.Context, in *GaugeRequest, opts ...grpc.CallOption) (*GaugeResponse, error) |
| } |
| |
| type metricsServiceClient struct { |
| cc grpc.ClientConnInterface |
| } |
| |
| func NewMetricsServiceClient(cc grpc.ClientConnInterface) MetricsServiceClient { |
| return &metricsServiceClient{cc} |
| } |
| |
| var metricsServiceGetAllGaugesStreamDesc = &grpc.StreamDesc{ |
| StreamName: "GetAllGauges", |
| ServerStreams: true, |
| } |
| |
| func (c *metricsServiceClient) GetAllGauges(ctx context.Context, in *EmptyMessage, opts ...grpc.CallOption) (MetricsService_GetAllGaugesClient, error) { |
| stream, err := c.cc.NewStream(ctx, metricsServiceGetAllGaugesStreamDesc, "/grpc.testing.MetricsService/GetAllGauges", opts...) |
| if err != nil { |
| return nil, err |
| } |
| x := &metricsServiceGetAllGaugesClient{stream} |
| if err := x.ClientStream.SendMsg(in); err != nil { |
| return nil, err |
| } |
| if err := x.ClientStream.CloseSend(); err != nil { |
| return nil, err |
| } |
| return x, nil |
| } |
| |
| type MetricsService_GetAllGaugesClient interface { |
| Recv() (*GaugeResponse, error) |
| grpc.ClientStream |
| } |
| |
| type metricsServiceGetAllGaugesClient struct { |
| grpc.ClientStream |
| } |
| |
| func (x *metricsServiceGetAllGaugesClient) Recv() (*GaugeResponse, error) { |
| m := new(GaugeResponse) |
| if err := x.ClientStream.RecvMsg(m); err != nil { |
| return nil, err |
| } |
| return m, nil |
| } |
| |
| var metricsServiceGetGaugeStreamDesc = &grpc.StreamDesc{ |
| StreamName: "GetGauge", |
| } |
| |
| func (c *metricsServiceClient) GetGauge(ctx context.Context, in *GaugeRequest, opts ...grpc.CallOption) (*GaugeResponse, error) { |
| out := new(GaugeResponse) |
| err := c.cc.Invoke(ctx, "/grpc.testing.MetricsService/GetGauge", in, out, opts...) |
| if err != nil { |
| return nil, err |
| } |
| return out, nil |
| } |
| |
| // MetricsServiceService is the service API for MetricsService service. |
| // Fields should be assigned to their respective handler implementations only before |
| // RegisterMetricsServiceService is called. Any unassigned fields will result in the |
| // handler for that method returning an Unimplemented error. |
| type MetricsServiceService struct { |
| // Returns the values of all the gauges that are currently being maintained by |
| // the service |
| GetAllGauges func(*EmptyMessage, MetricsService_GetAllGaugesServer) error |
| // Returns the value of one gauge |
| GetGauge func(context.Context, *GaugeRequest) (*GaugeResponse, error) |
| } |
| |
| func (s *MetricsServiceService) getAllGauges(_ interface{}, stream grpc.ServerStream) error { |
| m := new(EmptyMessage) |
| if err := stream.RecvMsg(m); err != nil { |
| return err |
| } |
| return s.GetAllGauges(m, &metricsServiceGetAllGaugesServer{stream}) |
| } |
| func (s *MetricsServiceService) getGauge(_ interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { |
| in := new(GaugeRequest) |
| if err := dec(in); err != nil { |
| return nil, err |
| } |
| if interceptor == nil { |
| return s.GetGauge(ctx, in) |
| } |
| info := &grpc.UnaryServerInfo{ |
| Server: s, |
| FullMethod: "/grpc.testing.MetricsService/GetGauge", |
| } |
| handler := func(ctx context.Context, req interface{}) (interface{}, error) { |
| return s.GetGauge(ctx, req.(*GaugeRequest)) |
| } |
| return interceptor(ctx, in, info, handler) |
| } |
| |
| type MetricsService_GetAllGaugesServer interface { |
| Send(*GaugeResponse) error |
| grpc.ServerStream |
| } |
| |
| type metricsServiceGetAllGaugesServer struct { |
| grpc.ServerStream |
| } |
| |
| func (x *metricsServiceGetAllGaugesServer) Send(m *GaugeResponse) error { |
| return x.ServerStream.SendMsg(m) |
| } |
| |
| // RegisterMetricsServiceService registers a service implementation with a gRPC server. |
| func RegisterMetricsServiceService(s grpc.ServiceRegistrar, srv *MetricsServiceService) { |
| srvCopy := *srv |
| if srvCopy.GetAllGauges == nil { |
| srvCopy.GetAllGauges = func(*EmptyMessage, MetricsService_GetAllGaugesServer) error { |
| return status.Errorf(codes.Unimplemented, "method GetAllGauges not implemented") |
| } |
| } |
| if srvCopy.GetGauge == nil { |
| srvCopy.GetGauge = func(context.Context, *GaugeRequest) (*GaugeResponse, error) { |
| return nil, status.Errorf(codes.Unimplemented, "method GetGauge not implemented") |
| } |
| } |
| sd := grpc.ServiceDesc{ |
| ServiceName: "grpc.testing.MetricsService", |
| Methods: []grpc.MethodDesc{ |
| { |
| MethodName: "GetGauge", |
| Handler: srvCopy.getGauge, |
| }, |
| }, |
| Streams: []grpc.StreamDesc{ |
| { |
| StreamName: "GetAllGauges", |
| Handler: srvCopy.getAllGauges, |
| ServerStreams: true, |
| }, |
| }, |
| Metadata: "stress/grpc_testing/metrics.proto", |
| } |
| |
| s.RegisterService(&sd, nil) |
| } |
| |
| // NewMetricsServiceService creates a new MetricsServiceService containing the |
| // implemented methods of the MetricsService service in s. Any unimplemented |
| // methods will result in the gRPC server returning an UNIMPLEMENTED status to the client. |
| // This includes situations where the method handler is misspelled or has the wrong |
| // signature. For this reason, this function should be used with great care and |
| // is not recommended to be used by most users. |
| func NewMetricsServiceService(s interface{}) *MetricsServiceService { |
| ns := &MetricsServiceService{} |
| if h, ok := s.(interface { |
| GetAllGauges(*EmptyMessage, MetricsService_GetAllGaugesServer) error |
| }); ok { |
| ns.GetAllGauges = h.GetAllGauges |
| } |
| if h, ok := s.(interface { |
| GetGauge(context.Context, *GaugeRequest) (*GaugeResponse, error) |
| }); ok { |
| ns.GetGauge = h.GetGauge |
| } |
| return ns |
| } |
| |
| // UnstableMetricsServiceService is the service API for MetricsService service. |
| // New methods may be added to this interface if they are added to the service |
| // definition, which is not a backward-compatible change. For this reason, |
| // use of this type is not recommended. |
| type UnstableMetricsServiceService interface { |
| // Returns the values of all the gauges that are currently being maintained by |
| // the service |
| GetAllGauges(*EmptyMessage, MetricsService_GetAllGaugesServer) error |
| // Returns the value of one gauge |
| GetGauge(context.Context, *GaugeRequest) (*GaugeResponse, error) |
| } |