// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc             v7.35.0
// source: proto/server/cartfs.proto

package server

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 (
	Cartfs_CopyDirectory_FullMethodName               = "/cartfs.Cartfs/CopyDirectory"
	Cartfs_AuditLog_FullMethodName                    = "/cartfs.Cartfs/AuditLog"
	Cartfs_GetState_FullMethodName                    = "/cartfs.Cartfs/GetState"
	Cartfs_LocalCASStatus_FullMethodName              = "/cartfs.Cartfs/LocalCASStatus"
	Cartfs_GetDigest_FullMethodName                   = "/cartfs.Cartfs/GetDigest"
	Cartfs_RegisterFiles_FullMethodName               = "/cartfs.Cartfs/RegisterFiles"
	Cartfs_StartTapSession_FullMethodName             = "/cartfs.Cartfs/StartTapSession"
	Cartfs_FinishTapSession_FullMethodName            = "/cartfs.Cartfs/FinishTapSession"
	Cartfs_ExcludeProcessGroupFromTaps_FullMethodName = "/cartfs.Cartfs/ExcludeProcessGroupFromTaps"
)

// CartfsClient is the client API for Cartfs 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 CartfsClient interface {
	// Copy a directory and its contents.
	CopyDirectory(ctx context.Context, in *CopyDirectoryRequest, opts ...grpc.CallOption) (*CopyDirectoryResponse, error)
	// Get the audit log string for a given inode.
	AuditLog(ctx context.Context, in *AuditLogRequest, opts ...grpc.CallOption) (*AuditLogResponse, error)
	// Get the current state of the cartfs instance.
	GetState(ctx context.Context, in *GetStateRequest, opts ...grpc.CallOption) (*GetStateResponse, error)
	// Get the status of the local cas.
	LocalCASStatus(ctx context.Context, in *LocalCASStatusRequest, opts ...grpc.CallOption) (*LocalCASStatusResponse, error)
	// Get the digest of a file.
	GetDigest(ctx context.Context, in *GetDigestRequest, opts ...grpc.CallOption) (*GetDigestResponse, error)
	// Registers a set of files.  Used to register files locally that
	// exist in the RBE CAS.
	RegisterFiles(ctx context.Context, in *RegisterFilesRequest, opts ...grpc.CallOption) (*RegisterFilesResponse, error)
	// Starts a Tap session.  Part of the StartTapSessionRequest includes the
	// process group id to watch.  Returns a stream of tap events as they occur.
	StartTapSession(ctx context.Context, in *StartTapSessionRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[TapEventBatch], error)
	// Notifies CartFS that a tap session should be closed.  This usually means
	// the process group has completed so there will be no more file system
	// access from any process within that group.
	// This will result in the stream of TapEventBatch messages from a
	// StartTapSession to be closed after all remaining TapEventBatch messages
	// have been sent.
	FinishTapSession(ctx context.Context, in *FinishTapSessionRequest, opts ...grpc.CallOption) (*FinishTapSessionResponse, error)
	// Excludes a process group from having tap events created for it.
	ExcludeProcessGroupFromTaps(ctx context.Context, in *ExcludeProcessGroupFromTapsRequest, opts ...grpc.CallOption) (*ExcludeProcessGroupFromTapsResponse, error)
}

type cartfsClient struct {
	cc grpc.ClientConnInterface
}

func NewCartfsClient(cc grpc.ClientConnInterface) CartfsClient {
	return &cartfsClient{cc}
}

