mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-22 09:14:25 +08:00
refactor(launcher): add DI, IUpdateEngine facade, and architecture tests
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
18
LanMountainDesktop.Launcher/Update/IUpdateEngine.cs
Normal file
18
LanMountainDesktop.Launcher/Update/IUpdateEngine.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using LanMountainDesktop.Launcher.Models;
|
||||
|
||||
namespace LanMountainDesktop.Launcher.Update;
|
||||
|
||||
internal interface IUpdateEngine
|
||||
{
|
||||
LauncherResult CheckPendingUpdate();
|
||||
|
||||
Task<LauncherResult> DownloadAsync(string manifestUrl, string signatureUrl, string archiveUrl, CancellationToken cancellationToken);
|
||||
|
||||
Task<LauncherResult> ApplyPendingUpdateAsync();
|
||||
|
||||
LauncherResult RollbackLatest();
|
||||
|
||||
void CleanupDestroyedDeployments();
|
||||
|
||||
void CleanupIncomingArtifacts();
|
||||
}
|
||||
@@ -6,7 +6,7 @@ using ContractsUpdate = LanMountainDesktop.Shared.Contracts.Update;
|
||||
|
||||
namespace LanMountainDesktop.Launcher.Update;
|
||||
|
||||
internal sealed class UpdateEngineService
|
||||
internal sealed class UpdateEngineFacade : IUpdateEngine
|
||||
{
|
||||
private const string UpdateDirectoryName = "update";
|
||||
private const string IncomingDirectoryName = "incoming";
|
||||
@@ -28,7 +28,7 @@ internal sealed class UpdateEngineService
|
||||
private readonly string _snapshotsRoot;
|
||||
private readonly string _installCheckpointPath;
|
||||
|
||||
public UpdateEngineService(DeploymentLocator deploymentLocator, IUpdateProgressReporter? progressReporter = null)
|
||||
public UpdateEngineFacade(DeploymentLocator deploymentLocator, IUpdateProgressReporter? progressReporter = null)
|
||||
{
|
||||
_deploymentLocator = deploymentLocator;
|
||||
_progressReporter = progressReporter ?? new NullUpdateProgressReporter();
|
||||
@@ -1674,7 +1674,7 @@ internal sealed class UpdateEngineService
|
||||
|
||||
private sealed record RollbackAttemptResult(bool Success, string? ErrorMessage);
|
||||
|
||||
internal void CleanupIncomingArtifacts()
|
||||
public void CleanupIncomingArtifacts()
|
||||
{
|
||||
foreach (var path in new[]
|
||||
{
|
||||
Reference in New Issue
Block a user