Skip to content

Git designed for AI agents.

18.0 KB
Raw Blame
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc             v6.30.2
// source: praefect.proto

package gitalypb

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 (
	PraefectInfoService_RepositoryReplicas_FullMethodName      = "/gitaly.PraefectInfoService/RepositoryReplicas"
	PraefectInfoService_Dataloss_FullMethodName                = "/gitaly.PraefectInfoService/Dataloss"
	PraefectInfoService_SetAuthoritativeStorage_FullMethodName = "/gitaly.PraefectInfoService/SetAuthoritativeStorage"
	PraefectInfoService_MarkUnverified_FullMethodName          = "/gitaly.PraefectInfoService/MarkUnverified"
	PraefectInfoService_SetReplicationFactor_FullMethodName    = "/gitaly.PraefectInfoService/SetReplicationFactor"
	PraefectInfoService_GetRepositoryMetadata_FullMethodName   = "/gitaly.PraefectInfoService/GetRepositoryMetadata"
)

// PraefectInfoServiceClient is the client API for PraefectInfoService 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.
//
// PraefectInfoService is a service which provides RPCs to query and modify
// Praefect-specific parameters.
type PraefectInfoServiceClient interface {
	// RepositoryReplicas ...
	RepositoryReplicas(ctx context.Context, in *RepositoryReplicasRequest, opts ...grpc.CallOption) (*RepositoryReplicasResponse, error)
	// Dataloss provides information on repositories in Praefect that are in a degraded state and
	// thus susceptible to dataloss. A repository is considered degraded when its replicas are
	// outdated and/or unavailable.
	Dataloss(ctx context.Context, in *DatalossRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[DatalossResponse], error)
	// SetAuthoritativeStorage sets the authoritative storage for a repository on a given virtual storage.
	// This causes the current version of the repository on the authoritative storage to be considered the
	// latest and overwrite any other version on the virtual storage.
	SetAuthoritativeStorage(ctx context.Context, in *SetAuthoritativeStorageRequest, opts ...grpc.CallOption) (*SetAuthoritativeStorageResponse, error)
	// MarkUnverified marks replicas as unverified. This will trigger verification as Praefect's metadata
	// verifier prioritizes unverified replicas.
	MarkUnverified(ctx context.Context, in *MarkUnverifiedRequest, opts ...grpc.CallOption) (*MarkUnverifiedResponse, error)
	// SetReplicationFactor assigns or unassigns host nodes from the repository to meet the desired replication factor.
	// SetReplicationFactor returns an error when trying to set a replication factor that exceeds the storage node count
	// in the virtual storage. An error is also returned when trying to set a replication factor below one. The primary node
	// won't be unassigned as it needs a copy of the repository to accept writes. Likewise, the primary is the first storage
	// that gets assigned when setting a replication factor for a repository. Assignments of unconfigured storages are ignored.
	// This might cause the actual replication factor to be higher than desired if the replication factor is set during an upgrade
	// from a Praefect node that does not yet know about a new node. As assignments of unconfigured storages are ignored, replication
	// factor of repositories assigned to a storage node removed from the cluster is effectively decreased.
	SetReplicationFactor(ctx context.Context, in *SetReplicationFactorRequest, opts ...grpc.CallOption) (*SetReplicationFactorResponse, error)
	// GetRepositoryMetadata returns the cluster metadata for a repository. Returns NotFound if the repository does not exist.
	GetRepositoryMetadata(ctx context.Context, in *GetRepositoryMetadataRequest, opts ...grpc.CallOption) (*GetRepositoryMetadataResponse, error)
}

type praefectInfoServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewPraefectInfoServiceClient(cc grpc.ClientConnInterface) PraefectInfoServiceClient {
	return &praefectInfoServiceClient{cc}
}

