mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-27 23:17:20 +01:00
Further subdivision of the Components namespace
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
namespace Tgstation.Server.Host.Components.Byond
|
||||
{
|
||||
/// <inheritdoc />
|
||||
sealed class ByondExecutableLock : IByondExecutableLock
|
||||
+1
-4
@@ -1,16 +1,13 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Host.IO;
|
||||
|
||||
using MemoryStream = System.IO.MemoryStream;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
namespace Tgstation.Server.Host.Components.Byond
|
||||
{
|
||||
/// <inheritdoc />
|
||||
sealed class ByondManager : IByondManager
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
namespace Tgstation.Server.Host.Components.Byond
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents usage of the two primary BYOND server executables
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
namespace Tgstation.Server.Host.Components.Byond
|
||||
{
|
||||
/// <summary>
|
||||
/// For downloading and installing BYOND extractions for a given system
|
||||
+1
-1
@@ -3,7 +3,7 @@ using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
namespace Tgstation.Server.Host.Components.Byond
|
||||
{
|
||||
/// <summary>
|
||||
/// For managing the BYOND installation
|
||||
+1
-1
@@ -6,7 +6,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Host.IO;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
namespace Tgstation.Server.Host.Components.Byond
|
||||
{
|
||||
/// <summary>
|
||||
/// <see cref="IByondInstaller"/> for Posix systems
|
||||
+1
-1
@@ -7,7 +7,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Host.IO;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
namespace Tgstation.Server.Host.Components.Byond
|
||||
{
|
||||
/// <summary>
|
||||
/// <see cref="IByondInstaller"/> for windows systems
|
||||
+1
-1
@@ -8,7 +8,7 @@ using Tgstation.Server.Host.Core;
|
||||
using Tgstation.Server.Host.IO;
|
||||
using Tgstation.Server.Host.Models;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
namespace Tgstation.Server.Host.Components.Compiler
|
||||
{
|
||||
/// <summary>
|
||||
/// Standard <see cref="IDmbFactory"/>
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
using Tgstation.Server.Host.IO;
|
||||
using Tgstation.Server.Host.Models;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
namespace Tgstation.Server.Host.Components.Compiler
|
||||
{
|
||||
/// <inheritdoc />
|
||||
sealed class DmbProvider : IDmbProvider
|
||||
+12
-6
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -9,11 +10,13 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Api.Models;
|
||||
using Tgstation.Server.Api.Models.Internal;
|
||||
using Tgstation.Server.Host.Components.Byond;
|
||||
using Tgstation.Server.Host.Components.Repository;
|
||||
using Tgstation.Server.Host.Components.Watchdog;
|
||||
using Tgstation.Server.Host.Core;
|
||||
using Tgstation.Server.Host.IO;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
namespace Tgstation.Server.Host.Components.Compiler
|
||||
{
|
||||
/// <inheritdoc />
|
||||
sealed class DreamMaker : IDreamMaker
|
||||
@@ -47,9 +50,9 @@ namespace Tgstation.Server.Host.Components
|
||||
/// </summary>
|
||||
readonly IIOManager ioManager;
|
||||
/// <summary>
|
||||
/// The <see cref="IConfiguration"/> for <see cref="DreamMaker"/>
|
||||
/// The <see cref="StaticFiles.IConfiguration"/> for <see cref="DreamMaker"/>
|
||||
/// </summary>
|
||||
readonly IConfiguration configuration;
|
||||
readonly StaticFiles.IConfiguration configuration;
|
||||
/// <summary>
|
||||
/// The <see cref="ISessionControllerFactory"/> for <see cref="DreamMaker"/>
|
||||
/// </summary>
|
||||
@@ -82,7 +85,7 @@ namespace Tgstation.Server.Host.Components
|
||||
/// <param name="application">The value of <see cref="application"/></param>
|
||||
/// <param name="eventConsumer">The value of <see cref="eventConsumer"/></param>
|
||||
/// <param name="logger">The value of <see cref="logger"/></param>
|
||||
public DreamMaker(IByondManager byond, IIOManager ioManager, IConfiguration configuration, ISessionControllerFactory sessionControllerFactory, ICompileJobConsumer compileJobConsumer, IApplication application, IEventConsumer eventConsumer, ILogger<DreamMaker> logger)
|
||||
public DreamMaker(IByondManager byond, IIOManager ioManager, StaticFiles.IConfiguration configuration, ISessionControllerFactory sessionControllerFactory, ICompileJobConsumer compileJobConsumer, IApplication application, IEventConsumer eventConsumer, ILogger<DreamMaker> logger)
|
||||
{
|
||||
this.byond = byond;
|
||||
this.ioManager = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
|
||||
@@ -286,8 +289,11 @@ namespace Tgstation.Server.Host.Components
|
||||
}
|
||||
|
||||
if (!ddVerified)
|
||||
{
|
||||
//server never validated or compile failed
|
||||
await Task.WhenAll(CleanupFailedCompile(), eventConsumer.HandleEvent(EventType.CompileFailure, new List<string> { job.ExitCode == 0 ? "1" : "0" }, cancellationToken)).ConfigureAwait(false);
|
||||
await CleanupFailedCompile().ConfigureAwait(false);
|
||||
await eventConsumer.HandleEvent(EventType.CompileFailure, new List<string> { job.ExitCode == 0 ? "1" : "0" }, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
job.DMApiValidated = true;
|
||||
@@ -0,0 +1,22 @@
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Host.Models;
|
||||
|
||||
namespace Tgstation.Server.Host.Components.Compiler
|
||||
{
|
||||
/// <summary>
|
||||
/// Sink for <see cref="CompileJob"/>s
|
||||
/// </summary>
|
||||
interface ICompileJobConsumer : IHostedService, IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Load a new <paramref name="job"/> into the <see cref="ICompileJobConsumer"/>
|
||||
/// </summary>
|
||||
/// <param name="job">The <see cref="CompileJob"/> to load</param>
|
||||
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param>
|
||||
/// <returns>A <see cref="Task"/> representing the running operation</returns>
|
||||
Task LoadCompileJob(CompileJob job, CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Host.Models;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
namespace Tgstation.Server.Host.Components.Compiler
|
||||
{
|
||||
/// <summary>
|
||||
/// Factory for <see cref="IDmbProvider"/>s
|
||||
+2
-1
@@ -1,8 +1,9 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Host.Components.Repository;
|
||||
using Tgstation.Server.Host.Models;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
namespace Tgstation.Server.Host.Components.Compiler
|
||||
{
|
||||
/// <summary>
|
||||
/// For managing the compiler
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using Tgstation.Server.Host.Models;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
namespace Tgstation.Server.Host.Components.Compiler
|
||||
{
|
||||
/// <summary>
|
||||
/// Temporary <see cref="IDmbProvider"/>
|
||||
@@ -1,13 +0,0 @@
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Host.Models;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
{
|
||||
interface ICompileJobConsumer : IHostedService, IDisposable
|
||||
{
|
||||
Task LoadCompileJob(CompileJob job, CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,11 @@
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Host.Components.Byond;
|
||||
using Tgstation.Server.Host.Components.Chat;
|
||||
using Tgstation.Server.Host.Components.Compiler;
|
||||
using Tgstation.Server.Host.Components.Repository;
|
||||
using Tgstation.Server.Host.Components.Watchdog;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
@@ -37,9 +41,9 @@ namespace Tgstation.Server.Host.Components
|
||||
IChat Chat { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IConfiguration"/> for the <see cref="IInstance"/>
|
||||
/// The <see cref="StaticFiles.IConfiguration"/> for the <see cref="IInstance"/>
|
||||
/// </summary>
|
||||
IConfiguration Configuration { get; }
|
||||
StaticFiles.IConfiguration Configuration { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Get the <see cref="Api.Models.Instance"/> associated with the <see cref="IInstance"/>
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Host.Components.Byond;
|
||||
using Tgstation.Server.Host.Components.Chat;
|
||||
using Tgstation.Server.Host.Components.Compiler;
|
||||
using Tgstation.Server.Host.Components.Repository;
|
||||
using Tgstation.Server.Host.Components.Watchdog;
|
||||
using Tgstation.Server.Host.Core;
|
||||
|
||||
@@ -28,7 +32,7 @@ namespace Tgstation.Server.Host.Components
|
||||
public IChat Chat { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public IConfiguration Configuration { get; }
|
||||
public StaticFiles.IConfiguration Configuration { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="ICompileJobConsumer"/> for the <see cref="Instance"/>
|
||||
@@ -59,7 +63,20 @@ namespace Tgstation.Server.Host.Components
|
||||
/// </summary>
|
||||
CancellationTokenSource timerCts;
|
||||
|
||||
public Instance(Api.Models.Instance metadata, IRepositoryManager repositoryManager, IByondManager byondManager, IDreamMaker dreamMaker, IWatchdog watchdog, IChat chat, IConfiguration configuration, ICompileJobConsumer compileJobConsumer, IDatabaseContextFactory databaseContextFactory, IDmbFactory dmbFactory)
|
||||
/// <summary>
|
||||
/// Construct an <see cref="Instance"/>
|
||||
/// </summary>
|
||||
/// <param name="metadata">The value of <see cref="metadata"/></param>
|
||||
/// <param name="repositoryManager">The value of <see cref="RepositoryManager"/></param>
|
||||
/// <param name="byondManager">The value of <see cref="ByondManager"/></param>
|
||||
/// <param name="dreamMaker">The value of <see cref="DreamMaker"/></param>
|
||||
/// <param name="watchdog">The value of <see cref="Watchdog"/></param>
|
||||
/// <param name="chat">The value of <see cref="Chat"/></param>
|
||||
/// <param name="configuration">The value of <see cref="Configuration"/></param>
|
||||
/// <param name="compileJobConsumer">The value of <see cref="compileJobConsumer"/></param>
|
||||
/// <param name="databaseContextFactory">The value of <see cref="databaseContextFactory"/></param>
|
||||
/// <param name="dmbFactory">The value of <see cref="dmbFactory"/></param>
|
||||
public Instance(Api.Models.Instance metadata, IRepositoryManager repositoryManager, IByondManager byondManager, IDreamMaker dreamMaker, IWatchdog watchdog, IChat chat, StaticFiles.IConfiguration configuration, ICompileJobConsumer compileJobConsumer, IDatabaseContextFactory databaseContextFactory, IDmbFactory dmbFactory)
|
||||
{
|
||||
this.metadata = metadata ?? throw new ArgumentNullException(nameof(metadata));
|
||||
RepositoryManager = repositoryManager ?? throw new ArgumentNullException(nameof(repositoryManager));
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using Byond.TopicSender;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using Tgstation.Server.Host.Components.Byond;
|
||||
using Tgstation.Server.Host.Components.Chat;
|
||||
using Tgstation.Server.Host.Components.Chat.Commands;
|
||||
using Tgstation.Server.Host.Components.Compiler;
|
||||
using Tgstation.Server.Host.Components.Repository;
|
||||
using Tgstation.Server.Host.Components.Watchdog;
|
||||
using Tgstation.Server.Host.Core;
|
||||
using Tgstation.Server.Host.IO;
|
||||
@@ -133,7 +136,7 @@ namespace Tgstation.Server.Host.Components
|
||||
try
|
||||
{
|
||||
var byond = new ByondManager(byondIOManager, byondInstaller, loggerFactory.CreateLogger<ByondManager>());
|
||||
var configuration = new Configuration(configurationIoManager, synchronousIOManager, symlinkFactory, loggerFactory.CreateLogger<Configuration>());
|
||||
var configuration = new StaticFiles.Configuration(configurationIoManager, synchronousIOManager, symlinkFactory, loggerFactory.CreateLogger<StaticFiles.Configuration>());
|
||||
|
||||
var chat = chatFactory.CreateChat(metadata.ChatSettings);
|
||||
try
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Host.Components.Compiler;
|
||||
using Tgstation.Server.Host.Components.Watchdog;
|
||||
using Tgstation.Server.Host.Core;
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
namespace Tgstation.Server.Host.Components.Repository
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an on-disk git repository
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
namespace Tgstation.Server.Host.Components.Repository
|
||||
{
|
||||
/// <summary>
|
||||
/// Factory for creating and loading <see cref="IRepository"/>s
|
||||
+1
-1
@@ -7,7 +7,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Host.IO;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
namespace Tgstation.Server.Host.Components.Repository
|
||||
{
|
||||
/// <inheritdoc />
|
||||
sealed class Repository : IRepository
|
||||
+1
-1
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
|
||||
using Tgstation.Server.Api.Models.Internal;
|
||||
using Tgstation.Server.Host.IO;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
namespace Tgstation.Server.Host.Components.Repository
|
||||
{
|
||||
/// <inheritdoc />
|
||||
sealed class RepositoryManager : IRepositoryManager
|
||||
+1
-1
@@ -11,7 +11,7 @@ using Tgstation.Server.Api.Models;
|
||||
using Tgstation.Server.Host.IO;
|
||||
using Tgstation.Server.Host.Security;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
namespace Tgstation.Server.Host.Components.StaticFiles
|
||||
{
|
||||
/// <inheritdoc />
|
||||
sealed class Configuration : IConfiguration
|
||||
+1
-1
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
|
||||
using Tgstation.Server.Api.Models;
|
||||
using Tgstation.Server.Host.Security;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
namespace Tgstation.Server.Host.Components.StaticFiles
|
||||
{
|
||||
/// <summary>
|
||||
/// For managing the Configuration directory
|
||||
+1
-3
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
namespace Tgstation.Server.Host.Components.StaticFiles
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents code modifications via configuration
|
||||
@@ -3,6 +3,7 @@ using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using Tgstation.Server.Api.Models;
|
||||
using Tgstation.Server.Api.Models.Internal;
|
||||
using Tgstation.Server.Host.Components.Byond;
|
||||
|
||||
namespace Tgstation.Server.Host.Components.Watchdog
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Tgstation.Server.Api.Models.Internal;
|
||||
using Tgstation.Server.Host.Components.Byond;
|
||||
|
||||
namespace Tgstation.Server.Host.Components.Watchdog
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Api.Models.Internal;
|
||||
using Tgstation.Server.Host.Components.Byond;
|
||||
|
||||
namespace Tgstation.Server.Host.Components.Watchdog
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Tgstation.Server.Api.Models.Internal;
|
||||
using Tgstation.Server.Host.Components.Compiler;
|
||||
|
||||
namespace Tgstation.Server.Host.Components.Watchdog
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Tgstation.Server.Host.Models;
|
||||
using Tgstation.Server.Host.Components.Compiler;
|
||||
using Tgstation.Server.Host.Models;
|
||||
|
||||
namespace Tgstation.Server.Host.Components.Watchdog
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Host.Components.Byond;
|
||||
|
||||
namespace Tgstation.Server.Host.Components.Watchdog
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Api.Models.Internal;
|
||||
using Tgstation.Server.Host.Components.Byond;
|
||||
using Tgstation.Server.Host.Components.Chat;
|
||||
using Tgstation.Server.Host.Core;
|
||||
using Tgstation.Server.Host.IO;
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Api.Models.Internal;
|
||||
using Tgstation.Server.Host.Components.Chat;
|
||||
using Tgstation.Server.Host.Components.Compiler;
|
||||
using Tgstation.Server.Host.Core;
|
||||
|
||||
namespace Tgstation.Server.Host.Components.Watchdog
|
||||
|
||||
@@ -3,6 +3,7 @@ using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using Tgstation.Server.Api.Models.Internal;
|
||||
using Tgstation.Server.Host.Components.Chat;
|
||||
using Tgstation.Server.Host.Components.Compiler;
|
||||
using Tgstation.Server.Host.Core;
|
||||
|
||||
namespace Tgstation.Server.Host.Components.Watchdog
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using Tgstation.Server.Host.Components.Compiler;
|
||||
using Tgstation.Server.Host.Models;
|
||||
|
||||
namespace Tgstation.Server.Host.Components.Watchdog
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Tgstation.Server.Host.Controllers
|
||||
/// <summary>
|
||||
/// Controller for managing the compiler
|
||||
/// </summary>
|
||||
[Route("/" + nameof(DreamMaker))]
|
||||
[Route("/" + nameof(Api.Models.DreamMaker))]
|
||||
public sealed class DreamMakerController : ModelController<Api.Models.DreamMaker>
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -20,6 +20,7 @@ using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Host.Components;
|
||||
using Tgstation.Server.Host.Components.Byond;
|
||||
using Tgstation.Server.Host.Components.Chat;
|
||||
using Tgstation.Server.Host.Components.Chat.Commands;
|
||||
using Tgstation.Server.Host.Components.Watchdog;
|
||||
|
||||
Reference in New Issue
Block a user