namespace Duplicati.Library.RestAPI;
public interface INotificationUpdateService
{
///
/// An event ID that increases whenever the database is updated
///
long LastDataUpdateId { get; }
///
/// An event ID that increases whenever a notification is updated
///
long LastNotificationUpdateId { get; }
void IncrementLastDataUpdateId();
void IncrementLastNotificationUpdateId();
}
public class NotificationUpdateService : INotificationUpdateService
{
///
/// An event ID that increases whenever the database is updated
///
public long LastDataUpdateId { get; private set; } = 0;
private readonly object _lastDataUpdateIdLock = new();
///
/// An event ID that increases whenever a notification is updated
///
public long LastNotificationUpdateId { get; private set; } = 0;
private readonly object _lastNotificationUpdateIdLock = new();
public void IncrementLastDataUpdateId()
{
lock (_lastDataUpdateIdLock)
{
LastDataUpdateId++;
}
}
public void IncrementLastNotificationUpdateId()
{
lock (_lastNotificationUpdateIdLock)
{
LastNotificationUpdateId++;
}
}
}