Initial revisin of healthchecker, inspired by HAProxy
This commit is contained in:
357
internal/grpcapi/healthchecker_grpc.pb.go
Normal file
357
internal/grpcapi/healthchecker_grpc.pb.go
Normal file
@@ -0,0 +1,357 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.6.1
|
||||
// - protoc v3.21.12
|
||||
// source: proto/healthchecker.proto
|
||||
|
||||
package grpcapi
|
||||
|
||||
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 (
|
||||
HealthChecker_ListVIPs_FullMethodName = "/healthchecker.HealthChecker/ListVIPs"
|
||||
HealthChecker_GetVIP_FullMethodName = "/healthchecker.HealthChecker/GetVIP"
|
||||
HealthChecker_ListBackends_FullMethodName = "/healthchecker.HealthChecker/ListBackends"
|
||||
HealthChecker_GetBackend_FullMethodName = "/healthchecker.HealthChecker/GetBackend"
|
||||
HealthChecker_PauseBackend_FullMethodName = "/healthchecker.HealthChecker/PauseBackend"
|
||||
HealthChecker_ResumeBackend_FullMethodName = "/healthchecker.HealthChecker/ResumeBackend"
|
||||
HealthChecker_WatchTransitions_FullMethodName = "/healthchecker.HealthChecker/WatchTransitions"
|
||||
)
|
||||
|
||||
// HealthCheckerClient is the client API for HealthChecker 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.
|
||||
//
|
||||
// HealthChecker exposes the state of backend health for all VIPs.
|
||||
type HealthCheckerClient interface {
|
||||
ListVIPs(ctx context.Context, in *ListVIPsRequest, opts ...grpc.CallOption) (*ListVIPsResponse, error)
|
||||
GetVIP(ctx context.Context, in *GetVIPRequest, opts ...grpc.CallOption) (*VIPInfo, error)
|
||||
ListBackends(ctx context.Context, in *ListBackendsRequest, opts ...grpc.CallOption) (*ListBackendsResponse, error)
|
||||
GetBackend(ctx context.Context, in *GetBackendRequest, opts ...grpc.CallOption) (*BackendInfo, error)
|
||||
PauseBackend(ctx context.Context, in *PauseResumeRequest, opts ...grpc.CallOption) (*BackendInfo, error)
|
||||
ResumeBackend(ctx context.Context, in *PauseResumeRequest, opts ...grpc.CallOption) (*BackendInfo, error)
|
||||
WatchTransitions(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[TransitionEvent], error)
|
||||
}
|
||||
|
||||
type healthCheckerClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewHealthCheckerClient(cc grpc.ClientConnInterface) HealthCheckerClient {
|
||||
return &healthCheckerClient{cc}
|
||||
}
|
||||
|
||||
func (c *healthCheckerClient) ListVIPs(ctx context.Context, in *ListVIPsRequest, opts ...grpc.CallOption) (*ListVIPsResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ListVIPsResponse)
|
||||
err := c.cc.Invoke(ctx, HealthChecker_ListVIPs_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *healthCheckerClient) GetVIP(ctx context.Context, in *GetVIPRequest, opts ...grpc.CallOption) (*VIPInfo, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(VIPInfo)
|
||||
err := c.cc.Invoke(ctx, HealthChecker_GetVIP_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *healthCheckerClient) ListBackends(ctx context.Context, in *ListBackendsRequest, opts ...grpc.CallOption) (*ListBackendsResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ListBackendsResponse)
|
||||
err := c.cc.Invoke(ctx, HealthChecker_ListBackends_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *healthCheckerClient) GetBackend(ctx context.Context, in *GetBackendRequest, opts ...grpc.CallOption) (*BackendInfo, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(BackendInfo)
|
||||
err := c.cc.Invoke(ctx, HealthChecker_GetBackend_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *healthCheckerClient) PauseBackend(ctx context.Context, in *PauseResumeRequest, opts ...grpc.CallOption) (*BackendInfo, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(BackendInfo)
|
||||
err := c.cc.Invoke(ctx, HealthChecker_PauseBackend_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *healthCheckerClient) ResumeBackend(ctx context.Context, in *PauseResumeRequest, opts ...grpc.CallOption) (*BackendInfo, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(BackendInfo)
|
||||
err := c.cc.Invoke(ctx, HealthChecker_ResumeBackend_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *healthCheckerClient) WatchTransitions(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[TransitionEvent], error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
stream, err := c.cc.NewStream(ctx, &HealthChecker_ServiceDesc.Streams[0], HealthChecker_WatchTransitions_FullMethodName, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &grpc.GenericClientStream[WatchRequest, TransitionEvent]{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 HealthChecker_WatchTransitionsClient = grpc.ServerStreamingClient[TransitionEvent]
|
||||
|
||||
// HealthCheckerServer is the server API for HealthChecker service.
|
||||
// All implementations must embed UnimplementedHealthCheckerServer
|
||||
// for forward compatibility.
|
||||
//
|
||||
// HealthChecker exposes the state of backend health for all VIPs.
|
||||
type HealthCheckerServer interface {
|
||||
ListVIPs(context.Context, *ListVIPsRequest) (*ListVIPsResponse, error)
|
||||
GetVIP(context.Context, *GetVIPRequest) (*VIPInfo, error)
|
||||
ListBackends(context.Context, *ListBackendsRequest) (*ListBackendsResponse, error)
|
||||
GetBackend(context.Context, *GetBackendRequest) (*BackendInfo, error)
|
||||
PauseBackend(context.Context, *PauseResumeRequest) (*BackendInfo, error)
|
||||
ResumeBackend(context.Context, *PauseResumeRequest) (*BackendInfo, error)
|
||||
WatchTransitions(*WatchRequest, grpc.ServerStreamingServer[TransitionEvent]) error
|
||||
mustEmbedUnimplementedHealthCheckerServer()
|
||||
}
|
||||
|
||||
// UnimplementedHealthCheckerServer 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 UnimplementedHealthCheckerServer struct{}
|
||||
|
||||
func (UnimplementedHealthCheckerServer) ListVIPs(context.Context, *ListVIPsRequest) (*ListVIPsResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method ListVIPs not implemented")
|
||||
}
|
||||
func (UnimplementedHealthCheckerServer) GetVIP(context.Context, *GetVIPRequest) (*VIPInfo, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method GetVIP not implemented")
|
||||
}
|
||||
func (UnimplementedHealthCheckerServer) ListBackends(context.Context, *ListBackendsRequest) (*ListBackendsResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method ListBackends not implemented")
|
||||
}
|
||||
func (UnimplementedHealthCheckerServer) GetBackend(context.Context, *GetBackendRequest) (*BackendInfo, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method GetBackend not implemented")
|
||||
}
|
||||
func (UnimplementedHealthCheckerServer) PauseBackend(context.Context, *PauseResumeRequest) (*BackendInfo, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method PauseBackend not implemented")
|
||||
}
|
||||
func (UnimplementedHealthCheckerServer) ResumeBackend(context.Context, *PauseResumeRequest) (*BackendInfo, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method ResumeBackend not implemented")
|
||||
}
|
||||
func (UnimplementedHealthCheckerServer) WatchTransitions(*WatchRequest, grpc.ServerStreamingServer[TransitionEvent]) error {
|
||||
return status.Error(codes.Unimplemented, "method WatchTransitions not implemented")
|
||||
}
|
||||
func (UnimplementedHealthCheckerServer) mustEmbedUnimplementedHealthCheckerServer() {}
|
||||
func (UnimplementedHealthCheckerServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeHealthCheckerServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to HealthCheckerServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeHealthCheckerServer interface {
|
||||
mustEmbedUnimplementedHealthCheckerServer()
|
||||
}
|
||||
|
||||
func RegisterHealthCheckerServer(s grpc.ServiceRegistrar, srv HealthCheckerServer) {
|
||||
// If the following call panics, it indicates UnimplementedHealthCheckerServer 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(&HealthChecker_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _HealthChecker_ListVIPs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListVIPsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(HealthCheckerServer).ListVIPs(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: HealthChecker_ListVIPs_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(HealthCheckerServer).ListVIPs(ctx, req.(*ListVIPsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _HealthChecker_GetVIP_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetVIPRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(HealthCheckerServer).GetVIP(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: HealthChecker_GetVIP_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(HealthCheckerServer).GetVIP(ctx, req.(*GetVIPRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _HealthChecker_ListBackends_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListBackendsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(HealthCheckerServer).ListBackends(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: HealthChecker_ListBackends_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(HealthCheckerServer).ListBackends(ctx, req.(*ListBackendsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _HealthChecker_GetBackend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetBackendRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(HealthCheckerServer).GetBackend(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: HealthChecker_GetBackend_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(HealthCheckerServer).GetBackend(ctx, req.(*GetBackendRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _HealthChecker_PauseBackend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PauseResumeRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(HealthCheckerServer).PauseBackend(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: HealthChecker_PauseBackend_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(HealthCheckerServer).PauseBackend(ctx, req.(*PauseResumeRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _HealthChecker_ResumeBackend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PauseResumeRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(HealthCheckerServer).ResumeBackend(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: HealthChecker_ResumeBackend_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(HealthCheckerServer).ResumeBackend(ctx, req.(*PauseResumeRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _HealthChecker_WatchTransitions_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(WatchRequest)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return srv.(HealthCheckerServer).WatchTransitions(m, &grpc.GenericServerStream[WatchRequest, TransitionEvent]{ServerStream: stream})
|
||||
}
|
||||
|
||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||
type HealthChecker_WatchTransitionsServer = grpc.ServerStreamingServer[TransitionEvent]
|
||||
|
||||
// HealthChecker_ServiceDesc is the grpc.ServiceDesc for HealthChecker service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var HealthChecker_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "healthchecker.HealthChecker",
|
||||
HandlerType: (*HealthCheckerServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "ListVIPs",
|
||||
Handler: _HealthChecker_ListVIPs_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetVIP",
|
||||
Handler: _HealthChecker_GetVIP_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListBackends",
|
||||
Handler: _HealthChecker_ListBackends_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetBackend",
|
||||
Handler: _HealthChecker_GetBackend_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "PauseBackend",
|
||||
Handler: _HealthChecker_PauseBackend_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ResumeBackend",
|
||||
Handler: _HealthChecker_ResumeBackend_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
StreamName: "WatchTransitions",
|
||||
Handler: _HealthChecker_WatchTransitions_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
},
|
||||
Metadata: "proto/healthchecker.proto",
|
||||
}
|
||||
Reference in New Issue
Block a user