fast_pull/base/event.rs
1//! Download lifecycle events emitted on the
2//! [`event_chain`](crate::DownloadResult::event_chain).
3
4use crate::ProgressEntry;
5
6/// Numeric identifier assigned to each worker thread/task.
7pub type WorkerId = usize;
8
9/// Events emitted during a download session, received via [`DownloadResult::event_chain`](crate::DownloadResult::event_chain).
10///
11/// Each variant records a state change: pulling, pushing, progress, errors, or completion.
12#[derive(Debug)]
13pub enum Event<PullError, PushError> {
14 Pulling(WorkerId),
15 PullError(WorkerId, PullError),
16 PullTimeout(WorkerId),
17 PullProgress(WorkerId, ProgressEntry),
18 Pushing(WorkerId, ProgressEntry),
19 PushError(WorkerId, ProgressEntry, PushError),
20 PushProgress(ProgressEntry),
21 Flushing,
22 FlushError(PushError),
23 Finished(WorkerId),
24}