Skip to main content

git_lfs_transfer/
lib.rs

1//! Concurrent transfer queue and basic adapter for Git LFS uploads and downloads.
2//!
3//! When Git LFS wants to transfer files between a client and a
4//! server, it first asks the server's batch endpoint with a list
5//! of OIDs and sizes for the files involved, and the server
6//! returns one URL per object (typically a presigned link to S3
7//! or a CDN, plus auth headers and an expiry window); the client
8//! then PUTs or GETs the bytes against those URLs.
9//!
10//! This crate implements the client side of that dance. It sits
11//! between [`git_lfs_api`] and [`git_lfs_store`]: given a list of
12//! `(oid, size)` pairs, [`Transfer`] negotiates the batch, drives
13//! the per-object byte movement concurrently, and streams
14//! [`Event`]s back to the caller.
15//!
16//! [`Transfer`] runs at most [`TransferConfig::concurrency`]
17//! transfers in flight at once. Each transfer uses its own retry
18//! loop with exponential backoff per [`TransferConfig`]. Outcomes
19//! land in a [`Report`] keyed by OID; per-object [`TransferError`]s
20//! sit alongside successful OIDs so partial failures don't tear
21//! down the queue.
22//!
23//! [`git_lfs_store::Store`] is a synchronous API while transfers
24//! are async. Downloads pipe HTTP body bytes through
25//! `tokio_util::io::SyncIoBridge` into a `spawn_blocking` task
26//! that calls `store.insert_verified`, so the full object is
27//! never buffered in memory and the async runtime isn't blocked
28//! while a multi-gigabyte object lands.
29//!
30//! Only the `basic` HTTPS transfer is implemented at the moment
31//! (see the [basic-transfers spec][spec]). The `tus`,
32//! custom-transfer-agent, and pure-SSH adapters are not
33//! implemented yet.
34//!
35//! [`git_lfs_api`]: https://docs.rs/git-lfs-api
36//! [`git_lfs_store`]: https://docs.rs/git-lfs-store
37//! [spec]: https://gitlab.com/rustutils/git-lfs/-/blob/master/docs/api/basic-transfers.md
38
39mod basic;
40mod config;
41mod error;
42mod event;
43mod transfer;
44
45pub use config::{TransferConfig, UrlRewriter};
46pub use error::{Report, TransferError};
47pub use event::Event;
48pub use transfer::Transfer;