// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc             v3.21.7
// source: objectpool.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.32.0 or later.
const _ = grpc.SupportPackageIsVersion7

// ObjectPoolServiceClient is the client API for ObjectPoolService 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 ObjectPoolServiceClient interface {
	// CreateObjectPool creates an object pool from a specific source repository. It will create the
	// object pool by cloning all contents from that source repository. The source repository will not
	// automatically be linked to the object pool, you need to call LinkRepositoryToObjectPool for
	// this. If the object pool exists already this RPC returns an error with the FailedPrecondition
	// gRPC error code.
	CreateObjectPool(ctx context.Context, in *CreateObjectPoolRequest, opts ...grpc.CallOption) (*CreateObjectPoolResponse, error)
	// DeleteObjectPool deletes the object pool. There are no safety checks in place, so if any
	// repository is still using this object pool it will become corrupted.
	DeleteObjectPool(ctx context.Context, in *DeleteObjectPoolRequest, opts ...grpc.CallOption) (*DeleteObjectPoolResponse, error)
	// LinkRepositoryToObjectPool links the specified repository to the object pool. Objects contained
	// in the object pool will be deduplicated for this repository when repacking objects.
	LinkRepositoryToObjectPool(ctx context.Context, in *LinkRepositoryToObjectPoolRequest, opts ...grpc.CallOption) (*LinkRepositoryToObjectPoolResponse, error)
	// Deprecated: Do not use.
	// ReduplicateRepository will repack the objects in the object pool member so that the repository
	// does not depend on the pool member anymore and can be removed from it. Note that this function
	// is not safe for use.
	//
	// This RPC is deprecated. Please use DisconnectGitAlternates instead.  It will be removed in
	// Gitaly v16.0, refer to https://gitlab.com/gitlab-org/gitaly/-/issues/4655.
	ReduplicateRepository(ctx context.Context, in *ReduplicateRepositoryRequest, opts ...grpc.CallOption) (*ReduplicateRepositoryResponse, error)
	// DisconnectGitAlternates will disconnect the object pool member from its object pool. It will:
	//
	//  1. Link all objects from the object pool into the member repository. This essenitally
	//     reduplicates previously-duplicated objects so that the repository will continue to function
	//     after being unlinked.
	//  2. Remove the alternates link to the object pool.
	//  3. Perform a consistency check to assert that the repository is indeed fully functional after
	//     unlinking it from its pool. If the consistency check fails the alternates link is restored
	//     an the RPC fails.
	//
	// If successful, the object pool member is disconnected from the object pool and does not depend
	// on it anymore.
	//
	// This RPC does not return an error in case the repository is not linked to any object pool.
	DisconnectGitAlternates(ctx context.Context, in *DisconnectGitAlternatesRequest, opts ...grpc.CallOption) (*DisconnectGitAlternatesResponse, error)
	// FetchIntoObjectPool fetches all references from a pool member into an object pool so that
	// objects shared between this repository and other pool members can be deduplicated. This RPC
	// will perform housekeeping tasks after the object pool has been updated to ensure that the pool
	// is in an optimal state.
	FetchIntoObjectPool(ctx context.Context, in *FetchIntoObjectPoolRequest, opts ...grpc.CallOption) (*FetchIntoObjectPoolResponse, error)
	// GetObjectPool returns the object pool a repository is connected to. If the repository is not
	// connected to a pool then this RPC returns successfully with an empty response.
	GetObjectPool(ctx context.Context, in *GetObjectPoolRequest, opts ...grpc.CallOption) (*GetObjectPoolResponse, error)
}

type objectPoolServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewObjectPoolServiceClient(cc grpc.ClientConnInterface) ObjectPoolServiceClient {
	return &objectPoolServiceClient{cc}
}

