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).Quantizationmodels Unsloth Dynamic (“UD-”) quants (e.g.UD-Q6_K) as distinct values from their plain counterparts (Q6_K), sinceHuggingFacerepos frequently publish both with the same bit-depth suffix.events- Download events and status types (DownloadEvent,DownloadStatus).DownloadEvent::DownloadNoticeis 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. UnlikeDownloadStatusChanged, it carries arbitrary text rather than a fixedDownloadStatus, and the next progress or status event overwrites it.errors- Error types for download operationsqueue- Queue snapshot DTOs (QueueSnapshot,QueuedDownload,FailedDownload)completion- Queue run completion tracking typesrate-RateEstimator, the single owner of download speed and ETA math. Decays bytes and elapsed time separately sohf-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.throttle-ProgressThrottle, the emission rate limiter that runs with the estimator. FeedRateEstimatorevery tick; throttle only what you send. Two callers: the native download executor ingglib-download, and the llama.cpp pre-built install pipeline ingglib-runtime, which rate-limits itsLlamaProgressEventchannel the same way.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 byindicatif’sHumanBytes. Mirrored exactly byformatRate/formatDurationinsrc/utils/format.ts.
Modules
| Module | LOC | Complexity | Coverage |
|---|---|---|---|
completion.rs | |||
errors.rs | |||
events.rs | |||
format.rs | |||
queue.rs | |||
rate.rs | |||
throttle.rs | |||
types.rs |
Re-exports§
pub use queue::FailedDownload;pub use queue::QueueSnapshot;pub use queue::QueuedDownload;
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.
- throttle 🔒
- Progress throttling.
- types 🔒
- Core domain types for downloads.
Structs§
- Attempt
Counts - Counts of attempts by result kind.
- Completion
Detail - Details for a single completed artifact in a queue run.
- Download
Id - Canonical identifier for a download.
- Download
Summary - A summary of a download in the queue (for snapshots and API responses).
- Progress
Throttle - Rate-limiter for progress updates.
- Queue
RunSummary - Summary of an entire queue run from start to drain.
- Rate
Estimator - Time-decayed estimate of download throughput and time remaining.
- Shard
Info - Information about a shard within a sharded model download.
Enums§
- Completion
Key - Stable artifact identity for completion tracking.
- Completion
Kind - Result kind for a completion attempt.
- Download
Error - Error type for download operations.
- Download
Event - Single discriminated union for all download events.
- Download
Status - Status of a download.
- Quantization
- Represents the quantization type of a GGUF model file.
Functions§
- format_
duration - Format a duration in seconds as
45s,3m 20sor1h 04m. - format_
rate - Format a transfer rate in decimal units, e.g.
118.4 MB/s.