feat: port session 07 — Protocol Parser, Auth extras (TPM/certidp/certstore), Internal utilities & data structures

Session 07 scope (5 features, 17 tests, ~1165 Go LOC):
- Protocol/ParserTypes.cs: ParserState enum (79 states), PublishArgument, ParseContext
- Protocol/IProtocolHandler.cs: handler interface decoupling parser from client
- Protocol/ProtocolParser.cs: Parse(), ProtoSnippet(), OverMaxControlLineLimit(),
  ProcessPub/HeaderPub/RoutedMsgArgs/RoutedHeaderMsgArgs, ClonePubArg(), GetHeader()
- tests/Protocol/ProtocolParserTests.cs: 17 tests via TestProtocolHandler stub

Auth extras from session 06 (committed separately):
- Auth/TpmKeyProvider.cs, Auth/CertificateIdentityProvider/, Auth/CertificateStore/

Internal utilities & data structures (session 06 overflow):
- Internal/AccessTimeService.cs, ElasticPointer.cs, SystemMemory.cs, ProcessStatsProvider.cs
- Internal/DataStructures/GenericSublist.cs, HashWheel.cs
- Internal/DataStructures/SubjectTree.cs, SubjectTreeNode.cs, SubjectTreeParts.cs

All 461 tests pass (460 unit + 1 integration). DB updated for features 2588-2592 and tests 2598-2614.
This commit is contained in:
Joseph Doherty
2026-02-26 13:16:56 -05:00
parent 0a54d342ba
commit 88b1391ef0
56 changed files with 9006 additions and 6 deletions

View File

@@ -0,0 +1,53 @@
# Session 12: Events, Monitoring & Message Tracing
## Summary
Server-side event system (system events, advisory messages), HTTP monitoring endpoints (varz, connz, routez, etc.), and message tracing infrastructure.
## Scope
| Go File | Features | Feature IDs | Go LOC |
|---------|----------|-------------|--------|
| server/events.go | 97 | 854950 | 2,445 |
| server/monitor.go | 70 | 21662235 | 3,257 |
| server/monitor_sort_opts.go | 16 | 22362251 | 48 |
| server/msgtrace.go | 35 | 24052439 | 569 |
| **Total** | **218** | | **6,319** |
## .NET Classes
- `EventsHandler` — system event publishing
- `MonitoringHandler` — HTTP monitoring endpoints
- `ConnInfo`, `ClosedState` — connection monitoring types
- `HealthZErrorType` — health check error types
- `MsgTrace`, `MsgTraceEvent`, `MsgTraceEvents` — message tracing
- `MessageTracer` — tracing engine
- Various sort option types (16 types)
## Test Files
| Test File | Tests | Test IDs |
|-----------|-------|----------|
| server/events_test.go | 52 | 299350 |
| server/monitor_test.go | 103 | 20642166 |
| server/msgtrace_test.go | 33 | 23292361 |
| **Total** | **188** | |
## Dependencies
- Session 01 (Foundation Types)
- Session 08 (Client Connection)
- Session 09 (Server Core Part 1)
- Session 11 (Accounts)
## .NET Target Location
- `dotnet/src/ZB.MOM.NatsNet.Server/Monitoring/`
- `dotnet/src/ZB.MOM.NatsNet.Server/Events/`
## Notes
- Monitor endpoints map to ASP.NET Core minimal API or controller endpoints
- Events system uses internal pub/sub — publishes to `$SYS.*` subjects
- This is a larger session (~6.3K LOC) but the code is relatively straightforward
- Monitor has 103 tests — allocate time accordingly