feat: implement SubscriptionIndex + JetStreamMemStore cluster — 39 features verified

Add SubscriptionIndex factory methods, notification wrappers, and
ValidateMapping. Implement 24 MemStore methods (TTL, scheduling, SDM,
age-check, purge/compact/reset) with JetStream header helpers and
constants. Verified features: 987 → 1026.
This commit is contained in:
Joseph Doherty
2026-02-27 06:19:47 -05:00
parent 4e61314c1c
commit ba4f41cf71
9 changed files with 897 additions and 8 deletions

View File

@@ -1096,6 +1096,14 @@ public sealed class SubscriptionIndex
return false;
}
// Write lock must be held.
private Exception? AddInsertNotify(string subject, Action<bool> notify)
=> AddNotify(_notify!.Insert, subject, notify);
// Write lock must be held.
private Exception? AddRemoveNotify(string subject, Action<bool> notify)
=> AddNotify(_notify!.Remove, subject, notify);
private static Exception? AddNotify(Dictionary<string, List<Action<bool>>> m, string subject, Action<bool> notify)
{
if (m.TryGetValue(subject, out var chs))
@@ -1531,6 +1539,9 @@ public sealed class SubscriptionIndex
public List<Subscription>? PList;
public SublistLevel? Next;
/// <summary>Factory method matching Go's <c>newNode()</c>.</summary>
public static SublistNode NewNode() => new();
public bool IsEmpty()
{
return PSubs.Count == 0 && (QSubs == null || QSubs.Count == 0) &&
@@ -1544,6 +1555,9 @@ public sealed class SubscriptionIndex
public SublistNode? Pwc;
public SublistNode? Fwc;
/// <summary>Factory method matching Go's <c>newLevel()</c>.</summary>
public static SublistLevel NewLevel() => new();
public int NumNodes()
{
var num = Nodes.Count;