mirror of
https://github.com/siderolabs/discovery-service.git
synced 2025-03-14 09:55:08 +00:00
Fixes #5 Batch watch responses in a single batch so that client can quickly know that initial snapshot got delivered. Bump go.mod deps. Implement more limits. Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
294 lines
10 KiB
Go
294 lines
10 KiB
Go
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
|
|
package pb
|
|
|
|
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.32.0 or later.
|
|
const _ = grpc.SupportPackageIsVersion7
|
|
|
|
// ClusterClient is the client API for Cluster 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 ClusterClient interface {
|
|
// Hello is the first request sent by the client.
|
|
//
|
|
// Server might redirect the client to a different instance.
|
|
Hello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error)
|
|
// AffiliateUpdate updates (or creates) affiliate in the cluster.
|
|
AffiliateUpdate(ctx context.Context, in *AffiliateUpdateRequest, opts ...grpc.CallOption) (*AffiliateUpdateResponse, error)
|
|
// AffiliateDelete deletes affiliate from the cluster.
|
|
AffiliateDelete(ctx context.Context, in *AffiliateDeleteRequest, opts ...grpc.CallOption) (*AffiliateDeleteResponse, error)
|
|
// List affiliates in the cluster.
|
|
List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error)
|
|
// Watch affiliate updates in the cluster.
|
|
//
|
|
// The first WatchResponse contains the snapshot of the current affiliate state (even if empty).
|
|
// Subsequent response messages are sent as the affiliates get changed.
|
|
Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (Cluster_WatchClient, error)
|
|
}
|
|
|
|
type clusterClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewClusterClient(cc grpc.ClientConnInterface) ClusterClient {
|
|
return &clusterClient{cc}
|
|
}
|
|
|
|
func (c *clusterClient) Hello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error) {
|
|
out := new(HelloResponse)
|
|
err := c.cc.Invoke(ctx, "/sidero.discovery.Cluster/Hello", in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *clusterClient) AffiliateUpdate(ctx context.Context, in *AffiliateUpdateRequest, opts ...grpc.CallOption) (*AffiliateUpdateResponse, error) {
|
|
out := new(AffiliateUpdateResponse)
|
|
err := c.cc.Invoke(ctx, "/sidero.discovery.Cluster/AffiliateUpdate", in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *clusterClient) AffiliateDelete(ctx context.Context, in *AffiliateDeleteRequest, opts ...grpc.CallOption) (*AffiliateDeleteResponse, error) {
|
|
out := new(AffiliateDeleteResponse)
|
|
err := c.cc.Invoke(ctx, "/sidero.discovery.Cluster/AffiliateDelete", in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *clusterClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) {
|
|
out := new(ListResponse)
|
|
err := c.cc.Invoke(ctx, "/sidero.discovery.Cluster/List", in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *clusterClient) Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (Cluster_WatchClient, error) {
|
|
stream, err := c.cc.NewStream(ctx, &Cluster_ServiceDesc.Streams[0], "/sidero.discovery.Cluster/Watch", opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
x := &clusterWatchClient{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 Cluster_WatchClient interface {
|
|
Recv() (*WatchResponse, error)
|
|
grpc.ClientStream
|
|
}
|
|
|
|
type clusterWatchClient struct {
|
|
grpc.ClientStream
|
|
}
|
|
|
|
func (x *clusterWatchClient) Recv() (*WatchResponse, error) {
|
|
m := new(WatchResponse)
|
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
|
return nil, err
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
// ClusterServer is the server API for Cluster service.
|
|
// All implementations must embed UnimplementedClusterServer
|
|
// for forward compatibility
|
|
type ClusterServer interface {
|
|
// Hello is the first request sent by the client.
|
|
//
|
|
// Server might redirect the client to a different instance.
|
|
Hello(context.Context, *HelloRequest) (*HelloResponse, error)
|
|
// AffiliateUpdate updates (or creates) affiliate in the cluster.
|
|
AffiliateUpdate(context.Context, *AffiliateUpdateRequest) (*AffiliateUpdateResponse, error)
|
|
// AffiliateDelete deletes affiliate from the cluster.
|
|
AffiliateDelete(context.Context, *AffiliateDeleteRequest) (*AffiliateDeleteResponse, error)
|
|
// List affiliates in the cluster.
|
|
List(context.Context, *ListRequest) (*ListResponse, error)
|
|
// Watch affiliate updates in the cluster.
|
|
//
|
|
// The first WatchResponse contains the snapshot of the current affiliate state (even if empty).
|
|
// Subsequent response messages are sent as the affiliates get changed.
|
|
Watch(*WatchRequest, Cluster_WatchServer) error
|
|
mustEmbedUnimplementedClusterServer()
|
|
}
|
|
|
|
// UnimplementedClusterServer must be embedded to have forward compatible implementations.
|
|
type UnimplementedClusterServer struct {
|
|
}
|
|
|
|
func (UnimplementedClusterServer) Hello(context.Context, *HelloRequest) (*HelloResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method Hello not implemented")
|
|
}
|
|
func (UnimplementedClusterServer) AffiliateUpdate(context.Context, *AffiliateUpdateRequest) (*AffiliateUpdateResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method AffiliateUpdate not implemented")
|
|
}
|
|
func (UnimplementedClusterServer) AffiliateDelete(context.Context, *AffiliateDeleteRequest) (*AffiliateDeleteResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method AffiliateDelete not implemented")
|
|
}
|
|
func (UnimplementedClusterServer) List(context.Context, *ListRequest) (*ListResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
|
|
}
|
|
func (UnimplementedClusterServer) Watch(*WatchRequest, Cluster_WatchServer) error {
|
|
return status.Errorf(codes.Unimplemented, "method Watch not implemented")
|
|
}
|
|
func (UnimplementedClusterServer) mustEmbedUnimplementedClusterServer() {}
|
|
|
|
// UnsafeClusterServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to ClusterServer will
|
|
// result in compilation errors.
|
|
type UnsafeClusterServer interface {
|
|
mustEmbedUnimplementedClusterServer()
|
|
}
|
|
|
|
func RegisterClusterServer(s grpc.ServiceRegistrar, srv ClusterServer) {
|
|
s.RegisterService(&Cluster_ServiceDesc, srv)
|
|
}
|
|
|
|
func _Cluster_Hello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(HelloRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(ClusterServer).Hello(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/sidero.discovery.Cluster/Hello",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(ClusterServer).Hello(ctx, req.(*HelloRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Cluster_AffiliateUpdate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(AffiliateUpdateRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(ClusterServer).AffiliateUpdate(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/sidero.discovery.Cluster/AffiliateUpdate",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(ClusterServer).AffiliateUpdate(ctx, req.(*AffiliateUpdateRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Cluster_AffiliateDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(AffiliateDeleteRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(ClusterServer).AffiliateDelete(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/sidero.discovery.Cluster/AffiliateDelete",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(ClusterServer).AffiliateDelete(ctx, req.(*AffiliateDeleteRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Cluster_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(ListRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(ClusterServer).List(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/sidero.discovery.Cluster/List",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(ClusterServer).List(ctx, req.(*ListRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Cluster_Watch_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
m := new(WatchRequest)
|
|
if err := stream.RecvMsg(m); err != nil {
|
|
return err
|
|
}
|
|
return srv.(ClusterServer).Watch(m, &clusterWatchServer{stream})
|
|
}
|
|
|
|
type Cluster_WatchServer interface {
|
|
Send(*WatchResponse) error
|
|
grpc.ServerStream
|
|
}
|
|
|
|
type clusterWatchServer struct {
|
|
grpc.ServerStream
|
|
}
|
|
|
|
func (x *clusterWatchServer) Send(m *WatchResponse) error {
|
|
return x.ServerStream.SendMsg(m)
|
|
}
|
|
|
|
// Cluster_ServiceDesc is the grpc.ServiceDesc for Cluster service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var Cluster_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "sidero.discovery.Cluster",
|
|
HandlerType: (*ClusterServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "Hello",
|
|
Handler: _Cluster_Hello_Handler,
|
|
},
|
|
{
|
|
MethodName: "AffiliateUpdate",
|
|
Handler: _Cluster_AffiliateUpdate_Handler,
|
|
},
|
|
{
|
|
MethodName: "AffiliateDelete",
|
|
Handler: _Cluster_AffiliateDelete_Handler,
|
|
},
|
|
{
|
|
MethodName: "List",
|
|
Handler: _Cluster_List_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{
|
|
{
|
|
StreamName: "Watch",
|
|
Handler: _Cluster_Watch_Handler,
|
|
ServerStreams: true,
|
|
},
|
|
},
|
|
Metadata: "v1alpha1/pb/cluster.proto",
|
|
}
|