Skip to main content

Module download

Module download 

Source
Expand description

§download

Download domain types, events, errors, and traits.

This module contains pure data types and trait definitions for the download system. No I/O, networking, or runtime dependencies allowed.

§Structure

  • types - Core identifiers and data structures (DownloadId, Quantization, ShardInfo). Quantization models Unsloth Dynamic (“UD-”) quants (e.g. UD-Q6_K) as distinct values from their plain counterparts (Q6_K), since HuggingFace repos frequently publish both with the same bit-depth suffix.
  • events - Download events and status types (DownloadEvent, DownloadStatus). DownloadEvent::DownloadNotice is the one variant that isn’t part of the progress/lifecycle state machine: a transient, non-persisted, free-form note (e.g. “preparing fast downloader…” while the first-run Python venv builds) for renderers to show in place of progress that doesn’t exist yet. Unlike DownloadStatusChanged, it carries arbitrary text rather than a fixed DownloadStatus, and the next progress or status event overwrites it.
  • errors - Error types for download operations
  • queue - Queue snapshot DTOs (QueueSnapshot, QueuedDownload, FailedDownload)
  • completion - Queue run completion tracking types
  • rate - RateEstimator, the single owner of download speed and ETA math. Decays bytes and elapsed time separately so hf-xet’s bursty on-disk writes do not spike the reported rate. Renderers display what it produces and must never re-derive a rate from byte deltas.
  • format - format_rate / format_duration. Rates are decimal (1 MB/s = 1,000,000 B/s) to match what a system network monitor reports; sizes stay binary and are rendered by indicatif’s HumanBytes. Mirrored exactly by formatRate / formatDuration in src/utils/format.ts.

Modules

Re-exports§

pub use completion::AttemptCounts;
pub use completion::CompletionDetail;
pub use completion::CompletionKey;
pub use completion::CompletionKind;
pub use completion::QueueRunSummary;
pub use errors::DownloadError;
pub use errors::DownloadResult;
pub use events::DownloadEvent;
pub use events::DownloadStatus;
pub use events::DownloadSummary;
pub use format::format_duration;
pub use format::format_rate;
pub use queue::FailedDownload;
pub use queue::QueueSnapshot;
pub use queue::QueuedDownload;
pub use rate::RateEstimator;
pub use types::DownloadId;
pub use types::Quantization;
pub use types::ShardInfo;

Modules§

completion
Queue run completion tracking types.
errors
Download error types.
events
Download events - discriminated union for all download state changes.
format
Display formatting for download rates and durations.
queue
Queue DTOs for API responses and snapshots.
rate
Time-decayed download rate and ETA estimation.
types
Core domain types for downloads.