lfs

package
v0.1.73 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package lfs keeps Git LFS objects in the PC's local Space. git-lfs runs modlock as its transfer agent, and the agent reaches the daemon, which serves one UnixFS object that every repository on the PC shares: LFS names each object by its content's hash, so repositories that hold the same file store it once.

Index

Constants

View Source
const ObjectKey = "git-lfs"

ObjectKey is the Space's UnixFS object that holds the LFS objects.

Variables

This section is empty.

Functions

func Refuse

func Refuse(r io.Reader, w io.Writer, cause error) error

Refuse answers git-lfs's first request with cause and returns cause, so git-lfs shows why the agent cannot run.

func RunAgent

func RunAgent(ctx context.Context, client srpc.Client, tmpDir string, r io.Reader, w io.Writer) error

RunAgent serves git-lfs's transfer protocol on r and w, storing objects through the daemon that client reaches. Downloads land in tmpDir, which must be on the same filesystem as the repository's LFS store. A daemon that cannot serve the object answers git-lfs with the cause.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server serves the Space's LFS object to agents once the daemon has opened the Space. Calls that arrive earlier wait for it.

func NewServer

func NewServer() *Server

NewServer returns a Server waiting for its Space.

func (*Server) Fail

func (s *Server) Fail(err error)

Fail fails each agent with err, for a daemon that cannot open its Space. Call it at most once, and not with Serve.

func (*Server) InvokeMethod

func (s *Server) InvokeMethod(serviceID, methodID string, strm srpc.Stream) (bool, error)

InvokeMethod serves a call on the object's root once it is open.

func (*Server) Register

func (s *Server) Register(mux srpc.Mux) error

Register serves the object on mux.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, le *logrus.Entry, sp *space.Space) error

Serve opens the LFS object in sp and serves it until ctx ends. A failure to open it fails each agent with its cause.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL