# Session 01: Foundation Types ## Summary Constants, error types, error catalog, protocol definitions, ring buffer, rate counter, stream distribution model, and NKey utilities. These are the leaf types with no internal dependencies — everything else builds on them. ## Scope | Go File | Features | Feature IDs | Go LOC | |---------|----------|-------------|--------| | server/const.go | 2 | 582–583 | 18 | | server/errors.go | 15 | 833–847 | 92 | | server/errors_gen.go | 6 | 848–853 | 158 | | server/proto.go | 6 | 2593–2598 | 237 | | server/ring.go | 6 | 2889–2894 | 34 | | server/rate_counter.go | 3 | 2797–2799 | 34 | | server/sdm.go | 5 | 2966–2970 | 39 | | server/nkey.go | 3 | 2440–2442 | 14 | | **Total** | **46** | | **626** | ## .NET Classes - `Constants` — server constants and version info - `ServerErrorCatalog` — generated error codes and messages - `Protocol` — NATS protocol string constants - `RingBuffer` — fixed-size circular buffer - `RateCounter` — sliding window rate measurement - `StreamDistributionModel` — stream distribution enum/types - `NkeyUser` — NKey authentication types ## Test Files | Test File | Tests | Test IDs | |-----------|-------|----------| | server/errors_test.go | 2 | 297–298 | | server/ring_test.go | 2 | 2794–2795 | | server/rate_counter_test.go | 1 | 2720 | | server/nkey_test.go | 9 | 2362–2370 | | server/trust_test.go | 3 | 3058–3060 | | **Total** | **17** | | ## Dependencies - None (leaf session) ## .NET Target Location - `dotnet/src/ZB.MOM.NatsNet.Server/` — types and enums at root or `Internal/`