// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc             v6.30.2
// source: internal.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 (
	InternalGitaly_WalkRepos_FullMethodName         = "/gitaly.InternalGitaly/WalkRepos"
	InternalGitaly_ScanPoolMetadata_FullMethodName  = "/gitaly.InternalGitaly/ScanPoolMetadata"
	InternalGitaly_StorePoolMetadata_FullMethodName = "/gitaly.InternalGitaly/StorePoolMetadata"
	InternalGitaly_ListPoolMetadata_FullMethodName  = "/gitaly.InternalGitaly/ListPoolMetadata"
	InternalGitaly_ListPoolUpstreams_FullMethodName = "/gitaly.InternalGitaly/ListPoolUpstreams"
)

// InternalGitalyClient is the client API for InternalGitaly 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.
//
// InternalGitaly is a gRPC service meant to be served by a Gitaly node, but
// only reachable by Praefect or other Gitalies
type InternalGitalyClient interface {
	// WalkRepos walks the storage and streams back all known git repos on the
	// requested storage
	WalkRepos(ctx context.Context, in *WalkReposRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[WalkReposResponse], error)
	// ScanPoolMetadata scans a storage for repository-to-pool relationships
	// by reading alternates files. It streams back repositories that are
	// linked to object pools.
	ScanPoolMetadata(ctx context.Context, in *ScanPoolMetadataRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ScanPoolMetadataResponse], error)
	// StorePoolMetadata stores repository-to-pool relationships into the
	// local pool metadata database. It receives a stream of (repo, pool) pairs
	// and merges them into the existing data.
	StorePoolMetadata(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[StorePoolMetadataRequest, StorePoolMetadataResponse], error)
	// ListPoolMetadata lists all pools stored in the local pool metadata database.
	ListPoolMetadata(ctx context.Context, in *ListPoolMetadataRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ListPoolMetadataResponse], error)
	// ListPoolUpstreams queries the Rails ObjectPoolMembers API for each given
	// pool disk path and returns a mapping of pool disk path to upstream
	// repository relative path.
	ListPoolUpstreams(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ListPoolUpstreamsRequest, ListPoolUpstreamsResponse], error)
}

type internalGitalyClient struct {
	cc grpc.ClientConnInterface
}

func NewInternalGitalyClient(cc grpc.ClientConnInterface) InternalGitalyClient {
	return &internalGitalyClient{cc}
}

