Differentiate between component services and IHostedServices

This commit is contained in:
Dominion
2023-06-03 23:37:58 -04:00
parent 18d399ce3a
commit 0fb61510b6
10 changed files with 21 additions and 26 deletions
@@ -4,8 +4,6 @@ using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Tgstation.Server.Host.Jobs;
namespace Tgstation.Server.Host.Components.Byond
@@ -14,7 +12,7 @@ namespace Tgstation.Server.Host.Components.Byond
/// For managing the BYOND installation.
/// </summary>
/// <remarks>When passing in <see cref="Version"/>s, ensure they are BYOND format versions unless referring to a custom version. This means <see cref="Version.Build"/> should NEVER be 0.</remarks>
public interface IByondManager : IHostedService, IDisposable
public interface IByondManager : IComponentService, IDisposable
{
/// <summary>
/// The currently active BYOND version.
@@ -3,8 +3,6 @@ using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Tgstation.Server.Api.Models.Internal;
using Tgstation.Server.Host.Components.Interop;
@@ -13,7 +11,7 @@ namespace Tgstation.Server.Host.Components.Chat
/// <summary>
/// For managing connected chat services.
/// </summary>
public interface IChatManager : IHostedService, IAsyncDisposable
public interface IChatManager : IComponentService, IAsyncDisposable
{
/// <summary>
/// Registers a <paramref name="customCommandHandler"/> to use.
@@ -90,7 +90,7 @@ namespace Tgstation.Server.Host.Components.Deployment
IDmbProvider nextDmbProvider;
/// <summary>
/// If the <see cref="DmbFactory"/> is "started" via <see cref="Microsoft.Extensions.Hosting.IHostedService"/>.
/// If the <see cref="DmbFactory"/> is "started" via <see cref="IComponentService"/>.
/// </summary>
bool started;
@@ -2,8 +2,6 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Tgstation.Server.Host.Models;
namespace Tgstation.Server.Host.Components.Deployment
@@ -11,7 +9,7 @@ namespace Tgstation.Server.Host.Components.Deployment
/// <summary>
/// Factory for <see cref="IDmbProvider"/>s.
/// </summary>
public interface IDmbFactory : ILatestCompileJobProvider, IHostedService, IDisposable
public interface IDmbFactory : ILatestCompileJobProvider, IComponentService, IDisposable
{
/// <summary>
/// Get a <see cref="Task"/> that completes when the result of a call to <see cref="LockNextDmb"/> will be different than the previous call if any.
@@ -0,0 +1,11 @@
using Microsoft.Extensions.Hosting;
namespace Tgstation.Server.Host.Components
{
/// <summary>
/// Represents a component meant to be started and stopped by its parent component.
/// </summary>
public interface IComponentService : IHostedService
{
}
}
@@ -1,13 +1,11 @@
using System;
using Microsoft.Extensions.Hosting;
namespace Tgstation.Server.Host.Components
{
/// <summary>
/// Component version of <see cref="IInstanceCore"/>.
/// </summary>
interface IInstance : IInstanceCore, IHostedService, IAsyncDisposable
interface IInstance : IInstanceCore, IComponentService, IAsyncDisposable
{
}
}
@@ -1,7 +1,5 @@
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Tgstation.Server.Host.Components.Interop.Bridge;
using Tgstation.Server.Host.IO;
@@ -10,7 +8,7 @@ namespace Tgstation.Server.Host.Components
/// <summary>
/// Factory for creating <see cref="IInstance"/>s.
/// </summary>
interface IInstanceFactory : IHostedService
interface IInstanceFactory : IComponentService
{
/// <summary>
/// Create an <see cref="IInstance"/>.
@@ -3,8 +3,6 @@ using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Api.Models.Response;
using Tgstation.Server.Host.Components.Events;
@@ -15,7 +13,7 @@ namespace Tgstation.Server.Host.Components.StaticFiles
/// <summary>
/// For managing the Configuration directory.
/// </summary>
public interface IConfiguration : IHostedService, IEventConsumer, IDisposable
public interface IConfiguration : IComponentService, IEventConsumer, IDisposable
{
/// <summary>
/// Copies all files in the CodeModifications directory to <paramref name="destination"/>.
@@ -2,8 +2,6 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Api.Models.Internal;
using Tgstation.Server.Host.Components.Events;
@@ -14,7 +12,7 @@ namespace Tgstation.Server.Host.Components.Watchdog
/// <summary>
/// Runs and monitors the twin server controllers.
/// </summary>
public interface IWatchdog : IHostedService, IAsyncDisposable, IEventConsumer, IRenameNotifyee
public interface IWatchdog : IComponentService, IAsyncDisposable, IEventConsumer, IRenameNotifyee
{
/// <summary>
/// The current <see cref="WatchdogStatus"/>.
@@ -1,13 +1,11 @@
using Microsoft.Extensions.Hosting;
using Tgstation.Server.Host.Components;
using Tgstation.Server.Host.Components;
namespace Tgstation.Server.Host.Jobs
{
/// <summary>
/// The service that manages everything to do with jobs.
/// </summary>
public interface IJobService : IJobManager, IHostedService
public interface IJobService : IJobManager, IComponentService
{
/// <summary>
/// Activate the <see cref="IJobManager"/>.