From 69cb412d9df910e7bae20a5cae045a0c93901d08 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 4 Jul 2018 14:39:01 -0400 Subject: [PATCH] WatchdogFactory done +other shit --- .../Components/IDmbFactory.cs | 1 - .../Components/IDreamMaker.cs | 3 +- .../Components/IInstanceManager.cs | 1 - .../Components/InstanceManager.cs | 8 +-- .../Components/Watchdog.cs | 1 - .../Components/Watchdog/IWatchdog.cs | 7 +++ .../Components/Watchdog/IWatchdogFactory.cs | 17 ++++++ .../Components/Watchdog/Watchdog.cs | 19 +++++++ .../Components/Watchdog/WatchdogFactory.cs | 53 +++++++++++++++++++ 9 files changed, 101 insertions(+), 9 deletions(-) create mode 100644 src/Tgstation.Server.Host/Components/Watchdog/IWatchdog.cs create mode 100644 src/Tgstation.Server.Host/Components/Watchdog/IWatchdogFactory.cs create mode 100644 src/Tgstation.Server.Host/Components/Watchdog/Watchdog.cs create mode 100644 src/Tgstation.Server.Host/Components/Watchdog/WatchdogFactory.cs diff --git a/src/Tgstation.Server.Host/Components/IDmbFactory.cs b/src/Tgstation.Server.Host/Components/IDmbFactory.cs index 19ca0dc1ae..2ed1a771ff 100644 --- a/src/Tgstation.Server.Host/Components/IDmbFactory.cs +++ b/src/Tgstation.Server.Host/Components/IDmbFactory.cs @@ -1,6 +1,5 @@ using System.Threading; using System.Threading.Tasks; -using Tgstation.Server.Host.Models; namespace Tgstation.Server.Host.Components { diff --git a/src/Tgstation.Server.Host/Components/IDreamMaker.cs b/src/Tgstation.Server.Host/Components/IDreamMaker.cs index 938aeb46b8..cbbfb1deb9 100644 --- a/src/Tgstation.Server.Host/Components/IDreamMaker.cs +++ b/src/Tgstation.Server.Host/Components/IDreamMaker.cs @@ -1,5 +1,4 @@ -using Microsoft.Extensions.Hosting; -using System.Threading; +using System.Threading; using System.Threading.Tasks; using Tgstation.Server.Host.Models; diff --git a/src/Tgstation.Server.Host/Components/IInstanceManager.cs b/src/Tgstation.Server.Host/Components/IInstanceManager.cs index 376d070a37..1eb1454dd2 100644 --- a/src/Tgstation.Server.Host/Components/IInstanceManager.cs +++ b/src/Tgstation.Server.Host/Components/IInstanceManager.cs @@ -1,5 +1,4 @@ using Microsoft.AspNetCore.Http; -using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; diff --git a/src/Tgstation.Server.Host/Components/InstanceManager.cs b/src/Tgstation.Server.Host/Components/InstanceManager.cs index bb4ba8fd80..ef150c8552 100644 --- a/src/Tgstation.Server.Host/Components/InstanceManager.cs +++ b/src/Tgstation.Server.Host/Components/InstanceManager.cs @@ -56,7 +56,7 @@ namespace Tgstation.Server.Host.Components } /// - 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 } /// - 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 } /// - 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 } /// - 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)); diff --git a/src/Tgstation.Server.Host/Components/Watchdog.cs b/src/Tgstation.Server.Host/Components/Watchdog.cs index ff86d9d0ab..474beeeaf5 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog.cs @@ -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 diff --git a/src/Tgstation.Server.Host/Components/Watchdog/IWatchdog.cs b/src/Tgstation.Server.Host/Components/Watchdog/IWatchdog.cs new file mode 100644 index 0000000000..e5707760ac --- /dev/null +++ b/src/Tgstation.Server.Host/Components/Watchdog/IWatchdog.cs @@ -0,0 +1,7 @@ +namespace Tgstation.Server.Host.Components.Watchdog +{ + interface IWatchdog + { + + } +} diff --git a/src/Tgstation.Server.Host/Components/Watchdog/IWatchdogFactory.cs b/src/Tgstation.Server.Host/Components/Watchdog/IWatchdogFactory.cs new file mode 100644 index 0000000000..4e9c98235a --- /dev/null +++ b/src/Tgstation.Server.Host/Components/Watchdog/IWatchdogFactory.cs @@ -0,0 +1,17 @@ +using Tgstation.Server.Api.Models.Internal; + +namespace Tgstation.Server.Host.Components.Watchdog +{ + /// + /// For creating s + /// + interface IWatchdogFactory + { + /// + /// Creates a + /// + /// The for the with + /// A new + IWatchdog CreateWatchdog(IDmbFactory dmbFactory); + } +} diff --git a/src/Tgstation.Server.Host/Components/Watchdog/Watchdog.cs b/src/Tgstation.Server.Host/Components/Watchdog/Watchdog.cs new file mode 100644 index 0000000000..4630419674 --- /dev/null +++ b/src/Tgstation.Server.Host/Components/Watchdog/Watchdog.cs @@ -0,0 +1,19 @@ +namespace Tgstation.Server.Host.Components.Watchdog +{ + /// + sealed class Watchdog : IWatchdog + { + /// + /// Construct a + /// + /// + /// + /// + /// + /// + /// + public Watchdog(IByond byond, IChat chat, ISessionManagerFactory sessionManagerFactory, IDmbFactory dmbFactory, IEventConsumer eventConsumer, IInteropRegistrar interopRegistrar) + { + } + } +} diff --git a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogFactory.cs b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogFactory.cs new file mode 100644 index 0000000000..9677ef6d12 --- /dev/null +++ b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogFactory.cs @@ -0,0 +1,53 @@ +using System; + +namespace Tgstation.Server.Host.Components.Watchdog +{ + /// + sealed class WatchdogFactory : IWatchdogFactory + { + /// + /// The for the + /// + readonly IByond byond; + + /// + /// The for the + /// + readonly IChat chat; + + /// + /// The for the + /// + readonly ISessionManagerFactory sessionManagerFactory; + + /// + /// The for the + /// + readonly IEventConsumer eventConsumer; + + /// + /// The for the + /// + readonly IInteropRegistrar interopRegistrar; + + /// + /// Construct a + /// + /// The value of + /// The value of + /// The value of + /// The value of + /// The value of + 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)); + } + + /// + public IWatchdog CreateWatchdog(IDmbFactory dmbFactory) => new Watchdog(byond, chat, sessionManagerFactory, dmbFactory, eventConsumer, interopRegistrar); + } +}