# Session 02: Utilities & Queues

## Summary

General utility functions, IP-based queue, send queue, task scheduler, and subject transform engine. These are infrastructure pieces used across the server.

## Scope

| Go File | Features | Feature IDs | Go LOC |
|---------|----------|-------------|--------|
| server/util.go | 21 | 3485–3505 | 244 |
| server/ipqueue.go | 14 | 1354–1367 | 175 |
| server/sendq.go | 3 | 2971–2973 | 76 |
| server/scheduler.go | 14 | 2952–2965 | 260 |
| server/subject_transform.go | 16 | 3388–3403 | 570 |
| **Total** | **68** | | **1,325** |

## .NET Classes

- `ServerUtilities` — string/byte helpers, random, hashing
- `IpQueue<T>` — lock-free concurrent queue with IP grouping
- `SendQueue` — outbound message queue
- `Scheduler` — time-based task scheduler
- `SubjectTransform` — NATS subject rewriting/mapping engine

## Test Files

| Test File | Tests | Test IDs |
|-----------|-------|----------|
| server/util_test.go | 13 | 3061–3073 |
| server/ipqueue_test.go | 28 | 688–715 |
| server/subject_transform_test.go | 4 | 2958–2961 |
| server/split_test.go | 12 | 2929–2940 |
| **Total** | **57** | |

## Dependencies

- Session 01 (Foundation Types)

## .NET Target Location

- `dotnet/src/ZB.MOM.NatsNet.Server/Internal/`
