Rename IUpdater to IMigrationRoutine
This commit is contained in:
parent
6660006f01
commit
4c2b543b30
|
@ -4,20 +4,20 @@ using Microsoft.Extensions.Logging;
|
||||||
namespace Jellyfin.Server.Migrations
|
namespace Jellyfin.Server.Migrations
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interface that descibes a migration routine.
|
/// Interface that describes a migration routine.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal interface IUpdater
|
internal interface IMigrationRoutine
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name of the migration, must be unique.
|
/// Gets the name of the migration, must be unique.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract string Name { get; }
|
public string Name { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Execute the migration routine.
|
/// Execute the migration routine.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="host">Host that hosts current version.</param>
|
/// <param name="host">Host that hosts current version.</param>
|
||||||
/// <param name="logger">Host logger.</param>
|
/// <param name="logger">Host logger.</param>
|
||||||
public abstract void Perform(CoreAppHost host, ILogger logger);
|
public void Perform(CoreAppHost host, ILogger logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -13,7 +13,7 @@ namespace Jellyfin.Server.Migrations
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The list of known migrations, in order of applicability.
|
/// The list of known migrations, in order of applicability.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static readonly IUpdater[] Migrations =
|
internal static readonly IMigrationRoutine[] Migrations =
|
||||||
{
|
{
|
||||||
new Routines.DisableTranscodingThrottling(),
|
new Routines.DisableTranscodingThrottling(),
|
||||||
new Routines.CreateUserLoggingConfigFile()
|
new Routines.CreateUserLoggingConfigFile()
|
||||||
|
@ -43,26 +43,26 @@ namespace Jellyfin.Server.Migrations
|
||||||
|
|
||||||
for (var i = 0; i < Migrations.Length; i++)
|
for (var i = 0; i < Migrations.Length; i++)
|
||||||
{
|
{
|
||||||
var updater = Migrations[i];
|
var migrationRoutine = Migrations[i];
|
||||||
if (applied.Contains(updater.Name))
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.LogInformation("Applying migration {Name}", updater.Name);
|
logger.LogInformation("Applying migration {Name}", migrationRoutine.Name);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
updater.Perform(host, logger);
|
migrationRoutine.Perform(host, logger);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
logger.LogError(ex, "Cannot apply migration {Name}", updater.Name);
|
logger.LogError(ex, "Cannot apply migration {Name}", migrationRoutine.Name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.LogInformation("Migration {Name} applied successfully", updater.Name);
|
logger.LogInformation("Migration {Name} applied successfully", migrationRoutine.Name);
|
||||||
applied.Add(updater.Name);
|
applied.Add(migrationRoutine.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (applied.Count > migrationOptions.Applied.Length)
|
if (applied.Count > migrationOptions.Applied.Length)
|
||||||
|
|
|
@ -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,
|
/// 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.
|
/// otherwise a blank file will be created.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class CreateUserLoggingConfigFile : IUpdater
|
internal class CreateUserLoggingConfigFile : IMigrationRoutine
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An empty logging JSON configuration, which will be used as the default contents for the user settings config file.
|
/// An empty logging JSON configuration, which will be used as the default contents for the user settings config file.
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace Jellyfin.Server.Migrations.Routines
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updater that takes care of bringing configuration up to 10.5.0 standards.
|
/// Updater that takes care of bringing configuration up to 10.5.0 standards.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class DisableTranscodingThrottling : IUpdater
|
internal class DisableTranscodingThrottling : IMigrationRoutine
|
||||||
{
|
{
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string Name => "DisableTranscodingThrottling";
|
public string Name => "DisableTranscodingThrottling";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user