feat: integrate hunos web server + jwt-nim-baraba + real WAL recovery + compaction

HTTP Server:
- Replaced asynchttpserver with hunos (multi-threaded, trie router, CORS middleware)
- JWT authentication via jwt-nim-baraba (HS256 with BearSSL crypto)
- POST /query, GET /health, GET /metrics, POST /auth, GET /api (OpenAPI spec)
- Proper CORS headers via hunos corsMiddleware

WAL Recovery:
- recover() now actually applies committed entries (REDO)
- Skips uncommitted entries (UNDO)
- Takes optional LSMTree parameter to apply recovery

SSTable Compaction:
- Real compaction: reads SSTable entries, merges by key (newest wins), writes merged file
- Deduplication: keeps only newest version per key
- Tombstone cleanup: removes deleted entries
- Old SSTable files deleted after merge

Dependencies:
- Added hunos >= 1.2.0 and jwt >= 2.1.0 to nimble

SSTable fields exported for compaction access.

All 216 tests pass
This commit is contained in:
2026-05-06 13:42:37 +03:00
parent a7e274d846
commit 1fb715a1d4
5 changed files with 216 additions and 126 deletions
+7 -7
View File
@@ -31,13 +31,13 @@ type
SSTable* = object
path*: string
index: Table[string, int64] # key -> file offset in data block
bloom: BloomFilter
level: int
minKey: string
maxKey: string
entryCount: int
mmapFile: MmapFile
index*: Table[string, int64]
bloom*: BloomFilter
level*: int
minKey*: string
maxKey*: string
entryCount*: int
mmapFile*: MmapFile
LSMTree* = ref object
dir: string