Skip to main content

run_under_path

Function run_under_path 

Source
pub async fn run_under_path<T, F, Fut>(
    monitor: &PathMonitor,
    requested: UploadPolicy,
    force_sync: bool,
    attempt: F,
) -> T
where F: FnMut(StagedScheduler) -> Fut, Fut: Future<Output = T>,
Expand description

Run attempt under the scheduler monitor’s current plan allows, and re-plan when the path changes under it.

attempt is handed a StagedScheduler for requested (with force_sync) and drives the work under it — normally one push_bundle. Every change of plan the monitor publishes wakes this run in the same scheduling tick: when the new plan closes a tier the running scheduler opens, the running attempt is dropped there — cancelling its in-flight requests — and attempt runs again under the new plan. A change that closes nothing lets the attempt run on. Cancelled work resumes from server truth (create-dedup and HEAD offsets), so a cancel costs at most the bytes in flight.

Each re-run follows a plan that narrowed, so the loop moves only as fast as the path changes; it never spins on its own.