# Session 05: Subscription Index

## Summary

The subscription list (sublist) — a trie-based data structure for matching NATS subjects to subscriptions. Core to message routing performance.

## Scope

| Go File | Features | Feature IDs | Go LOC |
|---------|----------|-------------|--------|
| server/sublist.go | 81 | 3404–3484 | 1,416 |
| **Total** | **81** | | **1,416** |

## .NET Classes

- `SubscriptionIndex` — trie-based subject matching
- `SubscriptionIndexResult` — match result container
- `SublistStats` — statistics for the subscription index

## Test Files

| Test File | Tests | Test IDs |
|-----------|-------|----------|
| server/sublist_test.go | 96 | 2962–3057 |
| **Total** | **96** | |

## Dependencies

- Session 01 (Foundation Types)
- Session 02 (Utilities — subject parsing helpers)

## .NET Target Location

- `dotnet/src/ZB.MOM.NatsNet.Server/Internal/DataStructures/SubscriptionIndex.cs`

## Notes

- Performance-critical: hot path for every message published
- Use `ReadOnlySpan<byte>` for subject matching on hot paths
- The existing `SubjectTree` (already ported in stree module) is different from this — sublist is the subscription matcher
