acdream/src/AcDream.App/Rendering/Residency/DelegateResidencyDomainSource.cs
Erik 1853a57c12 feat(diagnostics): complete residency pressure ledger
Complete Slice D4 by adding aggregate lifecycle occupancy and traffic facts, validating physical source reports, and including decoded audio under the typed startup budget. Exercise every domain under forced pressure and retain the real cache/fence convergence gates.
2026-07-24 16:40:17 +02:00

23 lines
741 B
C#

namespace AcDream.App.Rendering.Residency;
internal sealed class DelegateResidencyDomainSource(
ResidencyDomain domain,
Func<ResidencyDomainSnapshot> capture) : IResidencyDomainSource
{
private readonly Func<ResidencyDomainSnapshot> _capture =
capture ?? throw new ArgumentNullException(nameof(capture));
public ResidencyDomain Domain { get; } = domain;
public ResidencyDomainSnapshot CaptureResidency()
{
ResidencyDomainSnapshot snapshot = _capture();
if (snapshot.Domain != Domain)
{
throw new InvalidOperationException(
$"Residency source {Domain} returned {snapshot.Domain}.");
}
snapshot.Validate();
return snapshot;
}
}