// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc             (unknown)
// source: gitmirror/v1/gitmirror.proto

package gitmirrorv1

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 (
	GitMirrorService_Commits_FullMethodName   = "/gitmirror.v1.GitMirrorService/Commits"
	GitMirrorService_Diff_FullMethodName      = "/gitmirror.v1.GitMirrorService/Diff"
	GitMirrorService_Interdiff_FullMethodName = "/gitmirror.v1.GitMirrorService/Interdiff"
	GitMirrorService_GetBlob_FullMethodName   = "/gitmirror.v1.GitMirrorService/GetBlob"
	GitMirrorService_CommitLog_FullMethodName = "/gitmirror.v1.GitMirrorService/CommitLog"
)

// GitMirrorServiceClient is the client API for GitMirrorService 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 GitMirrorServiceClient interface {
	Commits(ctx context.Context, in *CommitsRequest, opts ...grpc.CallOption) (*CommitsResponse, error)
	Diff(ctx context.Context, in *DiffRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[FileDiff], error)
	Interdiff(ctx context.Context, in *InterdiffRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[FileDiff], error)
	// GetBlob streams a blob's raw bytes by OID, in chunks.
	GetBlob(ctx context.Context, in *GetBlobRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[BlobChunk], error)
	CommitLog(ctx context.Context, in *CommitLogRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[CommitLogResponse], error)
}

type gitMirrorServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewGitMirrorServiceClient(cc grpc.ClientConnInterface) GitMirrorServiceClient {
	return &gitMirrorServiceClient{cc}
}

func (c *gitMirrorServiceClient) Commits(ctx context.Context, in *CommitsRequest, opts ...grpc.CallOption) (*CommitsResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(CommitsResponse)
	err := c.cc.Invoke(ctx, GitMirrorService_Commits_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *gitMirrorServiceClient) Diff(ctx context.Context, in *DiffRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[FileDiff], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &GitMirrorService_ServiceDesc.Streams[0], GitMirrorService_Diff_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[DiffRequest, FileDiff]{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 GitMirrorService_DiffClient = grpc.ServerStreamingClient[FileDiff]

func (c *gitMirrorServiceClient) Interdiff(ctx context.Context, in *InterdiffRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[FileDiff], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &GitMirrorService_ServiceDesc.Streams[1], GitMirrorService_Interdiff_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[InterdiffRequest, FileDiff]{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 GitMirrorService_InterdiffClient = grpc.ServerStreamingClient[FileDiff]

func (c *gitMirrorServiceClient) GetBlob(ctx context.Context, in *GetBlobRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[BlobChunk], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &GitMirrorService_ServiceDesc.Streams[2], GitMirrorService_GetBlob_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[GetBlobRequest, BlobChunk]{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 GitMirrorService_GetBlobClient = grpc.ServerStreamingClient[BlobChunk]

func (c *gitMirrorServiceClient) CommitLog(ctx context.Context, in *CommitLogRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[CommitLogResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &GitMirrorService_ServiceDesc.Streams[3], GitMirrorService_CommitLog_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[CommitLogRequest, CommitLogResponse]{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 GitMirrorService_CommitLogClient = grpc.ServerStreamingClient[CommitLogResponse]

// GitMirrorServiceServer is the server API for GitMirrorService service.
// All implementations must embed UnimplementedGitMirrorServiceServer
// for forward compatibility.
type GitMirrorServiceServer interface {
	Commits(context.Context, *CommitsRequest) (*CommitsResponse, error)
	Diff(*DiffRequest, grpc.ServerStreamingServer[FileDiff]) error
	Interdiff(*InterdiffRequest, grpc.ServerStreamingServer[FileDiff]) error
	// GetBlob streams a blob's raw bytes by OID, in chunks.
	GetBlob(*GetBlobRequest, grpc.ServerStreamingServer[BlobChunk]) error
	CommitLog(*CommitLogRequest, grpc.ServerStreamingServer[CommitLogResponse]) error
	mustEmbedUnimplementedGitMirrorServiceServer()
}

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

func (UnimplementedGitMirrorServiceServer) Commits(context.Context, *CommitsRequest) (*CommitsResponse, error) {
	return nil, status.Error(codes.Unimplemented, "method Commits not implemented")
}
func (UnimplementedGitMirrorServiceServer) Diff(*DiffRequest, grpc.ServerStreamingServer[FileDiff]) error {
	return status.Error(codes.Unimplemented, "method Diff not implemented")
}
func (UnimplementedGitMirrorServiceServer) Interdiff(*InterdiffRequest, grpc.ServerStreamingServer[FileDiff]) error {
	return status.Error(codes.Unimplemented, "method Interdiff not implemented")
}
func (UnimplementedGitMirrorServiceServer) GetBlob(*GetBlobRequest, grpc.ServerStreamingServer[BlobChunk]) error {
	return status.Error(codes.Unimplemented, "method GetBlob not implemented")
}
func (UnimplementedGitMirrorServiceServer) CommitLog(*CommitLogRequest, grpc.ServerStreamingServer[CommitLogResponse]) error {
	return status.Error(codes.Unimplemented, "method CommitLog not implemented")
}
func (UnimplementedGitMirrorServiceServer) mustEmbedUnimplementedGitMirrorServiceServer() {}
func (UnimplementedGitMirrorServiceServer) testEmbeddedByValue()                          {}

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

func RegisterGitMirrorServiceServer(s grpc.ServiceRegistrar, srv GitMirrorServiceServer) {
	// If the following call panics, it indicates UnimplementedGitMirrorServiceServer 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(&GitMirrorService_ServiceDesc, srv)
}

func _GitMirrorService_Commits_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(CommitsRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(GitMirrorServiceServer).Commits(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: GitMirrorService_Commits_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(GitMirrorServiceServer).Commits(ctx, req.(*CommitsRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _GitMirrorService_Diff_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(DiffRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(GitMirrorServiceServer).Diff(m, &grpc.GenericServerStream[DiffRequest, FileDiff]{ServerStream: stream})
}

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

func _GitMirrorService_Interdiff_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(InterdiffRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(GitMirrorServiceServer).Interdiff(m, &grpc.GenericServerStream[InterdiffRequest, FileDiff]{ServerStream: stream})
}

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

func _GitMirrorService_GetBlob_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(GetBlobRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(GitMirrorServiceServer).GetBlob(m, &grpc.GenericServerStream[GetBlobRequest, BlobChunk]{ServerStream: stream})
}

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

func _GitMirrorService_CommitLog_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(CommitLogRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(GitMirrorServiceServer).CommitLog(m, &grpc.GenericServerStream[CommitLogRequest, CommitLogResponse]{ServerStream: stream})
}

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

// GitMirrorService_ServiceDesc is the grpc.ServiceDesc for GitMirrorService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var GitMirrorService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "gitmirror.v1.GitMirrorService",
	HandlerType: (*GitMirrorServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Commits",
			Handler:    _GitMirrorService_Commits_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Diff",
			Handler:       _GitMirrorService_Diff_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "Interdiff",
			Handler:       _GitMirrorService_Interdiff_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "GetBlob",
			Handler:       _GitMirrorService_GetBlob_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "CommitLog",
			Handler:       _GitMirrorService_CommitLog_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "gitmirror/v1/gitmirror.proto",
}
