Skip to main content

plan

Function plan 

Source
pub async fn plan(
    url: Url,
    partial_config: PartialConfig,
    tx: Tx,
    token: CancellationToken,
) -> Result<DownloadPlan, PlanError>
Expand description

Prepare a download without touching the filesystem.

Prefetches the remote metadata, resolves the output path, and inspects the .fd/.part pair that a previous run may have left behind. The returned DownloadPlan reports what starting it would do; nothing is created until it is started.

When overwrite is disabled the probe walks the name, name (1), name (2) … sequence looking for a resumable pair, and settles on the first unclaimed name. A pair whose state exists but fails validation is reported as ResumeOutcome::Mismatch instead of being skipped silently, so the caller can offer to force the resume.

§Errors

Returns PlanError when the client cannot be built, the prefetch exhausts its retries, or the output path cannot be computed.