Files
natsnet/docs/plans/phases/phase6sessions/session-19.md
Joseph Doherty 88b1391ef0 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.
2026-02-26 13:16:56 -05:00

68 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Session 19: JetStream Core
## Summary
JetStream engine core — initialization, API handlers, error definitions, event types, versioning, and batching. The central JetStream coordination layer.
## Scope
| Go File | Features | Feature IDs | Go LOC |
|---------|----------|-------------|--------|
| server/jetstream.go | 84 | 13681451 | 2,481 |
| server/jetstream_api.go | 56 | 14521507 | 4,269 |
| server/jetstream_errors.go | 5 | 17511755 | 62 |
| server/jetstream_errors_generated.go | 203 | 17561958 | 1,924 |
| server/jetstream_events.go | 1 | 1959 | 25 |
| server/jetstream_versioning.go | 13 | 19601972 | 175 |
| server/jetstream_batching.go | 12 | 15081519 | 568 |
| **Total** | **374** | | **9,504** |
## .NET Classes
- `JetStreamEngine` — JetStream lifecycle, enable/disable, account tracking
- `JetStreamApi` — REST-like API handlers for stream/consumer CRUD
- `JetStreamErrors` — error code registry (208 entries)
- `JetStreamEvents` — advisory event types
- `JetStreamVersioning` — feature version compatibility
- `JetStreamBatching` — batch message processing
- `JsAccount` — per-account JetStream state
- `JsOutQ` — JetStream output queue
## Test Files
| Test File | Tests | Test IDs |
|-----------|-------|----------|
| server/jetstream_test.go | 320 | 14661785 |
| server/jetstream_errors_test.go | 4 | 13811384 |
| server/jetstream_versioning_test.go | 18 | 17911808 |
| server/jetstream_batching_test.go | 29 | 716744 |
| server/jetstream_jwt_test.go | 18 | 13851402 |
| server/jetstream_tpm_test.go | 5 | 17861790 |
| server/jetstream_benchmark_test.go | 12 | 745756 |
| **Total** | **406** | |
## Dependencies
- Session 01 (Foundation Types)
- Session 03 (Configuration)
- Session 08 (Client Connection)
- Session 09 (Server Core Part 1)
- Session 11 (Accounts)
- Session 17 (Store Interfaces)
## .NET Target Location
- `dotnet/src/ZB.MOM.NatsNet.Server/JetStream/`
## Notes
- **This is a multi-sitting session** — 9.5K Go LOC and 406 tests
- JetStream errors generated file is 203 features but mostly boilerplate error codes
- jetstream_test.go has 320 tests — the largest test file
- Suggested sub-batching:
- **19a**: Error definitions and events (209 features, 2K LOC) — mostly mechanical
- **19b**: JetStream engine core (84 features, 2.5K LOC)
- **19c**: JetStream API (56 features, 4.3K LOC)
- **19d**: Versioning + batching (25 features, 743 LOC)
- **19e**: Tests (406 tests, batched by test file)