Skip to main content

prefetch

Function prefetch 

Source
pub async fn prefetch(
    url: &Url,
    config: &Config,
    tx: &Tx,
) -> Result<(UrlInfo, Response), PlanError>
Expand description

Resolve the remote file’s metadata, retrying up to Config::retry_times.

On success emits Event::Prefetch and hands back the UrlInfo together with the open Response, which the download pipeline reuses to seed the first range request instead of paying for another round-trip.

§Errors

Retries that still have an attempt left are reported as Event::PrefetchError; the attempt that exhausts the budget is returned as PlanError::Prefetch instead, because ReqwestResponseError cannot be cloned into both places. A client that cannot be built at all is returned as PlanError::BuildClient without emitting an event.