Files
stats-gateway/gen/stats/v1/stats_grpc.pb.go
T

206 lines
8.3 KiB
Go

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc v7.34.1
// source: stats.proto
package statsv1
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.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
SpeedStatus_RecentResults_FullMethodName = "/stats.v1.SpeedStatus/RecentResults"
SpeedStatus_Aggregate_FullMethodName = "/stats.v1.SpeedStatus/Aggregate"
SpeedStatus_Tunnel_FullMethodName = "/stats.v1.SpeedStatus/Tunnel"
)
// SpeedStatusClient is the client API for SpeedStatus 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 SpeedStatusClient interface {
// RecentResults streams the last N samples for given filter.
RecentResults(ctx context.Context, in *Filter, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Sample], error)
// Aggregate returns histogram for a time range.
Aggregate(ctx context.Context, in *Range, opts ...grpc.CallOption) (*Histogram, error)
// Tunnel is a bidirectional stream for authenticated clients.
// Auth: Bearer JWT (HS256) в gRPC metadata "authorization: Bearer <jwt>".
// Server validates: signature, exp, scope=="tunnel", optional revocation list.
Tunnel(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Frame, Frame], error)
}
type speedStatusClient struct {
cc grpc.ClientConnInterface
}
func NewSpeedStatusClient(cc grpc.ClientConnInterface) SpeedStatusClient {
return &speedStatusClient{cc}
}
func (c *speedStatusClient) RecentResults(ctx context.Context, in *Filter, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Sample], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &SpeedStatus_ServiceDesc.Streams[0], SpeedStatus_RecentResults_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[Filter, Sample]{ClientStream: 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
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type SpeedStatus_RecentResultsClient = grpc.ServerStreamingClient[Sample]
func (c *speedStatusClient) Aggregate(ctx context.Context, in *Range, opts ...grpc.CallOption) (*Histogram, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Histogram)
err := c.cc.Invoke(ctx, SpeedStatus_Aggregate_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *speedStatusClient) Tunnel(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Frame, Frame], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &SpeedStatus_ServiceDesc.Streams[1], SpeedStatus_Tunnel_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[Frame, Frame]{ClientStream: stream}
return x, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type SpeedStatus_TunnelClient = grpc.BidiStreamingClient[Frame, Frame]
// SpeedStatusServer is the server API for SpeedStatus service.
// All implementations must embed UnimplementedSpeedStatusServer
// for forward compatibility.
type SpeedStatusServer interface {
// RecentResults streams the last N samples for given filter.
RecentResults(*Filter, grpc.ServerStreamingServer[Sample]) error
// Aggregate returns histogram for a time range.
Aggregate(context.Context, *Range) (*Histogram, error)
// Tunnel is a bidirectional stream for authenticated clients.
// Auth: Bearer JWT (HS256) в gRPC metadata "authorization: Bearer <jwt>".
// Server validates: signature, exp, scope=="tunnel", optional revocation list.
Tunnel(grpc.BidiStreamingServer[Frame, Frame]) error
mustEmbedUnimplementedSpeedStatusServer()
}
// UnimplementedSpeedStatusServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedSpeedStatusServer struct{}
func (UnimplementedSpeedStatusServer) RecentResults(*Filter, grpc.ServerStreamingServer[Sample]) error {
return status.Error(codes.Unimplemented, "method RecentResults not implemented")
}
func (UnimplementedSpeedStatusServer) Aggregate(context.Context, *Range) (*Histogram, error) {
return nil, status.Error(codes.Unimplemented, "method Aggregate not implemented")
}
func (UnimplementedSpeedStatusServer) Tunnel(grpc.BidiStreamingServer[Frame, Frame]) error {
return status.Error(codes.Unimplemented, "method Tunnel not implemented")
}
func (UnimplementedSpeedStatusServer) mustEmbedUnimplementedSpeedStatusServer() {}
func (UnimplementedSpeedStatusServer) testEmbeddedByValue() {}
// UnsafeSpeedStatusServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to SpeedStatusServer will
// result in compilation errors.
type UnsafeSpeedStatusServer interface {
mustEmbedUnimplementedSpeedStatusServer()
}
func RegisterSpeedStatusServer(s grpc.ServiceRegistrar, srv SpeedStatusServer) {
// If the following call panics, it indicates UnimplementedSpeedStatusServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&SpeedStatus_ServiceDesc, srv)
}
func _SpeedStatus_RecentResults_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(Filter)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(SpeedStatusServer).RecentResults(m, &grpc.GenericServerStream[Filter, Sample]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type SpeedStatus_RecentResultsServer = grpc.ServerStreamingServer[Sample]
func _SpeedStatus_Aggregate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Range)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SpeedStatusServer).Aggregate(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SpeedStatus_Aggregate_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SpeedStatusServer).Aggregate(ctx, req.(*Range))
}
return interceptor(ctx, in, info, handler)
}
func _SpeedStatus_Tunnel_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(SpeedStatusServer).Tunnel(&grpc.GenericServerStream[Frame, Frame]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type SpeedStatus_TunnelServer = grpc.BidiStreamingServer[Frame, Frame]
// SpeedStatus_ServiceDesc is the grpc.ServiceDesc for SpeedStatus service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var SpeedStatus_ServiceDesc = grpc.ServiceDesc{
ServiceName: "stats.v1.SpeedStatus",
HandlerType: (*SpeedStatusServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Aggregate",
Handler: _SpeedStatus_Aggregate_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "RecentResults",
Handler: _SpeedStatus_RecentResults_Handler,
ServerStreams: true,
},
{
StreamName: "Tunnel",
Handler: _SpeedStatus_Tunnel_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "stats.proto",
}