77e30685bb
- Implements Phases 3–6: session isolation, cache coordination, primary election, and file system monitor coordination for Jellyfin with PostgreSQL. - Adds new database entities (Instance, DistributedLock, FileSystemChange) and EF model configurations. - Includes SQL migration scripts and EF migration for all required tables, columns, and helper functions. - Updates Device entity and JellyfinDbContext for multi-instance tracking. - Integrates new DI services for instance registry, distributed locks, cache coordinator, and primary election. - Adds publishing profiles (Win/Linux/FrameworkDependent) and automation script for deployment. - Extensive documentation for architecture, setup, and publishing. - All changes are backward compatible and build successfully.
100 lines
3.1 KiB
C#
100 lines
3.1 KiB
C#
// <copyright file="DistributedLockNames.cs" company="PlaceholderCompany">
|
|
// Copyright (c) PlaceholderCompany. All rights reserved.
|
|
// </copyright>
|
|
|
|
namespace Jellyfin.Server.Implementations.Clustering
|
|
{
|
|
using System;
|
|
|
|
/// <summary>
|
|
/// Standard lock names for distributed locking.
|
|
/// </summary>
|
|
public static class DistributedLockNames
|
|
{
|
|
/// <summary>
|
|
/// Lock for database migrations.
|
|
/// </summary>
|
|
public const string DatabaseMigration = "database:migration";
|
|
|
|
/// <summary>
|
|
/// Lock for primary instance election.
|
|
/// </summary>
|
|
public const string PrimaryElection = "instance:primary:election";
|
|
|
|
/// <summary>
|
|
/// Global lock for all library scans.
|
|
/// </summary>
|
|
public const string GlobalLibraryScan = "library:scan:global";
|
|
|
|
/// <summary>
|
|
/// Lock for library scanning operations.
|
|
/// </summary>
|
|
/// <param name="libraryId">The library ID.</param>
|
|
/// <returns>The lock name.</returns>
|
|
public static string LibraryScan(Guid libraryId)
|
|
{
|
|
return $"library:scan:{libraryId}";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Lock for metadata refresh operations.
|
|
/// </summary>
|
|
/// <param name="itemId">The item ID.</param>
|
|
/// <returns>The lock name.</returns>
|
|
public static string MetadataRefresh(Guid itemId)
|
|
{
|
|
return $"metadata:refresh:{itemId}";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Lock for configuration updates.
|
|
/// </summary>
|
|
/// <param name="configType">The configuration type.</param>
|
|
/// <returns>The lock name.</returns>
|
|
public static string ConfigurationUpdate(string configType)
|
|
{
|
|
return $"config:update:{configType}";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Lock for scheduled task execution.
|
|
/// </summary>
|
|
/// <param name="taskName">The task name.</param>
|
|
/// <returns>The lock name.</returns>
|
|
public static string ScheduledTask(string taskName)
|
|
{
|
|
return $"task:{taskName}";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Lock for image processing operations.
|
|
/// </summary>
|
|
/// <param name="itemId">The item ID.</param>
|
|
/// <returns>The lock name.</returns>
|
|
public static string ImageProcessing(Guid itemId)
|
|
{
|
|
return $"image:process:{itemId}";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Lock for cache clearing operations.
|
|
/// </summary>
|
|
/// <param name="cacheType">The cache type.</param>
|
|
/// <returns>The lock name.</returns>
|
|
public static string CacheClear(string cacheType)
|
|
{
|
|
return $"cache:clear:{cacheType}";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Lock for plugin operations.
|
|
/// </summary>
|
|
/// <param name="pluginId">The plugin ID.</param>
|
|
/// <returns>The lock name.</returns>
|
|
public static string PluginOperation(Guid pluginId)
|
|
{
|
|
return $"plugin:operation:{pluginId}";
|
|
}
|
|
}
|
|
}
|