Finished cleanup of the server system

This commit is contained in:
2025-05-30 22:42:04 +02:00
parent b955bd3527
commit 4fdcc7aff1
3 changed files with 100 additions and 63 deletions

View File

@@ -21,7 +21,7 @@ public class StorageSubSystem : ServerSubSystem
AppConfiguration = appConfiguration;
}
public override async Task Initialize()
public override Task Initialize()
{
Logger.LogDebug("Lazy initializing server file system");
@@ -42,6 +42,14 @@ public class StorageSubSystem : ServerSubSystem
Logger.LogError("An unhandled error occured while lazy initializing server file system: {e}", e);
}
});
return Task.CompletedTask;
}
public override async Task Delete()
{
await DeleteInstallVolume();
await DeleteRuntimeVolume();
}
#region Runtime
@@ -65,7 +73,7 @@ public class StorageSubSystem : ServerSubSystem
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
/*
var consoleSubSystem = Server.GetRequiredSubSystem<ConsoleSubSystem>();
await consoleSubSystem.WriteMoonlight("Creating virtual disk file. Please be patient");
@@ -77,7 +85,7 @@ public class StorageSubSystem : ServerSubSystem
await consoleSubSystem.WriteMoonlight("Mounting virtual disk. Please be patient");
await Task.Delay(TimeSpan.FromSeconds(3));
await consoleSubSystem.WriteMoonlight("Virtual disk ready");
await consoleSubSystem.WriteMoonlight("Virtual disk ready");*/
// TODO: Implement virtual disk
}
@@ -95,6 +103,16 @@ public class StorageSubSystem : ServerSubSystem
return Task.FromResult(path);
}
private async Task DeleteRuntimeVolume()
{
var path = await GetRuntimeHostPath();
if(!Directory.Exists(path))
return;
Directory.Delete(path, true);
}
#endregion
#region Installation