mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-27 07:04:57 +01:00
WatchdogFactory done +other shit
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Host.Models;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System.Threading;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Host.Models;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Tgstation.Server.Host.Components
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IInstance GetInstance(Host.Models.Instance metadata)
|
||||
public IInstance GetInstance(Models.Instance metadata)
|
||||
{
|
||||
if (metadata == null)
|
||||
throw new ArgumentNullException(nameof(metadata));
|
||||
@@ -69,7 +69,7 @@ namespace Tgstation.Server.Host.Components
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task MoveInstance(Host.Models.Instance instance, string newPath, CancellationToken cancellationToken)
|
||||
public async Task MoveInstance(Models.Instance instance, string newPath, CancellationToken cancellationToken)
|
||||
{
|
||||
if (newPath == null)
|
||||
throw new ArgumentNullException(nameof(newPath));
|
||||
@@ -95,7 +95,7 @@ namespace Tgstation.Server.Host.Components
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task OfflineInstance(Host.Models.Instance metadata, CancellationToken cancellationToken)
|
||||
public async Task OfflineInstance(Models.Instance metadata, CancellationToken cancellationToken)
|
||||
{
|
||||
if (metadata == null)
|
||||
throw new ArgumentNullException(nameof(metadata));
|
||||
@@ -110,7 +110,7 @@ namespace Tgstation.Server.Host.Components
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task OnlineInstance(Host.Models.Instance metadata, CancellationToken cancellationToken)
|
||||
public async Task OnlineInstance(Models.Instance metadata, CancellationToken cancellationToken)
|
||||
{
|
||||
if (metadata == null)
|
||||
throw new ArgumentNullException(nameof(metadata));
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Tgstation.Server.Api.Models.Internal;
|
||||
using Tgstation.Server.Host.Components.Models;
|
||||
using Tgstation.Server.Host.Core;
|
||||
|
||||
namespace Tgstation.Server.Host.Components
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Tgstation.Server.Host.Components.Watchdog
|
||||
{
|
||||
interface IWatchdog
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using Tgstation.Server.Api.Models.Internal;
|
||||
|
||||
namespace Tgstation.Server.Host.Components.Watchdog
|
||||
{
|
||||
/// <summary>
|
||||
/// For creating <see cref="IWatchdog"/>s
|
||||
/// </summary>
|
||||
interface IWatchdogFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a <see cref="IWatchdog"/>
|
||||
/// </summary>
|
||||
/// <param name="compileJob">The <see cref="IDmbFactory"/> for the <see cref="IWatchdog"/> with</param>
|
||||
/// <returns>A new <see cref="IWatchdog"/></returns>
|
||||
IWatchdog CreateWatchdog(IDmbFactory dmbFactory);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace Tgstation.Server.Host.Components.Watchdog
|
||||
{
|
||||
/// <inheritdoc />
|
||||
sealed class Watchdog : IWatchdog
|
||||
{
|
||||
/// <summary>
|
||||
/// Construct a <see cref="IWatchdog"/>
|
||||
/// </summary>
|
||||
/// <param name="byond"></param>
|
||||
/// <param name="chat"></param>
|
||||
/// <param name="sessionManagerFactory"></param>
|
||||
/// <param name="dmbFactory"></param>
|
||||
/// <param name="eventConsumer"></param>
|
||||
/// <param name="interopRegistrar"></param>
|
||||
public Watchdog(IByond byond, IChat chat, ISessionManagerFactory sessionManagerFactory, IDmbFactory dmbFactory, IEventConsumer eventConsumer, IInteropRegistrar interopRegistrar)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
|
||||
namespace Tgstation.Server.Host.Components.Watchdog
|
||||
{
|
||||
/// <inheritdoc />
|
||||
sealed class WatchdogFactory : IWatchdogFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="IByond"/> for the <see cref="WatchdogFactory"/>
|
||||
/// </summary>
|
||||
readonly IByond byond;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IChat"/> for the <see cref="WatchdogFactory"/>
|
||||
/// </summary>
|
||||
readonly IChat chat;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="ISessionManagerFactory"/> for the <see cref="WatchdogFactory"/>
|
||||
/// </summary>
|
||||
readonly ISessionManagerFactory sessionManagerFactory;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IEventConsumer"/> for the <see cref="WatchdogFactory"/>
|
||||
/// </summary>
|
||||
readonly IEventConsumer eventConsumer;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IInteropRegistrar"/> for the <see cref="WatchdogFactory"/>
|
||||
/// </summary>
|
||||
readonly IInteropRegistrar interopRegistrar;
|
||||
|
||||
/// <summary>
|
||||
/// Construct a <see cref="WatchdogFactory"/>
|
||||
/// </summary>
|
||||
/// <param name="byond">The value of <see cref="byond"/></param>
|
||||
/// <param name="chat">The value of <see cref="chat"/></param>
|
||||
/// <param name="sessionManagerFactory">The value of <see cref="sessionManagerFactory"/></param>
|
||||
/// <param name="eventConsumer">The value of <see cref="eventConsumer"/></param>
|
||||
/// <param name="interopRegistrar">The value of <see cref="interopRegistrar"/></param>
|
||||
public WatchdogFactory(IByond byond, IChat chat, ISessionManagerFactory sessionManagerFactory, IEventConsumer eventConsumer, IInteropRegistrar interopRegistrar)
|
||||
{
|
||||
this.byond = byond ?? throw new ArgumentNullException(nameof(byond));
|
||||
this.chat = chat ?? throw new ArgumentNullException(nameof(chat));
|
||||
this.sessionManagerFactory = sessionManagerFactory ?? throw new ArgumentNullException(nameof(sessionManagerFactory));
|
||||
this.eventConsumer = eventConsumer ?? throw new ArgumentNullException(nameof(eventConsumer));
|
||||
this.interopRegistrar = interopRegistrar ?? throw new ArgumentNullException(nameof(interopRegistrar));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IWatchdog CreateWatchdog(IDmbFactory dmbFactory) => new Watchdog(byond, chat, sessionManagerFactory, dmbFactory, eventConsumer, interopRegistrar);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user