pub struct Upgrader { /* private fields */ }Expand description
Upgrade orchestrator with rollback support.
Handles the complete upgrade lifecycle:
- Validate upgrade (prevent downgrade)
- Download new binary and signature
- Verify ML-DSA-65 signature
- Create backup of current binary
- Atomic replacement
- Rollback on failure
Implementations§
Source§impl Upgrader
impl Upgrader
Sourcepub fn current_version(&self) -> &Version
pub fn current_version(&self) -> &Version
Get the current version.
Sourcepub fn validate_upgrade(&self, info: &UpgradeInfo) -> Result<()>
pub fn validate_upgrade(&self, info: &UpgradeInfo) -> Result<()>
Validate that the upgrade is allowed (prevents downgrade).
§Errors
Returns an error if the target version is older than or equal to current.
Sourcepub async fn perform_upgrade(
&self,
info: &UpgradeInfo,
current_binary: &Path,
rollback_dir: &Path,
) -> Result<UpgradeResult>
pub async fn perform_upgrade( &self, info: &UpgradeInfo, current_binary: &Path, rollback_dir: &Path, ) -> Result<UpgradeResult>
Perform upgrade with rollback support.
This is the main upgrade entry point. It:
- Validates the upgrade (prevents downgrade)
- Creates a backup of the current binary
- Downloads the new binary and signature
- Verifies the ML-DSA-65 signature
- Atomically replaces the binary
- Rolls back on any failure
§Arguments
info- Information about the upgrade to performcurrent_binary- Path to the currently running binaryrollback_dir- Directory to store backup for rollback
§Errors
Returns an error only if both the upgrade AND rollback fail (critical).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Upgrader
impl !RefUnwindSafe for Upgrader
impl Send for Upgrader
impl Sync for Upgrader
impl Unpin for Upgrader
impl UnsafeUnpin for Upgrader
impl !UnwindSafe for Upgrader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more