Expand description
Rolling-window transfer rate and ETA for long-running jobs (downloads, conversions, model loads).
Written from a behavioural description, not from any reference
implementation – see docs/plans/ferrox-ui.md.
The whole point is what it refuses to say. Rate is
bytes_delta / time_delta, and on the very first tick time_delta
is a millisecond or two of a buffered write, which divides out to
“123 GB/s” and flashes it at the user before settling. So:
- a rate is reported only once the window holds at least
MIN_SAMPLESsamples spanning at leastMIN_SPAN_MS; before that the report isstable == falseand carries no number at all, which makes the flash structurally impossible rather than merely unlikely; - a byte counter that goes backwards (a resumed or restarted transfer) clears the window instead of producing a negative rate;
- ETA is clamped at zero, because a total that is smaller than the bytes already seen is a metadata bug, not a negative remaining time.
Time is passed in as milliseconds rather than read from a clock, so the behaviour is testable without sleeping.
Structs§
- Rate
Estimator - Rolling window of
(timestamp, cumulative bytes)observations. - Rate
Report - What the UI may display.
bytes_per_secondandeta_secondsareSomeonly whenstableis true.
Constants§
- MIN_
SAMPLES - Samples required before a rate is trusted.
- MIN_
SPAN_ MS - Milliseconds the window must span before a rate is trusted.
- WINDOW_
MS - Samples older than this are dropped, so a rate reflects the recent past rather than the average since the job started.