Cleaned up interfaces. Extracted server state machine trigger handler to seperated classes. Removed legacy code

This commit is contained in:
2025-09-06 15:34:35 +02:00
parent 7587a7e8e3
commit 348e9560ab
97 changed files with 1256 additions and 4670 deletions

View File

@@ -0,0 +1,50 @@
namespace MoonlightServers.Daemon.ServerSystem.Interfaces;
public interface IInstallation : IServerComponent
{
/// <summary>
/// Checks if the installation environment exists. It doesn't matter if it is currently running or not
/// </summary>
/// <returns>True if it exists, False if it doesn't</returns>
public Task<bool> CheckExistsAsync();
/// <summary>
/// Creates the installation environment
/// </summary>
/// <param name="runtimePath">The host path of the runtime storage location</param>
/// <param name="hostPath">The host path of the installation file system</param>
/// <returns></returns>
public Task CreateAsync(string runtimePath, string hostPath);
/// <summary>
/// Starts the installation
/// </summary>
/// <returns></returns>
public Task StartAsync();
/// <summary>
/// Kills the current installation immediately
/// </summary>
/// <returns></returns>
public Task KillAsync();
/// <summary>
/// Removes the installation. E.g. removes the docker container
/// </summary>
/// <returns></returns>
public Task DestroyAsync();
/// <summary>
/// Subscribes to the event when the installation exists
/// </summary>
/// <param name="callback">The callback to invoke whenever the installation exists</param>
/// <returns>Subscription disposable to unsubscribe from the event</returns>
public Task<IAsyncDisposable> SubscribeExited(Func<int, Task> callback);
/// <summary>
/// Connects an existing installation to this abstraction in order to restore it.
/// E.g. fetching the container id and using it for exit events
/// </summary>
/// <returns></returns>
public Task RestoreAsync();
}