func (c *cartfsClient) CopyDirectory(ctx context.Context, in *CopyDirectoryRequest, opts ...grpc.CallOption) (*CopyDirectoryResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(CopyDirectoryResponse)
	err := c.cc.Invoke(ctx, Cartfs_CopyDirectory_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *cartfsClient) AuditLog(ctx context.Context, in *AuditLogRequest, opts ...grpc.CallOption) (*AuditLogResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(AuditLogResponse)
	err := c.cc.Invoke(ctx, Cartfs_AuditLog_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *cartfsClient) GetState(ctx context.Context, in *GetStateRequest, opts ...grpc.CallOption) (*GetStateResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(GetStateResponse)
	err := c.cc.Invoke(ctx, Cartfs_GetState_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *cartfsClient) LocalCASStatus(ctx context.Context, in *LocalCASStatusRequest, opts ...grpc.CallOption) (*LocalCASStatusResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(LocalCASStatusResponse)
	err := c.cc.Invoke(ctx, Cartfs_LocalCASStatus_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *cartfsClient) GetDigest(ctx context.Context, in *GetDigestRequest, opts ...grpc.CallOption) (*GetDigestResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(GetDigestResponse)
	err := c.cc.Invoke(ctx, Cartfs_GetDigest_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *cartfsClient) RegisterFiles(ctx context.Context, in *RegisterFilesRequest, opts ...grpc.CallOption) (*RegisterFilesResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(RegisterFilesResponse)
	err := c.cc.Invoke(ctx, Cartfs_RegisterFiles_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *cartfsClient) StartTapSession(ctx context.Context, in *StartTapSessionRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[TapEventBatch], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &Cartfs_ServiceDesc.Streams[0], Cartfs_StartTapSession_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[StartTapSessionRequest, TapEventBatch]{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 Cartfs_StartTapSessionClient = grpc.ServerStreamingClient[TapEventBatch]

func (c *cartfsClient) FinishTapSession(ctx context.Context, in *FinishTapSessionRequest, opts ...grpc.CallOption) (*FinishTapSessionResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(FinishTapSessionResponse)
	err := c.cc.Invoke(ctx, Cartfs_FinishTapSession_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *cartfsClient) ExcludeProcessGroupFromTaps(ctx context.Context, in *ExcludeProcessGroupFromTapsRequest, opts ...grpc.CallOption) (*ExcludeProcessGroupFromTapsResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(ExcludeProcessGroupFromTapsResponse)
	err := c.cc.Invoke(ctx, Cartfs_ExcludeProcessGroupFromTaps_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// CartfsServer is the server API for Cartfs service.
// All implementations must embed UnimplementedCartfsServer
// for forward compatibility.
type CartfsServer interface {
	// Copy a directory and its contents.
	CopyDirectory(context.Context, *CopyDirectoryRequest) (*CopyDirectoryResponse, error)
	// Get the audit log string for a given inode.
	AuditLog(context.Context, *AuditLogRequest) (*AuditLogResponse, error)
	// Get the current state of the cartfs instance.
	GetState(context.Context, *GetStateRequest) (*GetStateResponse, error)
	// Get the status of the local cas.
	LocalCASStatus(context.Context, *LocalCASStatusRequest) (*LocalCASStatusResponse, error)
	// Get the digest of a file.
	GetDigest(context.Context, *GetDigestRequest) (*GetDigestResponse, error)
	// Registers a set of files.  Used to register files locally that
	// exist in the RBE CAS.
	RegisterFiles(context.Context, *RegisterFilesRequest) (*RegisterFilesResponse, error)
	// Starts a Tap session.  Part of the StartTapSessionRequest includes the
	// process group id to watch.  Returns a stream of tap events as they occur.
	StartTapSession(*StartTapSessionRequest, grpc.ServerStreamingServer[TapEventBatch]) error
	// Notifies CartFS that a tap session should be closed.  This usually means
	// the process group has completed so there will be no more file system
	// access from any process within that group.
	// This will result in the stream of TapEventBatch messages from a
	// StartTapSession to be closed after all remaining TapEventBatch messages
	// have been sent.
	FinishTapSession(context.Context, *FinishTapSessionRequest) (*FinishTapSessionResponse, error)
	// Excludes a process group from having tap events created for it.
	ExcludeProcessGroupFromTaps(context.Context, *ExcludeProcessGroupFromTapsRequest) (*ExcludeProcessGroupFromTapsResponse, error)
	mustEmbedUnimplementedCartfsServer()
}

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

func (UnimplementedCartfsServer) CopyDirectory(context.Context, *CopyDirectoryRequest) (*CopyDirectoryResponse, error) {
	return nil, status.Error(codes.Unimplemented, "method CopyDirectory not implemented")
}
func (UnimplementedCartfsServer) AuditLog(context.Context, *AuditLogRequest) (*AuditLogResponse, error) {
	return nil, status.Error(codes.Unimplemented, "method AuditLog not implemented")
}
func (UnimplementedCartfsServer) GetState(context.Context, *GetStateRequest) (*GetStateResponse, error) {
	return nil, status.Error(codes.Unimplemented, "method GetState not implemented")
}
func (UnimplementedCartfsServer) LocalCASStatus(context.Context, *LocalCASStatusRequest) (*LocalCASStatusResponse, error) {
	return nil, status.Error(codes.Unimplemented, "method LocalCASStatus not implemented")
}
func (UnimplementedCartfsServer) GetDigest(context.Context, *GetDigestRequest) (*GetDigestResponse, error) {
	return nil, status.Error(codes.Unimplemented, "method GetDigest not implemented")
}
func (UnimplementedCartfsServer) RegisterFiles(context.Context, *RegisterFilesRequest) (*RegisterFilesResponse, error) {
	return nil, status.Error(codes.Unimplemented, "method RegisterFiles not implemented")
}
func (UnimplementedCartfsServer) StartTapSession(*StartTapSessionRequest, grpc.ServerStreamingServer[TapEventBatch]) error {
	return status.Error(codes.Unimplemented, "method StartTapSession not implemented")
}
func (UnimplementedCartfsServer) FinishTapSession(context.Context, *FinishTapSessionRequest) (*FinishTapSessionResponse, error) {
	return nil, status.Error(codes.Unimplemented, "method FinishTapSession not implemented")
}
func (UnimplementedCartfsServer) ExcludeProcessGroupFromTaps(context.Context, *ExcludeProcessGroupFromTapsRequest) (*ExcludeProcessGroupFromTapsResponse, error) {
	return nil, status.Error(codes.Unimplemented, "method ExcludeProcessGroupFromTaps not implemented")
}
func (UnimplementedCartfsServer) mustEmbedUnimplementedCartfsServer() {}
func (UnimplementedCartfsServer) testEmbeddedByValue()                {}

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

func RegisterCartfsServer(s grpc.ServiceRegistrar, srv CartfsServer) {
	// If the following call panics, it indicates UnimplementedCartfsServer 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(&Cartfs_ServiceDesc, srv)
}

func _Cartfs_CopyDirectory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(CopyDirectoryRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(CartfsServer).CopyDirectory(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Cartfs_CopyDirectory_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(CartfsServer).CopyDirectory(ctx, req.(*CopyDirectoryRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Cartfs_AuditLog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(AuditLogRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(CartfsServer).AuditLog(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Cartfs_AuditLog_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(CartfsServer).AuditLog(ctx, req.(*AuditLogRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Cartfs_GetState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetStateRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(CartfsServer).GetState(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Cartfs_GetState_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(CartfsServer).GetState(ctx, req.(*GetStateRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Cartfs_LocalCASStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(LocalCASStatusRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(CartfsServer).LocalCASStatus(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Cartfs_LocalCASStatus_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(CartfsServer).LocalCASStatus(ctx, req.(*LocalCASStatusRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Cartfs_GetDigest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetDigestRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(CartfsServer).GetDigest(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Cartfs_GetDigest_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(CartfsServer).GetDigest(ctx, req.(*GetDigestRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Cartfs_RegisterFiles_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(RegisterFilesRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(CartfsServer).RegisterFiles(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Cartfs_RegisterFiles_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(CartfsServer).RegisterFiles(ctx, req.(*RegisterFilesRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Cartfs_StartTapSession_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(StartTapSessionRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(CartfsServer).StartTapSession(m, &grpc.GenericServerStream[StartTapSessionRequest, TapEventBatch]{ServerStream: stream})
}

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

func _Cartfs_FinishTapSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(FinishTapSessionRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(CartfsServer).FinishTapSession(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Cartfs_FinishTapSession_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(CartfsServer).FinishTapSession(ctx, req.(*FinishTapSessionRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Cartfs_ExcludeProcessGroupFromTaps_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ExcludeProcessGroupFromTapsRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(CartfsServer).ExcludeProcessGroupFromTaps(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Cartfs_ExcludeProcessGroupFromTaps_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(CartfsServer).ExcludeProcessGroupFromTaps(ctx, req.(*ExcludeProcessGroupFromTapsRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// Cartfs_ServiceDesc is the grpc.ServiceDesc for Cartfs service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Cartfs_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "cartfs.Cartfs",
	HandlerType: (*CartfsServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CopyDirectory",
			Handler:    _Cartfs_CopyDirectory_Handler,
		},
		{
			MethodName: "AuditLog",
			Handler:    _Cartfs_AuditLog_Handler,
		},
		{
			MethodName: "GetState",
			Handler:    _Cartfs_GetState_Handler,
		},
		{
			MethodName: "LocalCASStatus",
			Handler:    _Cartfs_LocalCASStatus_Handler,
		},
		{
			MethodName: "GetDigest",
			Handler:    _Cartfs_GetDigest_Handler,
		},
		{
			MethodName: "RegisterFiles",
			Handler:    _Cartfs_RegisterFiles_Handler,
		},
		{
			MethodName: "FinishTapSession",
			Handler:    _Cartfs_FinishTapSession_Handler,
		},
		{
			MethodName: "ExcludeProcessGroupFromTaps",
			Handler:    _Cartfs_ExcludeProcessGroupFromTaps_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "StartTapSession",
			Handler:       _Cartfs_StartTapSession_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "proto/server/cartfs.proto",
}
