Updated to latest moonlight and mooncore version. Done refactoring to async scheme and other changes. Recreated database migrations and cleaned models

This commit is contained in:
2025-09-22 12:13:57 +02:00
parent 91fb15a03e
commit 85392208c4
150 changed files with 2722 additions and 2726 deletions

View File

@@ -57,17 +57,17 @@ public class DockerConsole : IConsole
{
var containerName = string.Format(DockerConstants.RuntimeNameTemplate, Context.Configuration.Id);
await AttachToContainer(containerName);
await AttachToContainerAsync(containerName);
}
public async Task AttachInstallationAsync()
{
var containerName = string.Format(DockerConstants.InstallationNameTemplate, Context.Configuration.Id);
await AttachToContainer(containerName);
await AttachToContainerAsync(containerName);
}
private async Task AttachToContainer(string containerName)
private async Task AttachToContainerAsync(string containerName)
{
var cts = new CancellationTokenSource();
@@ -171,17 +171,17 @@ public class DockerConsole : IConsole
{
var containerName = string.Format(DockerConstants.RuntimeNameTemplate, Context.Configuration.Id);
await FetchFromContainer(containerName);
await FetchFromContainerAsync(containerName);
}
public async Task FetchInstallationAsync()
{
var containerName = string.Format(DockerConstants.InstallationNameTemplate, Context.Configuration.Id);
await FetchFromContainer(containerName);
await FetchFromContainerAsync(containerName);
}
private async Task FetchFromContainer(string containerName)
private async Task FetchFromContainerAsync(string containerName)
{
var logStream = await DockerClient.Containers.GetContainerLogsAsync(containerName, true, new()
{

View File

@@ -104,7 +104,7 @@ public class DockerInstallation : IInstallation
// Docker image
await Reporter.StatusAsync("Downloading docker image");
await ImageService.Download(data.DockerImage, async status => { await Reporter.StatusAsync(status); });
await ImageService.DownloadAsync(data.DockerImage, async status => { await Reporter.StatusAsync(status); });
await Reporter.StatusAsync("Downloaded docker image");
@@ -159,7 +159,7 @@ public class DockerInstallation : IInstallation
}
}
public async Task<IAsyncDisposable> SubscribeExited(Func<int, ValueTask> callback)
public async Task<IAsyncDisposable> SubscribeExitedAsync(Func<int, ValueTask> callback)
=> await ExitEventSource.SubscribeAsync(callback);
public async Task RestoreAsync()

View File

@@ -96,7 +96,7 @@ public class DockerRuntime : IRuntime
// Docker image
await Reporter.StatusAsync("Downloading docker image");
await ImageService.Download(
await ImageService.DownloadAsync(
Context.Configuration.DockerImage,
async status => { await Reporter.StatusAsync(status); }
);
@@ -152,7 +152,7 @@ public class DockerRuntime : IRuntime
}
}
public async Task<IAsyncDisposable> SubscribeExited(Func<int, ValueTask> callback)
public async Task<IAsyncDisposable> SubscribeExitedAsync(Func<int, ValueTask> callback)
=> await ExitEventSource.SubscribeAsync(callback);
public async Task RestoreAsync()

View File

@@ -80,7 +80,7 @@ public class InstallationHandler : IServerStateHandler
await Server.Installation.CreateAsync(runtimePath, installationPath, installData);
if (ExitSubscription == null)
ExitSubscription = await Server.Installation.SubscribeExited(OnInstallationExited);
ExitSubscription = await Server.Installation.SubscribeExitedAsync(OnInstallationExited);
// 6. Attach console

View File

@@ -58,7 +58,7 @@ public class StartupHandler : IServerStateHandler
await Server.Runtime.CreateAsync(hostPath);
if (ExitSubscription == null)
ExitSubscription = await Server.Runtime.SubscribeExited(OnRuntimeExited);
ExitSubscription = await Server.Runtime.SubscribeExitedAsync(OnRuntimeExited);
// 6. Attach console

View File

@@ -42,7 +42,7 @@ public interface IInstallation : IServerComponent
/// </summary>
/// <param name="callback">Callback to invoke whenever the installation exists</param>
/// <returns>Subscription disposable to unsubscribe from the event</returns>
public Task<IAsyncDisposable> SubscribeExited(Func<int, ValueTask> callback);
public Task<IAsyncDisposable> SubscribeExitedAsync(Func<int, ValueTask> callback);
/// <summary>
/// Connects an existing installation to this abstraction in order to restore it.

View File

@@ -44,7 +44,7 @@ public interface IRuntime : IServerComponent
/// </summary>
/// <param name="callback">Callback gets invoked whenever the runtime exites</param>
/// <returns>Subscription disposable to unsubscribe from the event</returns>
public Task<IAsyncDisposable> SubscribeExited(Func<int, ValueTask> callback);
public Task<IAsyncDisposable> SubscribeExitedAsync(Func<int, ValueTask> callback);
/// <summary>
/// Connects an existing runtime to this abstraction in order to restore it.

View File

@@ -1,5 +1,4 @@
using MoonlightServers.Daemon.Models.Cache;
using MoonlightServers.Daemon.ServerSystem.Interfaces;
namespace MoonlightServers.Daemon.ServerSystem.Models;

View File

@@ -1,4 +1,3 @@
using System.Collections;
using MoonlightServers.Daemon.ServerSystem.Enums;
using MoonlightServers.Daemon.ServerSystem.Interfaces;
using MoonlightServers.Daemon.ServerSystem.Models;