Files
natsnet/docs/plans/phases/phase6sessions/session-17.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

1.8 KiB
Raw Blame History

Session 17: Store Interfaces & Memory Store

Summary

Storage abstraction layer (interfaces for streams and consumers) and the in-memory storage implementation. Also includes disk availability checks.

Scope

Go File Features Feature IDs Go LOC
server/store.go 31 31643194 391
server/memstore.go 98 20682165 2,434
server/disk_avail.go 1 827 15
server/disk_avail_netbsd.go 1 828 3
server/disk_avail_openbsd.go 1 829 15
server/disk_avail_solaris.go 1 830 15
server/disk_avail_wasm.go 1 831 3
server/disk_avail_windows.go 1 832 3
Total 135 2,879

.NET Classes

  • StorageEngine — storage interface definitions (StreamStore, ConsumerStore)
  • StoreMsg — stored message type
  • StorageType, StoreCipher, StoreCompression — storage enums
  • DeleteBlocks, DeleteRange, DeleteSlice — deletion types
  • JetStreamMemoryStore — in-memory stream store
  • ConsumerMemStore — in-memory consumer store
  • DiskAvailability — disk space checker (platform-specific)

Test Files

Test File Tests Test IDs
server/store_test.go 17 29412957
server/memstore_test.go 41 20232063
Total 58

Dependencies

  • Session 01 (Foundation Types)
  • Session 02 (Utilities)

.NET Target Location

  • dotnet/src/ZB.MOM.NatsNet.Server/JetStream/Storage/

Notes

  • Store interfaces define the contract for both memory and file stores
  • MemStore is simpler than FileStore — good to port first as a reference implementation
  • Disk availability uses platform-specific syscalls — map to DriveInfo in .NET
  • Most disk_avail variants can be N/A (use .NET cross-platform API instead)