git_lfs_transfer/event.rs
1/// Per-object lifecycle events emitted by
2/// [`Transfer::download`](crate::Transfer::download) and
3/// [`Transfer::upload`](crate::Transfer::upload).
4///
5/// Sent on the optional [`tokio::sync::mpsc::UnboundedSender`] passed in
6/// by the caller. Order across objects is unspecified — events for one
7/// object are ordered (Started → Progress* → Completed | Failed).
8///
9/// `Failed` carries a stringified error so the typed
10/// [`TransferError`](crate::TransferError) can still be moved into
11/// [`Report`](crate::Report) — events are for display, the report is
12/// authoritative.
13#[derive(Debug, Clone)]
14pub enum Event {
15 /// Transfer for `oid` is about to start. `size` is the byte count the
16 /// server reported (or the local size, for uploads).
17 Started { oid: String, size: u64 },
18
19 /// `bytes_done` cumulative bytes have moved for this object so far.
20 /// May fire many times per object; consumers should treat values as
21 /// monotonically non-decreasing.
22 Progress { oid: String, bytes_done: u64 },
23
24 /// Transfer succeeded — for downloads, bytes are in the store and
25 /// hash-verified; for uploads, the server's verify callback (if any)
26 /// has returned 2xx.
27 Completed { oid: String },
28
29 /// Transfer failed after exhausting retries.
30 Failed { oid: String, error: String },
31}