gitlfs

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: AGPL-3.0 Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package gitlfs serves hosted Git LFS repositories: the batch API with the basic transfer adapter (https://github.com/git-lfs/git-lfs/blob/main/docs/api). Objects are immutable blobs named by their SHA-256 and live under /repos/gitlfs/<repo>; a client points lfs.url at that URL.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPHandler

type HTTPHandler struct {
	*base.Handler

	DB HTTPStore
}

HTTPHandler serves the Git LFS protocol of hosted repositories.

func NewHTTPHandler

func NewHTTPHandler(log *logger.Logger, db HTTPStore, blobStore storage.BlobStore, baseURL string) *HTTPHandler

NewHTTPHandler returns a handler for repositories of format gitlfs.

func (*HTTPHandler) RegisterRepoRoutes

func (h *HTTPHandler) RegisterRepoRoutes(r chi.Router)

RegisterRepoRoutes registers the protocol routes on the repository's sub-router (/repos/gitlfs/{name}); the caller owns the path prefix.

func (*HTTPHandler) RegisterRoutes

func (h *HTTPHandler) RegisterRoutes(r chi.Router, prefix string)

RegisterRoutes registers the protocol routes under prefix.

type HTTPStore

type HTTPStore interface {
	quarantine.Checker
	BlobReferenceCount(ctx context.Context, sha256 string) (int, error)
	CountFileDownload(fileID string)
	DecrementStorageUsage(ctx context.Context, repoID string, sizeBytes int64, artifactCount int) error
	GetGitLFSObjects(ctx context.Context, repoID string, oids []string) ([]*models.GitLFSObject, error)
	GetOrCreateStorageQuota(ctx context.Context, repoID string) (*models.StorageQuota, error)
	GetRawArtifact(ctx context.Context, repoID string, path string) (*models.RawArtifact, error)
	GetRepositoryByName(ctx context.Context, name string) (*models.Repository, error)
	PutGitLFSObject(ctx context.Context, obj *models.GitLFSObject) error
	ReserveStorageUsage(ctx context.Context, repoID string, sizeBytes int64, artifactCount int) (bool, error)
	UpsertRawArtifact(ctx context.Context, artifact *models.RawArtifact) error
}

HTTPStore is the part of the database HTTPHandler needs.

Jump to

Keyboard shortcuts

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