Rename IUpdater to IMigrationRoutine

This commit is contained in:
Mark Monteiro 2020-03-06 21:51:50 +01:00
parent 6660006f01
commit 4c2b543b30
4 changed files with 15 additions and 15 deletions

View File

@ -4,20 +4,20 @@ using Microsoft.Extensions.Logging;
namespace Jellyfin.Server.Migrations
{
/// <summary>
/// Interface that descibes a migration routine.
/// Interface that describes a migration routine.
/// </summary>
internal interface IUpdater
internal interface IMigrationRoutine
{
/// <summary>
/// Gets the name of the migration, must be unique.
/// </summary>
public abstract string Name { get; }
public string Name { get; }
/// <summary>
/// Execute the migration routine.
/// </summary>
/// <param name="host">Host that hosts current version.</param>
/// <param name="logger">Host logger.</param>
public abstract void Perform(CoreAppHost host, ILogger logger);
public void Perform(CoreAppHost host, ILogger logger);
}
}

View File

@ -13,7 +13,7 @@ namespace Jellyfin.Server.Migrations
/// <summary>
/// The list of known migrations, in order of applicability.
/// </summary>
internal static readonly IUpdater[] Migrations =
internal static readonly IMigrationRoutine[] Migrations =
{
new Routines.DisableTranscodingThrottling(),
new Routines.CreateUserLoggingConfigFile()
@ -43,26 +43,26 @@ namespace Jellyfin.Server.Migrations
for (var i = 0; i < Migrations.Length; i++)
{
var updater = Migrations[i];
if (applied.Contains(updater.Name))
var migrationRoutine = Migrations[i];
if (applied.Contains(migrationRoutine.Name))
{
logger.LogDebug("Skipping migration {Name} as it is already applied", updater.Name);
logger.LogDebug("Skipping migration {Name} as it is already applied", migrationRoutine.Name);
continue;
}
logger.LogInformation("Applying migration {Name}", updater.Name);
logger.LogInformation("Applying migration {Name}", migrationRoutine.Name);
try
{
updater.Perform(host, logger);
migrationRoutine.Perform(host, logger);
}
catch (Exception ex)
{
logger.LogError(ex, "Cannot apply migration {Name}", updater.Name);
logger.LogError(ex, "Cannot apply migration {Name}", migrationRoutine.Name);
continue;
}
logger.LogInformation("Migration {Name} applied successfully", updater.Name);
applied.Add(updater.Name);
logger.LogInformation("Migration {Name} applied successfully", migrationRoutine.Name);
applied.Add(migrationRoutine.Name);
}
if (applied.Count > migrationOptions.Applied.Length)

View File

@ -13,7 +13,7 @@ namespace Jellyfin.Server.Migrations.Routines
/// If the deprecated logging.json file exists and has a custom config, it will be used as logging.user.json,
/// otherwise a blank file will be created.
/// </summary>
internal class CreateUserLoggingConfigFile : IUpdater
internal class CreateUserLoggingConfigFile : IMigrationRoutine
{
/// <summary>
/// An empty logging JSON configuration, which will be used as the default contents for the user settings config file.

View File

@ -10,7 +10,7 @@ namespace Jellyfin.Server.Migrations.Routines
/// <summary>
/// Updater that takes care of bringing configuration up to 10.5.0 standards.
/// </summary>
internal class DisableTranscodingThrottling : IUpdater
internal class DisableTranscodingThrottling : IMigrationRoutine
{
/// <inheritdoc/>
public string Name => "DisableTranscodingThrottling";