func (c *praefectInfoServiceClient) RepositoryReplicas(ctx context.Context, in *RepositoryReplicasRequest, opts ...grpc.CallOption) (*RepositoryReplicasResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(RepositoryReplicasResponse)
	err := c.cc.Invoke(ctx, PraefectInfoService_RepositoryReplicas_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *praefectInfoServiceClient) Dataloss(ctx context.Context, in *DatalossRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[DatalossResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &PraefectInfoService_ServiceDesc.Streams[0], PraefectInfoService_Dataloss_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[DatalossRequest, DatalossResponse]{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 PraefectInfoService_DatalossClient = grpc.ServerStreamingClient[DatalossResponse]

func (c *praefectInfoServiceClient) SetAuthoritativeStorage(ctx context.Context, in *SetAuthoritativeStorageRequest, opts ...grpc.CallOption) (*SetAuthoritativeStorageResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(SetAuthoritativeStorageResponse)
	err := c.cc.Invoke(ctx, PraefectInfoService_SetAuthoritativeStorage_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *praefectInfoServiceClient) MarkUnverified(ctx context.Context, in *MarkUnverifiedRequest, opts ...grpc.CallOption) (*MarkUnverifiedResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(MarkUnverifiedResponse)
	err := c.cc.Invoke(ctx, PraefectInfoService_MarkUnverified_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *praefectInfoServiceClient) SetReplicationFactor(ctx context.Context, in *SetReplicationFactorRequest, opts ...grpc.CallOption) (*SetReplicationFactorResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(SetReplicationFactorResponse)
	err := c.cc.Invoke(ctx, PraefectInfoService_SetReplicationFactor_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *praefectInfoServiceClient) GetRepositoryMetadata(ctx context.Context, in *GetRepositoryMetadataRequest, opts ...grpc.CallOption) (*GetRepositoryMetadataResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(GetRepositoryMetadataResponse)
	err := c.cc.Invoke(ctx, PraefectInfoService_GetRepositoryMetadata_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// PraefectInfoServiceServer is the server API for PraefectInfoService service.
// All implementations must embed UnimplementedPraefectInfoServiceServer
// for forward compatibility.
//
// PraefectInfoService is a service which provides RPCs to query and modify
// Praefect-specific parameters.
type PraefectInfoServiceServer interface {
	// RepositoryReplicas ...
	RepositoryReplicas(context.Context, *RepositoryReplicasRequest) (*RepositoryReplicasResponse, error)
	// Dataloss provides information on repositories in Praefect that are in a degraded state and
	// thus susceptible to dataloss. A repository is considered degraded when its replicas are
	// outdated and/or unavailable.
	Dataloss(*DatalossRequest, grpc.ServerStreamingServer[DatalossResponse]) error
	// SetAuthoritativeStorage sets the authoritative storage for a repository on a given virtual storage.
	// This causes the current version of the repository on the authoritative storage to be considered the
	// latest and overwrite any other version on the virtual storage.
	SetAuthoritativeStorage(context.Context, *SetAuthoritativeStorageRequest) (*SetAuthoritativeStorageResponse, error)
	// MarkUnverified marks replicas as unverified. This will trigger verification as Praefect's metadata
	// verifier prioritizes unverified replicas.
	MarkUnverified(context.Context, *MarkUnverifiedRequest) (*MarkUnverifiedResponse, error)
	// SetReplicationFactor assigns or unassigns host nodes from the repository to meet the desired replication factor.
	// SetReplicationFactor returns an error when trying to set a replication factor that exceeds the storage node count
	// in the virtual storage. An error is also returned when trying to set a replication factor below one. The primary node
	// won't be unassigned as it needs a copy of the repository to accept writes. Likewise, the primary is the first storage
	// that gets assigned when setting a replication factor for a repository. Assignments of unconfigured storages are ignored.
	// This might cause the actual replication factor to be higher than desired if the replication factor is set during an upgrade
	// from a Praefect node that does not yet know about a new node. As assignments of unconfigured storages are ignored, replication
	// factor of repositories assigned to a storage node removed from the cluster is effectively decreased.
	SetReplicationFactor(context.Context, *SetReplicationFactorRequest) (*SetReplicationFactorResponse, error)
	// GetRepositoryMetadata returns the cluster metadata for a repository. Returns NotFound if the repository does not exist.
	GetRepositoryMetadata(context.Context, *GetRepositoryMetadataRequest) (*GetRepositoryMetadataResponse, error)
	mustEmbedUnimplementedPraefectInfoServiceServer()
}

// UnimplementedPraefectInfoServiceServer 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 UnimplementedPraefectInfoServiceServer struct{}

func (UnimplementedPraefectInfoServiceServer) RepositoryReplicas(context.Context, *RepositoryReplicasRequest) (*RepositoryReplicasResponse, error) {
	return nil, status.Error(codes.Unimplemented, "method RepositoryReplicas not implemented")
}
func (UnimplementedPraefectInfoServiceServer) Dataloss(*DatalossRequest, grpc.ServerStreamingServer[DatalossResponse]) error {
	return status.Error(codes.Unimplemented, "method Dataloss not implemented")
}
func (UnimplementedPraefectInfoServiceServer) SetAuthoritativeStorage(context.Context, *SetAuthoritativeStorageRequest) (*SetAuthoritativeStorageResponse, error) {
	return nil, status.Error(codes.Unimplemented, "method SetAuthoritativeStorage not implemented")
}
func (UnimplementedPraefectInfoServiceServer) MarkUnverified(context.Context, *MarkUnverifiedRequest) (*MarkUnverifiedResponse, error) {
	return nil, status.Error(codes.Unimplemented, "method MarkUnverified not implemented")
}
func (UnimplementedPraefectInfoServiceServer) SetReplicationFactor(context.Context, *SetReplicationFactorRequest) (*SetReplicationFactorResponse, error) {
	return nil, status.Error(codes.Unimplemented, "method SetReplicationFactor not implemented")
}
func (UnimplementedPraefectInfoServiceServer) GetRepositoryMetadata(context.Context, *GetRepositoryMetadataRequest) (*GetRepositoryMetadataResponse, error) {
	return nil, status.Error(codes.Unimplemented, "method GetRepositoryMetadata not implemented")
}
func (UnimplementedPraefectInfoServiceServer) mustEmbedUnimplementedPraefectInfoServiceServer() {}
func (UnimplementedPraefectInfoServiceServer) testEmbeddedByValue()                             {}

// UnsafePraefectInfoServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PraefectInfoServiceServer will
// result in compilation errors.
type UnsafePraefectInfoServiceServer interface {
	mustEmbedUnimplementedPraefectInfoServiceServer()
}

func RegisterPraefectInfoServiceServer(s grpc.ServiceRegistrar, srv PraefectInfoServiceServer) {
	// If the following call panics, it indicates UnimplementedPraefectInfoServiceServer 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(&PraefectInfoService_ServiceDesc, srv)
}

func _PraefectInfoService_RepositoryReplicas_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(RepositoryReplicasRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(PraefectInfoServiceServer).RepositoryReplicas(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: PraefectInfoService_RepositoryReplicas_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(PraefectInfoServiceServer).RepositoryReplicas(ctx, req.(*RepositoryReplicasRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _PraefectInfoService_Dataloss_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(DatalossRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(PraefectInfoServiceServer).Dataloss(m, &grpc.GenericServerStream[DatalossRequest, DatalossResponse]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type PraefectInfoService_DatalossServer = grpc.ServerStreamingServer[DatalossResponse]

func _PraefectInfoService_SetAuthoritativeStorage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(SetAuthoritativeStorageRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(PraefectInfoServiceServer).SetAuthoritativeStorage(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: PraefectInfoService_SetAuthoritativeStorage_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(PraefectInfoServiceServer).SetAuthoritativeStorage(ctx, req.(*SetAuthoritativeStorageRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _PraefectInfoService_MarkUnverified_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(MarkUnverifiedRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(PraefectInfoServiceServer).MarkUnverified(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: PraefectInfoService_MarkUnverified_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(PraefectInfoServiceServer).MarkUnverified(ctx, req.(*MarkUnverifiedRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _PraefectInfoService_SetReplicationFactor_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(SetReplicationFactorRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(PraefectInfoServiceServer).SetReplicationFactor(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: PraefectInfoService_SetReplicationFactor_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(PraefectInfoServiceServer).SetReplicationFactor(ctx, req.(*SetReplicationFactorRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _PraefectInfoService_GetRepositoryMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetRepositoryMetadataRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(PraefectInfoServiceServer).GetRepositoryMetadata(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: PraefectInfoService_GetRepositoryMetadata_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(PraefectInfoServiceServer).GetRepositoryMetadata(ctx, req.(*GetRepositoryMetadataRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// PraefectInfoService_ServiceDesc is the grpc.ServiceDesc for PraefectInfoService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var PraefectInfoService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "gitaly.PraefectInfoService",
	HandlerType: (*PraefectInfoServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "RepositoryReplicas",
			Handler:    _PraefectInfoService_RepositoryReplicas_Handler,
		},
		{
			MethodName: "SetAuthoritativeStorage",
			Handler:    _PraefectInfoService_SetAuthoritativeStorage_Handler,
		},
		{
			MethodName: "MarkUnverified",
			Handler:    _PraefectInfoService_MarkUnverified_Handler,
		},
		{
			MethodName: "SetReplicationFactor",
			Handler:    _PraefectInfoService_SetReplicationFactor_Handler,
		},
		{
			MethodName: "GetRepositoryMetadata",
			Handler:    _PraefectInfoService_GetRepositoryMetadata_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Dataloss",
			Handler:       _PraefectInfoService_Dataloss_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "praefect.proto",
}