pub enum DownloadEvent {
QueueSnapshot {
items: Vec<DownloadSummary>,
max_size: u32,
},
DownloadStarted {
id: String,
shard_index: Option<u32>,
total_shards: Option<u32>,
},
DownloadProgress {
id: String,
downloaded: u64,
total: u64,
speed_bps: Option<f64>,
eta_seconds: Option<f64>,
percentage: f64,
},
ShardProgress {
id: String,
shard_index: u32,
total_shards: u32,
shard_filename: String,
shard_downloaded: u64,
shard_total: u64,
aggregate_downloaded: u64,
aggregate_total: u64,
speed_bps: Option<f64>,
eta_seconds: Option<f64>,
percentage: f64,
},
DownloadCompleted {
id: String,
message: Option<String>,
},
DownloadFailed {
id: String,
error: String,
},
DownloadCancelled {
id: String,
},
DownloadStatusChanged {
id: String,
status: DownloadStatus,
},
DownloadNotice {
id: String,
message: String,
},
QueueRunComplete {
summary: QueueRunSummary,
},
}Expand description
Single discriminated union for all download events.
The frontend handles this as a TypeScript discriminated union:
type DownloadEvent =
| { type: "queue_snapshot"; items: DownloadSummary[]; max_size: number }
| { type: "download_started"; id: string; shard_index?: number; total_shards?: number }
| { type: "download_progress"; id: string; downloaded: number; total: number;
speed_bps?: number; eta_seconds?: number; percentage: number }
| { type: "shard_progress"; id: string; shard_index: number;
speed_bps?: number; eta_seconds?: number; ... }
| { type: "download_completed"; id: string }
| { type: "download_failed"; id: string; error: string }
| { type: "download_cancelled"; id: string }
| { type: "download_notice"; id: string; message: string };speed_bps and eta_seconds are optional and omitted when unknown — a
download that has just started has no meaningful rate yet. Renderers must
show a placeholder for the absent case rather than substituting 0, and
must never compute a rate of their own from successive downloaded values;
the manager’s RateEstimator is the only source. The mirrored TypeScript
declaration lives in src/services/transport/types/events.ts.
Variants§
QueueSnapshot
Snapshot of the entire queue state.
Fields
items: Vec<DownloadSummary>All items currently in the queue.
DownloadStarted
A download has started.
Fields
DownloadProgress
Progress update for a non-sharded download.
Fields
ShardProgress
Progress update for a sharded download.
Fields
DownloadCompleted
Download completed successfully.
DownloadFailed
Download failed with an error.
Fields
DownloadCancelled
Download was cancelled by the user.
DownloadStatusChanged
Lifecycle status transition for a download (e.g.
Downloading → Finalizing → Registering).
Emitted at the boundaries between phases so transports can render a
non-frozen state while the manager is verifying bytes and writing the
model row to the database. Terminal states (Completed, Failed,
Cancelled) keep their dedicated event variants.
DownloadNotice
A transient, human-readable note about work happening for this download that produces no byte progress of its own — e.g. building the first-run Python environment for the fast downloader.
Unlike Self::DownloadStatusChanged this carries free-form text
rather than a fixed DownloadStatus and is not persisted; it exists
purely so the renderer has something to show instead of looking
frozen while setup work happens before the first progress event.
Fields
QueueRunComplete
Queue run completed (all downloads in the queue finished).
Emitted when the download queue transitions from busy → idle, providing a complete summary of all artifacts that were processed during the run.
Fields
summary: QueueRunSummaryComplete summary of the queue run.
Implementations§
Source§impl DownloadEvent
impl DownloadEvent
Sourcepub const fn queue_snapshot(items: Vec<DownloadSummary>, max_size: u32) -> Self
pub const fn queue_snapshot(items: Vec<DownloadSummary>, max_size: u32) -> Self
Create a queue snapshot event.
Sourcepub fn started_shard(
id: impl Into<String>,
shard_index: u32,
total_shards: u32,
) -> Self
pub fn started_shard( id: impl Into<String>, shard_index: u32, total_shards: u32, ) -> Self
Create a download started event with shard information.
Sourcefn percent_of(downloaded: u64, total: u64) -> f64
fn percent_of(downloaded: u64, total: u64) -> f64
Percentage complete, clamped to 0-100.
Sourcepub fn progress(
id: impl Into<String>,
downloaded: u64,
total: u64,
speed_bps: Option<f64>,
eta_seconds: Option<f64>,
) -> Self
pub fn progress( id: impl Into<String>, downloaded: u64, total: u64, speed_bps: Option<f64>, eta_seconds: Option<f64>, ) -> Self
Create a non-sharded progress event.
speed_bps and eta_seconds come from the manager’s
RateEstimator — this constructor
deliberately does not derive an ETA of its own. Two estimators for one
number is how the CLI and the GUI ended up disagreeing.
Sourcepub fn shard_progress(
id: impl Into<String>,
shard_index: u32,
total_shards: u32,
shard_filename: impl Into<String>,
shard_downloaded: u64,
shard_total: u64,
aggregate_downloaded: u64,
aggregate_total: u64,
speed_bps: Option<f64>,
eta_seconds: Option<f64>,
) -> Self
pub fn shard_progress( id: impl Into<String>, shard_index: u32, total_shards: u32, shard_filename: impl Into<String>, shard_downloaded: u64, shard_total: u64, aggregate_downloaded: u64, aggregate_total: u64, speed_bps: Option<f64>, eta_seconds: Option<f64>, ) -> Self
Create a sharded progress event.
See progress on where the rate values come from.
Sourcepub fn completed(
id: impl Into<String>,
message: Option<impl Into<String>>,
) -> Self
pub fn completed( id: impl Into<String>, message: Option<impl Into<String>>, ) -> Self
Create a download completed event.
Sourcepub fn failed(id: impl Into<String>, error: impl Into<String>) -> Self
pub fn failed(id: impl Into<String>, error: impl Into<String>) -> Self
Create a download failed event.
Sourcepub fn status_changed(id: impl Into<String>, status: DownloadStatus) -> Self
pub fn status_changed(id: impl Into<String>, status: DownloadStatus) -> Self
Create a status-changed event for non-terminal lifecycle transitions.
Sourcepub const fn queue_run_complete(summary: QueueRunSummary) -> Self
pub const fn queue_run_complete(summary: QueueRunSummary) -> Self
Create a queue run complete event.
Sourcepub const fn event_name(&self) -> &'static str
pub const fn event_name(&self) -> &'static str
Get the event name for wire protocols.
This provides consistent event naming for Tauri and SSE transports.
Note: Both ShardProgress and DownloadProgress use “download:progress”
as the channel name; differentiation happens via the type discriminator.
Trait Implementations§
Source§impl Clone for DownloadEvent
impl Clone for DownloadEvent
Source§fn clone(&self) -> DownloadEvent
fn clone(&self) -> DownloadEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more