lfsutil

package
v0.0.0-...-2ad639e Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidOID = errors.New("OID is not valid")
View Source
var ErrObjectNotExist = errors.New("Object does not exist")

Functions

func ValidOID

func ValidOID(oid OID) bool

ValidOID returns true if given oid is valid.

Types

type LocalStorage

type LocalStorage struct {
	// The root path for storing LFS objects.
	Root string
}

LocalStorage is a LFS storage backend on local file system.

func (*LocalStorage) Download

func (s *LocalStorage) Download(oid OID, w io.Writer) error

func (*LocalStorage) Storage

func (s *LocalStorage) Storage() Storage

func (*LocalStorage) Upload

func (s *LocalStorage) Upload(oid OID, rc io.ReadCloser) (int64, error)

type OID

type OID string

OID is an LFS object ID.

type Storage

type Storage string

Storage is the storage type of an LFS object.

const (
	StorageLocal Storage = "local"
)

type Storager

type Storager interface {
	// Storage returns the name of the storage backend.
	Storage() Storage
	// Upload reads content from the io.ReadCloser and uploads as given oid.
	// The reader is closed once upload is finished. ErrInvalidOID is returned
	// if the given oid is not valid.
	Upload(oid OID, rc io.ReadCloser) (int64, error)
	// Download streams content of given oid to the io.Writer. It is caller's
	// responsibility the close the writer when needed. ErrObjectNotExist is
	// returned if the given oid does not exist.
	Download(oid OID, w io.Writer) error
}

Storager is an storage backend for uploading and downloading LFS objects.

Jump to

Keyboard shortcuts

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