Skip to main content

Crate git_lfs_transfer

Crate git_lfs_transfer 

Source
Expand description

Concurrent transfer queue and basic adapter for Git LFS uploads and downloads.

When Git LFS wants to transfer files between a client and a server, it first asks the server’s batch endpoint with a list of OIDs and sizes for the files involved, and the server returns one URL per object (typically a presigned link to S3 or a CDN, plus auth headers and an expiry window); the client then PUTs or GETs the bytes against those URLs.

This crate implements the client side of that dance. It sits between git_lfs_api and git_lfs_store: given a list of (oid, size) pairs, Transfer negotiates the batch, drives the per-object byte movement concurrently, and streams Events back to the caller.

Transfer runs at most TransferConfig::concurrency transfers in flight at once. Each transfer uses its own retry loop with exponential backoff per TransferConfig. Outcomes land in a Report keyed by OID; per-object TransferErrors sit alongside successful OIDs so partial failures don’t tear down the queue.

git_lfs_store::Store is a synchronous API while transfers are async. Downloads pipe HTTP body bytes through tokio_util::io::SyncIoBridge into a spawn_blocking task that calls store.insert_verified, so the full object is never buffered in memory and the async runtime isn’t blocked while a multi-gigabyte object lands.

Only the basic HTTPS transfer is implemented at the moment (see the basic-transfers spec). The tus, custom-transfer-agent, and pure-SSH adapters are not implemented yet.

Structs§

Report
Aggregate outcome of a transfer batch.
Transfer
Concurrent transfer queue. One Transfer is bound to one LFS endpoint (the api client) and one local store; create more if you need more.
TransferConfig
Tunables for the transfer queue.

Enums§

Event
Per-object lifecycle events emitted by Transfer::download and Transfer::upload.
TransferError
Why a per-object transfer failed.

Type Aliases§

UrlRewriter
Optional URL transform applied to every action href returned by the batch endpoint before the transfer adapter dials it.