mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-20 23:54:26 +08:00
Introduce install checkpoint support and resume logic for updates, plus related locking and validation. Adds InstallCheckpoint model, AppJsonContext serialization, and UpdatePaths helpers for deployment lock, apply-in-progress lock and install-checkpoint path. UpdateEngineService gains checkpoint load/save/delete, incoming-state validation, resume logic for PLONDS and legacy updates, apply lock handling, and safer cleanup; ApplyPendingPlondsUpdateAsync and ApplyPendingUpdate flow updated accordingly. Add DeploymentLock contract and extend UpdateState with pause/resume/cancel helpers. Tests updated to cover stale/valid checkpoint resume and legacy/PLONDS flows. CI: enhance ddss-publish to detect release channel, validate S3 assets, prepare and atomically publish channel pointer; add ddss-rollback workflow to publish rollbacks; adjust plonds-build concurrency and release events.
97 lines
2.2 KiB
C#
97 lines
2.2 KiB
C#
namespace LanMountainDesktop.Shared.Contracts.Update;
|
|
|
|
public enum UpdatePhase
|
|
{
|
|
Idle,
|
|
Checking,
|
|
Checked,
|
|
Downloading,
|
|
PausedDownloading,
|
|
Downloaded,
|
|
Installing,
|
|
PausedInstalling,
|
|
Installed,
|
|
Verifying,
|
|
Completed,
|
|
Failed,
|
|
Recovering,
|
|
RollingBack,
|
|
RolledBack
|
|
}
|
|
|
|
public enum UpdatePayloadKind
|
|
{
|
|
DeltaPlonds,
|
|
DeltaLegacy,
|
|
FullInstaller
|
|
}
|
|
|
|
public enum InstallStage
|
|
{
|
|
None,
|
|
VerifySignature,
|
|
CreateTarget,
|
|
ApplyFiles,
|
|
VerifyHashes,
|
|
ActivateDeployment,
|
|
Cleanup,
|
|
Completed,
|
|
Failed,
|
|
RollingBack
|
|
}
|
|
|
|
public enum UpdateChannel
|
|
{
|
|
Stable,
|
|
Preview
|
|
}
|
|
|
|
public enum UpdateMode
|
|
{
|
|
Manual,
|
|
DownloadThenConfirm,
|
|
SilentOnExit
|
|
}
|
|
|
|
public enum UpdateDownloadSource
|
|
{
|
|
PlondsApi,
|
|
GitHub,
|
|
GhProxy
|
|
}
|
|
|
|
public static class UpdatePhaseExtensions
|
|
{
|
|
public static bool IsTerminal(this UpdatePhase phase) =>
|
|
phase is UpdatePhase.Completed or UpdatePhase.Failed or UpdatePhase.RolledBack;
|
|
|
|
public static bool IsBusy(this UpdatePhase phase) =>
|
|
phase is UpdatePhase.Checking or UpdatePhase.Downloading or UpdatePhase.Installing
|
|
or UpdatePhase.Verifying or UpdatePhase.Recovering or UpdatePhase.RollingBack;
|
|
|
|
public static bool CanCheck(this UpdatePhase phase) =>
|
|
phase is UpdatePhase.Idle or UpdatePhase.Checked or UpdatePhase.Downloaded
|
|
or UpdatePhase.Completed or UpdatePhase.Failed or UpdatePhase.RolledBack;
|
|
|
|
public static bool CanDownload(this UpdatePhase phase) =>
|
|
phase is UpdatePhase.Checked;
|
|
|
|
public static bool CanInstall(this UpdatePhase phase) =>
|
|
phase is UpdatePhase.Downloaded;
|
|
|
|
public static bool CanRollback(this UpdatePhase phase) =>
|
|
phase is UpdatePhase.Failed;
|
|
|
|
public static bool CanPause(this UpdatePhase phase) =>
|
|
phase is UpdatePhase.Downloading;
|
|
|
|
public static bool CanResume(this UpdatePhase phase) =>
|
|
phase is UpdatePhase.PausedDownloading or UpdatePhase.PausedInstalling;
|
|
|
|
public static bool CanCancel(this UpdatePhase phase) =>
|
|
phase.IsBusy() || phase.CanResume();
|
|
|
|
public static bool IsPaused(this UpdatePhase phase) =>
|
|
phase is UpdatePhase.PausedDownloading or UpdatePhase.PausedInstalling;
|
|
}
|