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.
51 lines
1.7 KiB
Markdown
51 lines
1.7 KiB
Markdown
# Session 18: File Store
|
||
|
||
## Summary
|
||
|
||
The persistent file-based storage engine for JetStream. Handles message persistence, compaction, encryption, compression, and recovery. This is the largest single-file session.
|
||
|
||
## Scope
|
||
|
||
| Go File | Features | Feature IDs | Go LOC |
|
||
|---------|----------|-------------|--------|
|
||
| server/filestore.go | 312 | 951–1262 | 11,421 |
|
||
| **Total** | **312** | | **11,421** |
|
||
|
||
## .NET Classes
|
||
|
||
- `JetStreamFileStore` — file-based stream store (174 features, 7,255 LOC)
|
||
- `MessageBlock` — individual message block on disk (95 features, 3,314 LOC)
|
||
- `ConsumerFileStore` — file-based consumer store (33 features, 700 LOC)
|
||
- `CompressionInfo` — compression metadata
|
||
- `ErrBadMsg` — bad message error type
|
||
|
||
## Test Files
|
||
|
||
| Test File | Tests | Test IDs |
|
||
|-----------|-------|----------|
|
||
| server/filestore_test.go | 249 | 351–599 |
|
||
| **Total** | **249** | |
|
||
|
||
## Dependencies
|
||
|
||
- Session 01 (Foundation Types)
|
||
- Session 02 (Utilities)
|
||
- Session 17 (Store Interfaces)
|
||
|
||
## .NET Target Location
|
||
|
||
- `dotnet/src/ZB.MOM.NatsNet.Server/JetStream/Storage/`
|
||
|
||
## Notes
|
||
|
||
- **This is a multi-sitting session** — 11.4K Go LOC and 249 tests
|
||
- Suggested sub-batching:
|
||
- **18a**: `MessageBlock` (95 features, 3.3K LOC) — the on-disk block format
|
||
- **18b**: `JetStreamFileStore` core (load, store, recover, compact) — ~90 features
|
||
- **18c**: `JetStreamFileStore` remaining (snapshots, encryption, purge) — ~84 features
|
||
- **18d**: `ConsumerFileStore` (33 features, 700 LOC)
|
||
- **18e**: Tests (249 tests)
|
||
- File I/O should use `FileStream` with `RandomAccess` APIs for .NET 10
|
||
- Encryption maps to `System.Security.Cryptography`
|
||
- S2/Snappy compression maps to existing NuGet packages
|