feat: add MemStore Go-parity methods & 25 new tests (Task 3)

Port Go memstore sync interface: Compact, Truncate, PurgeEx, SkipMsgs,
LoadNextMsg, NumPending, MultiLastSeqs, AllLastSeqs, SubjectsTotals,
SubjectsState, GetSeqFromTime, NextWildcardMatch, NextLiteralMatch,
MessageTTL, UpdateConfig. Fix RestoreSnapshotAsync to handle gapped
sequences, update MsgSize to include subject length + 16 overhead
(Go parity).

25 new tests ported from memstore_test.go.
This commit is contained in:
Joseph Doherty
2026-02-24 20:17:42 -05:00
parent 7eb06c8ac5
commit f35961abea
3 changed files with 2095 additions and 50 deletions

View File

@@ -216,7 +216,9 @@ public sealed class MemStoreTests
await store.AppendAsync("foo", payload, default);
var state = await store.GetStateAsync(default);
state.Bytes.ShouldBe((ulong)500);
// Go parity: MsgSize = subj.Length + hdr + data + 16 overhead
// "foo"(3) + 100 + 16 = 119 per msg × 5 = 595
state.Bytes.ShouldBe((ulong)595);
}
// Go: TestMemStoreBytesLimit server/memstore_test.go
@@ -233,7 +235,9 @@ public sealed class MemStoreTests
await store.RemoveAsync(3, default);
var state = await store.GetStateAsync(default);
state.Bytes.ShouldBe((ulong)300);
// Go parity: MsgSize = subj.Length + hdr + data + 16 overhead
// "foo"(3) + 100 + 16 = 119 per msg × 3 remaining = 357
state.Bytes.ShouldBe((ulong)357);
}
// Snapshot and restore.