Skip to main content

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