using Umbraco.Cms.Core.Services;
namespace Umbraco.Cms.Core.Sync;
///
/// Gets the current server's based on active servers registered with
///
///
///
/// 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.
///
public sealed class ElectedServerRoleAccessor : IServerRoleAccessor
{
private readonly IServerRegistrationService _registrationService;
///
/// Initializes a new instance of the class.
///
/// The registration service.
public ElectedServerRoleAccessor(IServerRegistrationService registrationService) => _registrationService =
registrationService ?? throw new ArgumentNullException(nameof(registrationService));
///
/// Gets the role of the current server in the application environment.
///
public ServerRole CurrentServerRole => _registrationService.GetCurrentServerRole();
}