How admin-ac-hub/kv_mem works
Mini LSM-KV is a single-machine persistent key-value engine with vector storage and ANN search. Applications submit puts, deletes, or atomic batches through DB; writes are logged before entering the MemTable, then flushed and compacted into SSTables. Reads use sequence-aware MVCC across memory and disk, while startup replays the Manifest and live WALs. Vector values share this storage lifecycle and support exact search and HNSW search. The graph follows documented architecture and sampled source; several subsystem links are documented capabilities whose implementation was not sampled.
Main entry points: db.cc DB Engine · sstable.cpp SSTable · manifest.cpp Manifest · hnsw_index.cc HNSW Index
Components 16
Database API
- DB Engine
src/db.cc - WriteBatch
src/write_batch.cc - Snapshots MVCC
src/db.cc
Write And Recovery
- Write-Ahead Log
src/wal.cc - MemTable
src/memtable.cc - Flush Compaction
src/db.cc - Manifest
src/manifest.cpp - Recovery
src/db.cc
Read And Storage
- SSTable
src/sstable.cpp - Bloom Filter
src/bloom_filter.cc - Block Cache
src/block_cache.cc - Merge Iterator
include/internal_iterator.h
Vector Search
- Vector Encoding
src/vector_value.cc - Exact Top-K
src/db.cc - HNSW Index
src/hnsw_index.cc
Other components
- Application
Connections 22
- Application → DB Engine: calls
- DB Engine → WriteBatch: applies
- DB Engine → Write-Ahead Log: appends and syncs
- DB Engine → MemTable: updates
- DB Engine → Flush Compaction: schedules
- Flush Compaction → SSTable: flushes and merges
- Flush Compaction → Manifest: publishes version
- DB Engine → Snapshots MVCC: uses sequence
- DB Engine → MemTable: reads
- DB Engine → SSTable: reads
- SSTable → Bloom Filter: checks keys
- SSTable → Block Cache: gets and fills blocks
- DB Engine → Merge Iterator: creates scan
- DB Engine → Manifest: replays on open
- Recovery → Manifest: loads version
- Recovery → SSTable: opens live files
- Recovery → Write-Ahead Log: replays live logs
- DB Engine → Vector Encoding: encodes and decodes
- DB Engine → Exact Top-K: runs baseline search
- DB Engine → HNSW Index: searches and updates
- Flush Compaction → HNSW Index: builds index files
- Recovery → HNSW Index: loads index files