lfs

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package lfs owns the generated Git LFS protocol conversions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromGeneratedCandidate

func FromGeneratedCandidate(value generated.DrsObjectCandidate) objects.Candidate

FromGeneratedCandidate converts the LFS metadata shape to the plain value stored by the transfer workflow. The selected fields preserve the legacy DRS candidate JSON written by the previous LFS adapter.

func GetBaseURL

func GetBaseURL(ctx context.Context) string

GetBaseURL returns the request base URL previously attached by the route adapter.

func LFSRequestMiddleware

func LFSRequestMiddleware(opts Options) lfsapi.StrictMiddlewareFunc

LFSRequestMiddleware applies the legacy per-operation media and limiter checks before generated strict decoding invokes the handler.

func RegisterLFSRoutes

func RegisterLFSRoutes(router fiber.Router, deps Dependencies, opts ...Options)

func ResetLFSLimitersForTest

func ResetLFSLimitersForTest()

ResetLFSLimitersForTest clears the process-global limiter windows.

func ValidateLFSMetadataHeaders

func ValidateLFSMetadataHeaders(c fiber.Ctx) bool

ValidateLFSMetadataHeaders accepts both content types supported by the generated metadata request decoder. The other LFS operations require the vendor media type exclusively.

func ValidateLFSRequestHeaders

func ValidateLFSRequestHeaders(c fiber.Ctx, requireAccept, requireContentType bool) bool

ValidateLFSRequestHeaders validates the media contract for a strict LFS operation. It intentionally accepts */* for clients that use a generic Accept header.

func WithBaseURL

func WithBaseURL(ctx context.Context, baseURL string) context.Context

WithBaseURL attaches the Fiber request base URL to a request context.

func WriteLFSError

func WriteLFSError(c fiber.Ctx, status int, message string, challenge bool) error

WriteLFSError presents the generated Git LFS error shape and protocol media type while retaining request-id and optional Basic challenge headers.

Types

type Dependencies

type Dependencies struct {
	ObjectService   *objectrecords.Service
	TransferService *transfers.Service
	PendingStore    transferlfs.PendingStore
	FileCounters    usage.FileCounterRecorder
	Credentials     buckets.CredentialReader
	PartUploader    PartUploader
}

type LFSServer

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

func NewLFSServer

func NewLFSServer(deps Dependencies, opts Options) *LFSServer

func (*LFSServer) LfsBatch

func (*LFSServer) LfsVerify

type Options

type Options struct {
	MaxBatchObjects              int
	MaxBatchBodyBytes            int64
	RequestLimitPerMinute        int
	BandwidthLimitBytesPerMinute int64
}

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns the historical Git LFS limits.

type PartUploader

type PartUploader func(context.Context, string, []byte) (string, error)

PartUploader performs one provider PUT for a signed multipart part and returns the provider's opaque ETag. The default is storage.UploadSignedMultipartPart. Focused tests may inject another function.

Jump to

Keyboard shortcuts

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