Expand description
Upgrade command implementation — download, verify, swap, and rollback.
This module implements the rusty upgrade flow:
- Check manifest version compatibility (runtime vs. manifest
min_runtime_version) - Download new binary from release URL
- Verify binary integrity (SHA-256 checksum against published value)
- Swap binary with backup of previous version
- Run smoke test to verify the new binary works
- Rollback on smoke test failure
Supports interactive confirmation and non-interactive --yes mode.
Preserves cached remote manifest across upgrades.
Operationally separate from rusty update.
Structs§
- Download
Result - Download result for an upgrade artifact.
- Release
Info - Metadata about an available upgrade target.
- Upgrade
Options - Options controlling upgrade behavior.
- Upgrade
Result - Result of a successful upgrade operation.
- Version
Info - Version information for the current binary.
Enums§
- Upgrade
Error - Errors that can occur during the upgrade process.
- Upgrade
Status - Status of an upgrade attempt.
Traits§
- Binary
Downloader - Trait for binary download. Implementations provide the actual download or test fixture data.
- Release
Provider - Trait for release discovery. Implementations provide release info from a remote source or test fixture.
- Smoke
Tester - Trait for smoke-testing a binary. Implementations run the new binary and check that it starts correctly.
- User
Interactor - Trait for user interaction. Implementations provide interactive confirmation or auto-accept in non-interactive mode.
Functions§
- check_
schema_ compatibility - Check if the current runtime’s schema version can handle a manifest with the given schema version.
- check_
version_ compatibility - Check if
currentversion satisfies therequiredminimum version. ReturnsOk(())if compatible,Err(UpgradeError)if not. - compute_
checksum - Compute the SHA-256 checksum of a byte slice.
- create_
backup - Create a backup of the current binary.
- current_
binary_ path - Get the current binary path.
- default_
backup_ dir - Get the default backup directory path.
- default_
cached_ manifest_ path - Get the default cached manifest path.
- read_
cached_ manifest - Read the cached remote manifest bytes if present.
- rollback
- Rollback to a previous binary version.
- run_
upgrade - Run the full upgrade flow.
- swap_
binary - Swap the old binary with the new one.
- verify_
integrity - Verify that
datamatches the expected SHA-256checksum. - write_
cached_ manifest - Write the cached remote manifest bytes back (preservation after upgrade).