func (c *internalGitalyClient) WalkRepos(ctx context.Context, in *WalkReposRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[WalkReposResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &InternalGitaly_ServiceDesc.Streams[0], InternalGitaly_WalkRepos_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[WalkReposRequest, WalkReposResponse]{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 InternalGitaly_WalkReposClient = grpc.ServerStreamingClient[WalkReposResponse]

func (c *internalGitalyClient) ScanPoolMetadata(ctx context.Context, in *ScanPoolMetadataRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ScanPoolMetadataResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &InternalGitaly_ServiceDesc.Streams[1], InternalGitaly_ScanPoolMetadata_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[ScanPoolMetadataRequest, ScanPoolMetadataResponse]{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 InternalGitaly_ScanPoolMetadataClient = grpc.ServerStreamingClient[ScanPoolMetadataResponse]

func (c *internalGitalyClient) StorePoolMetadata(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[StorePoolMetadataRequest, StorePoolMetadataResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &InternalGitaly_ServiceDesc.Streams[2], InternalGitaly_StorePoolMetadata_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[StorePoolMetadataRequest, StorePoolMetadataResponse]{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 InternalGitaly_StorePoolMetadataClient = grpc.ClientStreamingClient[StorePoolMetadataRequest, StorePoolMetadataResponse]

func (c *internalGitalyClient) ListPoolMetadata(ctx context.Context, in *ListPoolMetadataRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ListPoolMetadataResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &InternalGitaly_ServiceDesc.Streams[3], InternalGitaly_ListPoolMetadata_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[ListPoolMetadataRequest, ListPoolMetadataResponse]{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 InternalGitaly_ListPoolMetadataClient = grpc.ServerStreamingClient[ListPoolMetadataResponse]

func (c *internalGitalyClient) ListPoolUpstreams(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ListPoolUpstreamsRequest, ListPoolUpstreamsResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &InternalGitaly_ServiceDesc.Streams[4], InternalGitaly_ListPoolUpstreams_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[ListPoolUpstreamsRequest, ListPoolUpstreamsResponse]{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 InternalGitaly_ListPoolUpstreamsClient = grpc.BidiStreamingClient[ListPoolUpstreamsRequest, ListPoolUpstreamsResponse]

// InternalGitalyServer is the server API for InternalGitaly service.
// All implementations must embed UnimplementedInternalGitalyServer
// for forward compatibility.
//
// InternalGitaly is a gRPC service meant to be served by a Gitaly node, but
// only reachable by Praefect or other Gitalies
type InternalGitalyServer interface {
	// WalkRepos walks the storage and streams back all known git repos on the
	// requested storage
	WalkRepos(*WalkReposRequest, grpc.ServerStreamingServer[WalkReposResponse]) error
	// ScanPoolMetadata scans a storage for repository-to-pool relationships
	// by reading alternates files. It streams back repositories that are
	// linked to object pools.
	ScanPoolMetadata(*ScanPoolMetadataRequest, grpc.ServerStreamingServer[ScanPoolMetadataResponse]) error
	// StorePoolMetadata stores repository-to-pool relationships into the
	// local pool metadata database. It receives a stream of (repo, pool) pairs
	// and merges them into the existing data.
	StorePoolMetadata(grpc.ClientStreamingServer[StorePoolMetadataRequest, StorePoolMetadataResponse]) error
	// ListPoolMetadata lists all pools stored in the local pool metadata database.
	ListPoolMetadata(*ListPoolMetadataRequest, grpc.ServerStreamingServer[ListPoolMetadataResponse]) error
	// ListPoolUpstreams queries the Rails ObjectPoolMembers API for each given
	// pool disk path and returns a mapping of pool disk path to upstream
	// repository relative path.
	ListPoolUpstreams(grpc.BidiStreamingServer[ListPoolUpstreamsRequest, ListPoolUpstreamsResponse]) error
	mustEmbedUnimplementedInternalGitalyServer()
}

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

func (UnimplementedInternalGitalyServer) WalkRepos(*WalkReposRequest, grpc.ServerStreamingServer[WalkReposResponse]) error {
	return status.Error(codes.Unimplemented, "method WalkRepos not implemented")
}
func (UnimplementedInternalGitalyServer) ScanPoolMetadata(*ScanPoolMetadataRequest, grpc.ServerStreamingServer[ScanPoolMetadataResponse]) error {
	return status.Error(codes.Unimplemented, "method ScanPoolMetadata not implemented")
}
func (UnimplementedInternalGitalyServer) StorePoolMetadata(grpc.ClientStreamingServer[StorePoolMetadataRequest, StorePoolMetadataResponse]) error {
	return status.Error(codes.Unimplemented, "method StorePoolMetadata not implemented")
}
func (UnimplementedInternalGitalyServer) ListPoolMetadata(*ListPoolMetadataRequest, grpc.ServerStreamingServer[ListPoolMetadataResponse]) error {
	return status.Error(codes.Unimplemented, "method ListPoolMetadata not implemented")
}
func (UnimplementedInternalGitalyServer) ListPoolUpstreams(grpc.BidiStreamingServer[ListPoolUpstreamsRequest, ListPoolUpstreamsResponse]) error {
	return status.Error(codes.Unimplemented, "method ListPoolUpstreams not implemented")
}
func (UnimplementedInternalGitalyServer) mustEmbedUnimplementedInternalGitalyServer() {}
func (UnimplementedInternalGitalyServer) testEmbeddedByValue()                        {}

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

func RegisterInternalGitalyServer(s grpc.ServiceRegistrar, srv InternalGitalyServer) {
	// If the following call panics, it indicates UnimplementedInternalGitalyServer 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(&InternalGitaly_ServiceDesc, srv)
}

func _InternalGitaly_WalkRepos_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(WalkReposRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(InternalGitalyServer).WalkRepos(m, &grpc.GenericServerStream[WalkReposRequest, WalkReposResponse]{ServerStream: stream})
}

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

func _InternalGitaly_ScanPoolMetadata_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(ScanPoolMetadataRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(InternalGitalyServer).ScanPoolMetadata(m, &grpc.GenericServerStream[ScanPoolMetadataRequest, ScanPoolMetadataResponse]{ServerStream: stream})
}

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

func _InternalGitaly_StorePoolMetadata_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(InternalGitalyServer).StorePoolMetadata(&grpc.GenericServerStream[StorePoolMetadataRequest, StorePoolMetadataResponse]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type InternalGitaly_StorePoolMetadataServer = grpc.ClientStreamingServer[StorePoolMetadataRequest, StorePoolMetadataResponse]

func _InternalGitaly_ListPoolMetadata_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(ListPoolMetadataRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(InternalGitalyServer).ListPoolMetadata(m, &grpc.GenericServerStream[ListPoolMetadataRequest, ListPoolMetadataResponse]{ServerStream: stream})
}

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

func _InternalGitaly_ListPoolUpstreams_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(InternalGitalyServer).ListPoolUpstreams(&grpc.GenericServerStream[ListPoolUpstreamsRequest, ListPoolUpstreamsResponse]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type InternalGitaly_ListPoolUpstreamsServer = grpc.BidiStreamingServer[ListPoolUpstreamsRequest, ListPoolUpstreamsResponse]

// InternalGitaly_ServiceDesc is the grpc.ServiceDesc for InternalGitaly service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var InternalGitaly_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "gitaly.InternalGitaly",
	HandlerType: (*InternalGitalyServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "WalkRepos",
			Handler:       _InternalGitaly_WalkRepos_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "ScanPoolMetadata",
			Handler:       _InternalGitaly_ScanPoolMetadata_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "StorePoolMetadata",
			Handler:       _InternalGitaly_StorePoolMetadata_Handler,
			ClientStreams: true,
		},
		{
			StreamName:    "ListPoolMetadata",
			Handler:       _InternalGitaly_ListPoolMetadata_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "ListPoolUpstreams",
			Handler:       _InternalGitaly_ListPoolUpstreams_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "internal.proto",
}
