Expand description
The normalized path snapshot and the pure transfer plan (networking doc, Path Snapshot).
A platform shell (or the CLI’s flags) reports what it sees as a PathSample: cost,
reachability, interface, power, thermal state and how long the app may run. The
PathMonitor stamps each sample with a PathGeneration — which advances only when
reachability, interface or cost changes, never on a minor update — and keeps the latest
PathSnapshot.
plan_transfer is the whole of the policy: a pure function of the snapshot, the link
behaviour the AdverseDetector observed, the server’s advice, and the client’s compiled
window bounds. The server is never in the loop; its advice can only lower a window.
A new generation drops what belonged to the old path: the monitor resets its
AdverseDetector (resets on the old network say nothing about the new one), a
GenerationPool builds a fresh HTTP client so no pooled connection outlives its path, and
crate::staged::run_under_path cancels in-flight work the new plan forbids and re-plans.
Structs§
- Generation
Pool - An HTTP client whose connection pool belongs to one path generation.
- Held
Advice - Server advice as the plan reads it: the advice and how long ago it arrived.
- Link
Behaviour - What the
AdverseDetectorhas observed of the link: the resets and stalls it counts. - Path
Generation - Which path a snapshot belongs to. Advances by one each time reachability, interface or cost changes; everything planned or pooled under an older generation belongs to a path that is gone.
- Path
Monitor - The current path, the link behaviour observed on it, and the plan they make, shared by everything that transfers.
- Path
Sample - One sample of the path as a platform reports it, before the monitor stamps a generation.
- Path
Snapshot - The normalized path: the latest sample, stamped with its generation.
- Transfer
Plan - What the client does on the current path. Produced only by
plan_transfer.
Enums§
- Execution
- How the app is running.
- Hold
- Why the plan holds back work it would otherwise run.
- Path
Cost - What the OS says the path costs.
constrainedis the OS data saver (iOS Low Data Mode, Android Data Saver) and wins over a merely metered link. - Path
Interface - The kind of interface the path runs over. It plans nothing by itself — cost is what the OS reports about money — but a change of interface is a new path.
- Path
Update - What one
PathMonitor::observechanged. - Power
State - The device’s power source.
- Reachability
- Whether the OS reports a usable path at all.
- Thermal
State - The device’s thermal state, in the OS’s four steps (iOS
ProcessInfo.ThermalState, AndroidPowerManagerthermal status folded into the same four). - Tier
Admission - Which tiers the plan admits.
Constants§
- MIN_
BULK_ DEADLINE - The shortest background deadline bulk work starts under: one minute. A preview or original started with less is likely cut by the OS before it lands, so only the index tier — a few KB per asset — runs.
Functions§
- plan_
transfer - Plan transfers on
snapshot, given what the link has shown (link), the server’sadvice, and the client’s compiled windowbounds. Pure: the same inputs always plan the same.