using OpenWaf.Domain.Policy; using OpenWaf.Domain.Security; namespace OpenWaf.Domain.Engine; /// /// The immutable state the decision point reads. Built off the request path /// on a TTL and swapped atomically, so a request never touches the database. /// /// Blocks are split by provenance rather than by table: the two kinds are /// looked up in a fixed order and a clear operation must be able to name one /// kind without touching the other. /// public sealed record EdgeSnapshot { public required DateTimeOffset GeneratedAt { get; init; } public required EdgePolicy Policy { get; init; } public IReadOnlyDictionary OperatorBlocks { get; init; } = new Dictionary(StringComparer.Ordinal); public IReadOnlyDictionary EngineBans { get; init; } = new Dictionary(StringComparer.Ordinal); public IReadOnlyList AllowEntries { get; init; } = []; public IReadOnlyDictionary Countries { get; init; } = new Dictionary(StringComparer.OrdinalIgnoreCase); public static EdgeSnapshot Empty(EdgePolicy policy) => new() { GeneratedAt = DateTimeOffset.MinValue, Policy = policy }; }