Skip to main content

Module path

Module path 

Source
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§

GenerationPool
An HTTP client whose connection pool belongs to one path generation.
HeldAdvice
Server advice as the plan reads it: the advice and how long ago it arrived.
LinkBehaviour
What the AdverseDetector has observed of the link: the resets and stalls it counts.
PathGeneration
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.
PathMonitor
The current path, the link behaviour observed on it, and the plan they make, shared by everything that transfers.
PathSample
One sample of the path as a platform reports it, before the monitor stamps a generation.
PathSnapshot
The normalized path: the latest sample, stamped with its generation.
TransferPlan
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.
PathCost
What the OS says the path costs. constrained is the OS data saver (iOS Low Data Mode, Android Data Saver) and wins over a merely metered link.
PathInterface
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.
PathUpdate
What one PathMonitor::observe changed.
PowerState
The device’s power source.
Reachability
Whether the OS reports a usable path at all.
ThermalState
The device’s thermal state, in the OS’s four steps (iOS ProcessInfo.ThermalState, Android PowerManager thermal status folded into the same four).
TierAdmission
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’s advice, and the client’s compiled window bounds. Pure: the same inputs always plan the same.