Documentation
¶
Overview ¶
Package lfs stores Git LFS objects (D82): content-addressed files per repository under data/lfs, written only after their sha256 and size are checked. Objects never change once written, so a backup can hard-link them and a fork can share them without copying bytes.
Index ¶
- Variables
- func IsAuth(tok string) bool
- func SignAuth(key []byte, userID, repoID int64, write bool, exp time.Time) string
- func ValidOID(s string) bool
- func VerifyAuth(key []byte, tok string, now time.Time) (userID, repoID int64, write, ok bool)
- type Pointer
- type Store
- func (s Store) Delete(repoID int64) error
- func (s Store) LinkAll(from int64, to Store, toID int64) (int, error)
- func (s Store) Open(repoID int64, oid string) (*os.File, error)
- func (s Store) Path(repoID int64, oid string) string
- func (s Store) Put(repoID int64, oid string, size, limit int64, r io.Reader) error
- func (s Store) Repos() ([]int64, error)
- func (s Store) Stat(repoID int64, oid string) (int64, bool)
- func (s Store) Usage(repoID int64) (count int, bytes int64, err error)
- func (s Store) Verify(repoID int64) (bad []string, err error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrMismatch = errors.New("lfs: content does not match its oid or size") ErrTooLarge = errors.New("lfs: object larger than the limit") )
Errors an upload maps to answers.
Functions ¶
Types ¶
type Pointer ¶
Pointer is a parsed LFS pointer file.
func ParsePointer ¶
ParsePointer recognises a Git LFS pointer file (spec v1): a version line, then sorted key/value lines including "oid sha256:<hex>" and "size <n>". Anything else is ordinary content.
type Store ¶
type Store struct{ Root string }
Store is the object store; Root is data/lfs.
func (Store) LinkAll ¶
LinkAll makes every object of one repository available in another (a fork, a merge from a fork, a backup): a hard link when both are on one filesystem, a copy otherwise. Objects the target has already are left alone.
func (Store) Path ¶
Path is where an object of a repository lives. oid must be valid (callers check ValidOID).
func (Store) Put ¶
Put writes an object from r, at most limit bytes (0 = no limit). The bytes go to a temporary file first; only when their sha256 equals oid (and the size equals size, when size >= 0) is the file moved into place, so a half upload or a lie about the content never becomes an object.