namespace MoonlightServers.Daemon.ServerSystem.Interfaces; public interface IRuntime : IServerComponent { /// /// Checks if the runtime does exist. This includes already running instances /// /// True if it exists, False if it doesn't public Task CheckExistsAsync(); /// /// Creates the runtime with the specified path as the storage path where the server files should be stored in /// /// Path where the server files are located /// public Task CreateAsync(string path); /// /// Starts the runtime. This requires to be called before this function /// /// public Task StartAsync(); /// /// Performs a live update on the runtime. When this method is called the current server configuration has already been updated /// /// public Task UpdateAsync(); /// /// Kills the current runtime immediately /// /// public Task KillAsync(); /// /// Destroys the runtime. When implemented using docker this would remove the container used for hosting the runtime /// /// public Task DestroyAsync(); /// /// This subscribes to the exited event of the runtime /// /// Callback gets invoked whenever the runtime exites /// Subscription disposable to unsubscribe from the event public Task SubscribeExitedAsync(Func callback); /// /// Connects an existing runtime to this abstraction in order to restore it. /// E.g. fetching the container id and using it for exit events /// /// public Task RestoreAsync(); }