func (c *objectPoolServiceClient) CreateObjectPool(ctx context.Context, in *CreateObjectPoolRequest, opts ...grpc.CallOption) (*CreateObjectPoolResponse, error) {
	out := new(CreateObjectPoolResponse)
	err := c.cc.Invoke(ctx, "/gitaly.ObjectPoolService/CreateObjectPool", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *objectPoolServiceClient) DeleteObjectPool(ctx context.Context, in *DeleteObjectPoolRequest, opts ...grpc.CallOption) (*DeleteObjectPoolResponse, error) {
	out := new(DeleteObjectPoolResponse)
	err := c.cc.Invoke(ctx, "/gitaly.ObjectPoolService/DeleteObjectPool", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *objectPoolServiceClient) LinkRepositoryToObjectPool(ctx context.Context, in *LinkRepositoryToObjectPoolRequest, opts ...grpc.CallOption) (*LinkRepositoryToObjectPoolResponse, error) {
	out := new(LinkRepositoryToObjectPoolResponse)
	err := c.cc.Invoke(ctx, "/gitaly.ObjectPoolService/LinkRepositoryToObjectPool", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// Deprecated: Do not use.
func (c *objectPoolServiceClient) ReduplicateRepository(ctx context.Context, in *ReduplicateRepositoryRequest, opts ...grpc.CallOption) (*ReduplicateRepositoryResponse, error) {
	out := new(ReduplicateRepositoryResponse)
	err := c.cc.Invoke(ctx, "/gitaly.ObjectPoolService/ReduplicateRepository", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *objectPoolServiceClient) DisconnectGitAlternates(ctx context.Context, in *DisconnectGitAlternatesRequest, opts ...grpc.CallOption) (*DisconnectGitAlternatesResponse, error) {
	out := new(DisconnectGitAlternatesResponse)
	err := c.cc.Invoke(ctx, "/gitaly.ObjectPoolService/DisconnectGitAlternates", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *objectPoolServiceClient) FetchIntoObjectPool(ctx context.Context, in *FetchIntoObjectPoolRequest, opts ...grpc.CallOption) (*FetchIntoObjectPoolResponse, error) {
	out := new(FetchIntoObjectPoolResponse)
	err := c.cc.Invoke(ctx, "/gitaly.ObjectPoolService/FetchIntoObjectPool", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *objectPoolServiceClient) GetObjectPool(ctx context.Context, in *GetObjectPoolRequest, opts ...grpc.CallOption) (*GetObjectPoolResponse, error) {
	out := new(GetObjectPoolResponse)
	err := c.cc.Invoke(ctx, "/gitaly.ObjectPoolService/GetObjectPool", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// ObjectPoolServiceServer is the server API for ObjectPoolService service.
// All implementations must embed UnimplementedObjectPoolServiceServer
// for forward compatibility
type ObjectPoolServiceServer interface {
	// CreateObjectPool creates an object pool from a specific source repository. It will create the
	// object pool by cloning all contents from that source repository. The source repository will not
	// automatically be linked to the object pool, you need to call LinkRepositoryToObjectPool for
	// this. If the object pool exists already this RPC returns an error with the FailedPrecondition
	// gRPC error code.
	CreateObjectPool(context.Context, *CreateObjectPoolRequest) (*CreateObjectPoolResponse, error)
	// DeleteObjectPool deletes the object pool. There are no safety checks in place, so if any
	// repository is still using this object pool it will become corrupted.
	DeleteObjectPool(context.Context, *DeleteObjectPoolRequest) (*DeleteObjectPoolResponse, error)
	// LinkRepositoryToObjectPool links the specified repository to the object pool. Objects contained
	// in the object pool will be deduplicated for this repository when repacking objects.
	LinkRepositoryToObjectPool(context.Context, *LinkRepositoryToObjectPoolRequest) (*LinkRepositoryToObjectPoolResponse, error)
	// Deprecated: Do not use.
	// ReduplicateRepository will repack the objects in the object pool member so that the repository
	// does not depend on the pool member anymore and can be removed from it. Note that this function
	// is not safe for use.
	//
	// This RPC is deprecated. Please use DisconnectGitAlternates instead.  It will be removed in
	// Gitaly v16.0, refer to https://gitlab.com/gitlab-org/gitaly/-/issues/4655.
	ReduplicateRepository(context.Context, *ReduplicateRepositoryRequest) (*ReduplicateRepositoryResponse, error)
	// DisconnectGitAlternates will disconnect the object pool member from its object pool. It will:
	//
	//  1. Link all objects from the object pool into the member repository. This essenitally
	//     reduplicates previously-duplicated objects so that the repository will continue to function
	//     after being unlinked.
	//  2. Remove the alternates link to the object pool.
	//  3. Perform a consistency check to assert that the repository is indeed fully functional after
	//     unlinking it from its pool. If the consistency check fails the alternates link is restored
	//     an the RPC fails.
	//
	// If successful, the object pool member is disconnected from the object pool and does not depend
	// on it anymore.
	//
	// This RPC does not return an error in case the repository is not linked to any object pool.
	DisconnectGitAlternates(context.Context, *DisconnectGitAlternatesRequest) (*DisconnectGitAlternatesResponse, error)
	// FetchIntoObjectPool fetches all references from a pool member into an object pool so that
	// objects shared between this repository and other pool members can be deduplicated. This RPC
	// will perform housekeeping tasks after the object pool has been updated to ensure that the pool
	// is in an optimal state.
	FetchIntoObjectPool(context.Context, *FetchIntoObjectPoolRequest) (*FetchIntoObjectPoolResponse, error)
	// GetObjectPool returns the object pool a repository is connected to. If the repository is not
	// connected to a pool then this RPC returns successfully with an empty response.
	GetObjectPool(context.Context, *GetObjectPoolRequest) (*GetObjectPoolResponse, error)
	mustEmbedUnimplementedObjectPoolServiceServer()
}

// UnimplementedObjectPoolServiceServer must be embedded to have forward compatible implementations.
type UnimplementedObjectPoolServiceServer struct {
}

func (UnimplementedObjectPoolServiceServer) CreateObjectPool(context.Context, *CreateObjectPoolRequest) (*CreateObjectPoolResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method CreateObjectPool not implemented")
}
func (UnimplementedObjectPoolServiceServer) DeleteObjectPool(context.Context, *DeleteObjectPoolRequest) (*DeleteObjectPoolResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method DeleteObjectPool not implemented")
}
func (UnimplementedObjectPoolServiceServer) LinkRepositoryToObjectPool(context.Context, *LinkRepositoryToObjectPoolRequest) (*LinkRepositoryToObjectPoolResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method LinkRepositoryToObjectPool not implemented")
}
func (UnimplementedObjectPoolServiceServer) ReduplicateRepository(context.Context, *ReduplicateRepositoryRequest) (*ReduplicateRepositoryResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ReduplicateRepository not implemented")
}
func (UnimplementedObjectPoolServiceServer) DisconnectGitAlternates(context.Context, *DisconnectGitAlternatesRequest) (*DisconnectGitAlternatesResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method DisconnectGitAlternates not implemented")
}
func (UnimplementedObjectPoolServiceServer) FetchIntoObjectPool(context.Context, *FetchIntoObjectPoolRequest) (*FetchIntoObjectPoolResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method FetchIntoObjectPool not implemented")
}
func (UnimplementedObjectPoolServiceServer) GetObjectPool(context.Context, *GetObjectPoolRequest) (*GetObjectPoolResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetObjectPool not implemented")
}
func (UnimplementedObjectPoolServiceServer) mustEmbedUnimplementedObjectPoolServiceServer() {}

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

func RegisterObjectPoolServiceServer(s grpc.ServiceRegistrar, srv ObjectPoolServiceServer) {
	s.RegisterService(&ObjectPoolService_ServiceDesc, srv)
}

func _ObjectPoolService_CreateObjectPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(CreateObjectPoolRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ObjectPoolServiceServer).CreateObjectPool(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/gitaly.ObjectPoolService/CreateObjectPool",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ObjectPoolServiceServer).CreateObjectPool(ctx, req.(*CreateObjectPoolRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _ObjectPoolService_DeleteObjectPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(DeleteObjectPoolRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ObjectPoolServiceServer).DeleteObjectPool(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/gitaly.ObjectPoolService/DeleteObjectPool",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ObjectPoolServiceServer).DeleteObjectPool(ctx, req.(*DeleteObjectPoolRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _ObjectPoolService_LinkRepositoryToObjectPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(LinkRepositoryToObjectPoolRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ObjectPoolServiceServer).LinkRepositoryToObjectPool(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/gitaly.ObjectPoolService/LinkRepositoryToObjectPool",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ObjectPoolServiceServer).LinkRepositoryToObjectPool(ctx, req.(*LinkRepositoryToObjectPoolRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _ObjectPoolService_ReduplicateRepository_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ReduplicateRepositoryRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ObjectPoolServiceServer).ReduplicateRepository(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/gitaly.ObjectPoolService/ReduplicateRepository",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ObjectPoolServiceServer).ReduplicateRepository(ctx, req.(*ReduplicateRepositoryRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _ObjectPoolService_DisconnectGitAlternates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(DisconnectGitAlternatesRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ObjectPoolServiceServer).DisconnectGitAlternates(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/gitaly.ObjectPoolService/DisconnectGitAlternates",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ObjectPoolServiceServer).DisconnectGitAlternates(ctx, req.(*DisconnectGitAlternatesRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _ObjectPoolService_FetchIntoObjectPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(FetchIntoObjectPoolRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ObjectPoolServiceServer).FetchIntoObjectPool(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/gitaly.ObjectPoolService/FetchIntoObjectPool",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ObjectPoolServiceServer).FetchIntoObjectPool(ctx, req.(*FetchIntoObjectPoolRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _ObjectPoolService_GetObjectPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetObjectPoolRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ObjectPoolServiceServer).GetObjectPool(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/gitaly.ObjectPoolService/GetObjectPool",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ObjectPoolServiceServer).GetObjectPool(ctx, req.(*GetObjectPoolRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// ObjectPoolService_ServiceDesc is the grpc.ServiceDesc for ObjectPoolService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ObjectPoolService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "gitaly.ObjectPoolService",
	HandlerType: (*ObjectPoolServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateObjectPool",
			Handler:    _ObjectPoolService_CreateObjectPool_Handler,
		},
		{
			MethodName: "DeleteObjectPool",
			Handler:    _ObjectPoolService_DeleteObjectPool_Handler,
		},
		{
			MethodName: "LinkRepositoryToObjectPool",
			Handler:    _ObjectPoolService_LinkRepositoryToObjectPool_Handler,
		},
		{
			MethodName: "ReduplicateRepository",
			Handler:    _ObjectPoolService_ReduplicateRepository_Handler,
		},
		{
			MethodName: "DisconnectGitAlternates",
			Handler:    _ObjectPoolService_DisconnectGitAlternates_Handler,
		},
		{
			MethodName: "FetchIntoObjectPool",
			Handler:    _ObjectPoolService_FetchIntoObjectPool_Handler,
		},
		{
			MethodName: "GetObjectPool",
			Handler:    _ObjectPoolService_GetObjectPool_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "objectpool.proto",
}
