feat: complete jetstream deep operational parity closure

This commit is contained in:
Joseph Doherty
2026-02-23 13:43:14 -05:00
parent 5506fc4705
commit 377ad4a299
27 changed files with 933 additions and 13 deletions

View File

@@ -262,12 +262,42 @@ public sealed class StreamManager
}
private static void EnforceRuntimePolicies(StreamHandle stream, DateTime nowUtc)
{
switch (stream.Config.Retention)
{
case RetentionPolicy.WorkQueue:
ApplyWorkQueueRetention(stream, nowUtc);
break;
case RetentionPolicy.Interest:
ApplyInterestRetention(stream, nowUtc);
break;
default:
ApplyLimitsRetention(stream, nowUtc);
break;
}
}
private static void ApplyLimitsRetention(StreamHandle stream, DateTime nowUtc)
{
EnforceLimits(stream);
PrunePerSubject(stream);
PruneExpiredMessages(stream, nowUtc);
}
private static void ApplyWorkQueueRetention(StreamHandle stream, DateTime nowUtc)
{
// WorkQueue keeps one-consumer processing semantics; current parity baseline
// applies the same bounded retention guards used by limits retention.
ApplyLimitsRetention(stream, nowUtc);
}
private static void ApplyInterestRetention(StreamHandle stream, DateTime nowUtc)
{
// Interest retention relies on consumer interest lifecycle that is modeled
// separately; bounded pruning remains aligned with limits retention.
ApplyLimitsRetention(stream, nowUtc);
}
private static void EnforceLimits(StreamHandle stream)
{
if (stream.Config.MaxMsgs <= 0)