// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc             v6.30.2
// 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.64.0 or later.
const _ = grpc.SupportPackageIsVersion9

const (
	ObjectPoolService_CreateObjectPool_FullMethodName           = "/gitaly.ObjectPoolService/CreateObjectPool"
	ObjectPoolService_DeleteObjectPool_FullMethodName           = "/gitaly.ObjectPoolService/DeleteObjectPool"
	ObjectPoolService_LinkRepositoryToObjectPool_FullMethodName = "/gitaly.ObjectPoolService/LinkRepositoryToObjectPool"
	ObjectPoolService_DisconnectGitAlternates_FullMethodName    = "/gitaly.ObjectPoolService/DisconnectGitAlternates"
	ObjectPoolService_FetchIntoObjectPool_FullMethodName        = "/gitaly.ObjectPoolService/FetchIntoObjectPool"
	ObjectPoolService_GetObjectPool_FullMethodName              = "/gitaly.ObjectPoolService/GetObjectPool"
)

// 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.
//
// ObjectPoolService is a service that manages the lifetime of object pools.
//
// An object pool is a separate repository that can be linked to from multiple object pool members
// in order to deduplicate common objects between them. This is mostly used in the context of
// repository forks.
//
// The typical lifetime of an object pool is as follows:
//
//  1. An object pool is created via CreateObjectPool from its primary pool member. Typically this
//     would be the repository that gets forked.
//  2. One or more repositories are linked to the object pool via LinkRepositoryToObjectPool. Each
//     object pool member linked to the repository will have its objects deduplicated when its
//     objects get repacked the next time.
//  3. The object pool is regularly updated via FetchIntoObjectPool. This is typically only done from
//     the primary object pool member.
//  4. Repositories may leave the object pool via DisconnectGitAlternates. There is not much of a
//     reason to do this for any repositories except for the primary object pool member in case it
//     for example becomes private.
//  5. When the object pool does not have any members anymore it gets deleted via DeleteObjectPool.
//     It is the responsibility of the caller to ensure that it really has no members left, else
//     any existing member will become corrupt.
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)
	// 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) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(CreateObjectPoolResponse)
	err := c.cc.Invoke(ctx, ObjectPoolService_CreateObjectPool_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *objectPoolServiceClient) DeleteObjectPool(ctx context.Context, in *DeleteObjectPoolRequest, opts ...grpc.CallOption) (*DeleteObjectPoolResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(DeleteObjectPoolResponse)
	err := c.cc.Invoke(ctx, ObjectPoolService_DeleteObjectPool_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *objectPoolServiceClient) LinkRepositoryToObjectPool(ctx context.Context, in *LinkRepositoryToObjectPoolRequest, opts ...grpc.CallOption) (*LinkRepositoryToObjectPoolResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(LinkRepositoryToObjectPoolResponse)
	err := c.cc.Invoke(ctx, ObjectPoolService_LinkRepositoryToObjectPool_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *objectPoolServiceClient) DisconnectGitAlternates(ctx context.Context, in *DisconnectGitAlternatesRequest, opts ...grpc.CallOption) (*DisconnectGitAlternatesResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(DisconnectGitAlternatesResponse)
	err := c.cc.Invoke(ctx, ObjectPoolService_DisconnectGitAlternates_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *objectPoolServiceClient) FetchIntoObjectPool(ctx context.Context, in *FetchIntoObjectPoolRequest, opts ...grpc.CallOption) (*FetchIntoObjectPoolResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(FetchIntoObjectPoolResponse)
	err := c.cc.Invoke(ctx, ObjectPoolService_FetchIntoObjectPool_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *objectPoolServiceClient) GetObjectPool(ctx context.Context, in *GetObjectPoolRequest, opts ...grpc.CallOption) (*GetObjectPoolResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(GetObjectPoolResponse)
	err := c.cc.Invoke(ctx, ObjectPoolService_GetObjectPool_FullMethodName, in, out, cOpts...)
	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.
//
// ObjectPoolService is a service that manages the lifetime of object pools.
//
// An object pool is a separate repository that can be linked to from multiple object pool members
// in order to deduplicate common objects between them. This is mostly used in the context of
// repository forks.
//
// The typical lifetime of an object pool is as follows:
//
//  1. An object pool is created via CreateObjectPool from its primary pool member. Typically this
//     would be the repository that gets forked.
//  2. One or more repositories are linked to the object pool via LinkRepositoryToObjectPool. Each
//     object pool member linked to the repository will have its objects deduplicated when its
//     objects get repacked the next time.
//  3. The object pool is regularly updated via FetchIntoObjectPool. This is typically only done from
//     the primary object pool member.
//  4. Repositories may leave the object pool via DisconnectGitAlternates. There is not much of a
//     reason to do this for any repositories except for the primary object pool member in case it
//     for example becomes private.
//  5. When the object pool does not have any members anymore it gets deleted via DeleteObjectPool.
//     It is the responsibility of the caller to ensure that it really has no members left, else
//     any existing member will become corrupt.
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)
	// 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.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedObjectPoolServiceServer struct{}

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

// 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) {
	// If the following call panics, it indicates UnimplementedObjectPoolServiceServer 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(&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: ObjectPoolService_CreateObjectPool_FullMethodName,
	}
	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: ObjectPoolService_DeleteObjectPool_FullMethodName,
	}
	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: ObjectPoolService_LinkRepositoryToObjectPool_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ObjectPoolServiceServer).LinkRepositoryToObjectPool(ctx, req.(*LinkRepositoryToObjectPoolRequest))
	}
	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: ObjectPoolService_DisconnectGitAlternates_FullMethodName,
	}
	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: ObjectPoolService_FetchIntoObjectPool_FullMethodName,
	}
	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: ObjectPoolService_GetObjectPool_FullMethodName,
	}
	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: "DisconnectGitAlternates",
			Handler:    _ObjectPoolService_DisconnectGitAlternates_Handler,
		},
		{
			MethodName: "FetchIntoObjectPool",
			Handler:    _ObjectPoolService_FetchIntoObjectPool_Handler,
		},
		{
			MethodName: "GetObjectPool",
			Handler:    _ObjectPoolService_GetObjectPool_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "objectpool.proto",
}
