Skip to main content

prepare_deferred_upgrade

Function prepare_deferred_upgrade 

Source
pub async fn prepare_deferred_upgrade(
    current_version: &str,
    tx: UnboundedSender<UpgradeEvent>,
) -> Result<Option<PendingUpgrade>>
Expand description

Download + verify a new release into staged_dir() without touching the live binary. Writes pending.json as the final step so a partial download (crashed mid-stream) doesn’t masquerade as “ready to apply” — the pointer only appears if sha256 passed.

Returns Ok(None) when we’re already on the latest version (or newer). Idempotent: calling twice with the same manifest is a no-op after the first success (file + pointer already in place).