git_lfs_transfer/config.rs
1use std::time::Duration;
2
3/// Tunables for the transfer queue.
4///
5/// Defaults aim at "sensible for a developer laptop on a corporate VPN" —
6/// not too aggressive on concurrency, generous retries for flaky links.
7/// Upstream Git LFS scales `concurrency` to CPU count (commit `aa08c37f`);
8/// we hard-code 8 for v0 and let callers override.
9#[derive(Debug, Clone)]
10pub struct TransferConfig {
11 /// Max number of concurrent in-flight transfers.
12 pub concurrency: usize,
13 /// Total attempts per object — including the first. So 3 means "try
14 /// once, then up to 2 retries".
15 pub max_attempts: u32,
16 /// Sleep before the first retry. Doubled before each subsequent retry,
17 /// capped at [`backoff_max`](Self::backoff_max).
18 pub initial_backoff: Duration,
19 /// Upper bound for exponential backoff between retries.
20 pub backoff_max: Duration,
21}
22
23impl Default for TransferConfig {
24 fn default() -> Self {
25 Self {
26 concurrency: 8,
27 max_attempts: 3,
28 initial_backoff: Duration::from_millis(100),
29 backoff_max: Duration::from_secs(30),
30 }
31 }
32}