# 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 | 3164–3194 | 391 |
| server/memstore.go | 98 | 2068–2165 | 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 | 2941–2957 |
| server/memstore_test.go | 41 | 2023–2063 |
| **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)
