* chore: Fix XML warnings * docs: Fix XML warnings * docs: Fix XML in resource designer * docs: Fix XML warnings * Revert "docs: Fix XML in resource designer" This reverts commit 8ea61c51ac161e1853ae080db7fe1b4d4cb4d2be.
30 lines
1.3 KiB
C#
30 lines
1.3 KiB
C#
using Umbraco.Cms.Core.Services;
|
|
|
|
namespace Umbraco.Cms.Core.Sync;
|
|
|
|
/// <summary>
|
|
/// Gets the current server's <see cref="ServerRole" /> based on active servers registered with
|
|
/// <see cref="IServerRegistrationService" />
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// This is the default service which determines a server's role by using a master election process.
|
|
/// The scheduling publisher election process doesn't occur until just after startup so this election process doesn't
|
|
/// really affect the primary startup phase.
|
|
/// </remarks>
|
|
public sealed class ElectedServerRoleAccessor : IServerRoleAccessor
|
|
{
|
|
private readonly IServerRegistrationService _registrationService;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="ElectedServerRoleAccessor" /> class.
|
|
/// </summary>
|
|
/// <param name="registrationService">The registration service.</param>
|
|
public ElectedServerRoleAccessor(IServerRegistrationService registrationService) => _registrationService =
|
|
registrationService ?? throw new ArgumentNullException(nameof(registrationService));
|
|
|
|
/// <summary>
|
|
/// Gets the role of the current server in the application environment.
|
|
/// </summary>
|
|
public ServerRole CurrentServerRole => _registrationService.GetCurrentServerRole();
|
|
}
|