haki_dl/progress.rs
1//! Progress counters used by events and API callbacks.
2
3/// Aggregate progress counters across a request.
4#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
5pub struct AggregateProgress {
6 /// Downloaded bytes across all active streams.
7 pub downloaded_bytes: u64,
8 /// Expected total bytes when known.
9 pub total_bytes: Option<u64>,
10 /// Current aggregate bytes per second.
11 pub bytes_per_second: u64,
12}
13
14/// Per-stream progress counters.
15#[derive(Clone, Debug, Default, Eq, PartialEq)]
16pub struct StreamProgress {
17 /// Stable stream identifier within the session.
18 pub stream_id: String,
19 /// Downloaded bytes for this stream.
20 pub downloaded_bytes: u64,
21 /// Expected stream bytes when known.
22 pub total_bytes: Option<u64>,
23 /// Current stream bytes per second.
24 pub bytes_per_second: u64,
25 /// Number of consecutive low-speed ticks observed by the compatibility speed state.
26 pub low_speed_count: u32,
27 /// Completed segment count.
28 pub completed_segments: u64,
29 /// Expected segment count when known.
30 pub total_segments: Option<u64>,
31}
32
33/// Per-segment progress counters.
34#[derive(Clone, Debug, Eq, PartialEq)]
35pub struct SegmentProgress {
36 /// Stable stream identifier within the session.
37 pub stream_id: String,
38 /// Segment index within the stream.
39 pub segment_index: u64,
40 /// Downloaded segment bytes.
41 pub downloaded_bytes: u64,
42 /// Expected segment bytes when known.
43 pub total_bytes: Option<u64>,
44 /// Current stream bytes per second.
45 pub bytes_per_second: u64,
46 /// Number of consecutive low-speed ticks observed by the compatibility speed state.
47 pub low_speed_count: u32,
48 /// Current retry attempt.
49 pub retry_attempt: u32,
50}