Files
dnsmasq-webui/src/DnsmasqWebUI/Infrastructure/Services/Dnsmasq/Hosts/Abstractions/IHostsCache.cs
T
alex c7e7844ce7 Update hosts workflow and align DHCP metadata.
Redesign the Hosts page around source-aware grouped rows with shared table shell styling, fix effective-config save session synchronization, and move read-ethers into the DHCP model where dnsmasq actually applies it.
2026-03-26 00:24:21 +10:00

27 lines
1.1 KiB
C#

using DnsmasqWebUI.Models.Contracts;
using DnsmasqWebUI.Infrastructure.Services.Registration.Abstractions;
using DnsmasqWebUI.Models.Hosts;
namespace DnsmasqWebUI.Infrastructure.Services.Dnsmasq.Hosts.Abstractions;
/// <summary>
/// Singleton cache for hosts: managed hosts file + read-only (system + addn-hosts + hostsdir). Invalidates on watchers, staleness, or Invalidate.
/// Call <see cref="NotifyWeWroteManagedHosts"/> after the app writes the managed hosts file so the cache updates in place and ignores the next watcher event.
/// </summary>
public interface IHostsCache : IApplicationSingleton
{
Task<HostsSnapshot> GetSnapshotAsync(CancellationToken ct = default);
void Invalidate();
void NotifyWeWroteManagedHosts(IReadOnlyList<HostEntry> entries);
/// <summary>
/// Builds unified page rows from the snapshot, preserving source awareness.
/// </summary>
Task<IReadOnlyList<HostsPageRow>> GetUnifiedRowsAsync(
bool expandHosts,
string? domain,
bool noHosts,
string? managedHostsPath,
CancellationToken ct = default);
}