How ankitkr-04/strata-db works
StrataDB is an embedded C++ key-value engine whose implemented path centers on configuration and concurrency-safe memory foundations, a concurrent SkipList memtable, and write-ahead logging. The WAL accepts batches, stages blocks through a hardware-selected queue pipeline, and persists them in rotating segments; its reader and validators support crash recovery. Configuration, allocation, platform probing, and POSIX I/O are supporting layers. The README also describes memtable flush integration and BlockPool, but sampled excerpts do not expose all caller relationships. Planned SSTables, compaction, and interfaces are omitted as unimplemented.
Main entry points: manager.cpp WAL manager · pipeline_variant.hpp Hardware pipeline variants · reader.cpp WAL recovery reader · pipeline.hpp WAL staging pipeline
Components 22
Configuration
- Config manager
src/config/config_manager.cpp - Config resolver
src/config/config_resolver.cpp
Memory and concurrency
- Epoch manager
src/memory/epoch_manager.cpp - Arena allocator
src/memory/arena.cpp - Virtual region
src/memory/virtual_region.cpp - Thread-local buffers
src/memory/tlab.cpp - Block pool
src/memory/block_pool.cpp
Key-value staging
- SkipList memtable
src/memtable/skiplist_memtable.cpp - SkipList node layout
src/memtable/skiplist_node.cpp
Durability and recovery
- WAL manager
src/wal/manager.cpp - WAL staging pipeline
include/stratadb/wal/pipeline.hpp - Hardware pipeline variants
include/stratadb/wal/pipeline_variant.hpp - WAL block formats
include/stratadb/wal/block - Handoff queues
include/stratadb/wal/queue - WAL segment pool
src/wal/pool/segment_pool.cpp - WAL recovery reader
src/wal/reader/reader.cpp - Block validator
include/stratadb/wal/reader/validator.hpp
Platform services
- POSIX I/O engine
src/io/posix_io_engine.cpp - OS file services
src/utils/os.cpp - Hardware probe
src/platform/hardware_probe.cpp - Database identity
src/platform/identity.cpp
Other components
- Database caller
Connections 24
- Database caller → SkipList memtable: updates and reads
- Database caller → WAL manager: writes batches
- Config resolver → Config manager: provides configuration
- Config manager → Epoch manager: pins snapshots
- Thread-local buffers → Arena allocator: refills from
- Arena allocator → Virtual region: uses regions
- SkipList memtable → SkipList node layout: uses nodes
- WAL manager → Hardware pipeline variants: selects pipeline
src/wal/manager.cpp - Hardware pipeline variants → WAL staging pipeline: instantiates
include/stratadb/wal/pipeline_variant.hpp - Hardware pipeline variants → WAL block formats: selects format
include/stratadb/wal/pipeline_variant.hpp - Hardware pipeline variants → Handoff queues: selects queue
include/stratadb/wal/pipeline_variant.hpp - WAL staging pipeline → Block pool: acquires blocks
include/stratadb/wal/pipeline.hpp - WAL staging pipeline → Handoff queues: dispatches blocks
- WAL manager → WAL segment pool: constructs pool
src/wal/manager.cpp - WAL manager → POSIX I/O engine: writes WAL
- WAL manager → Config manager: reads mutable config
src/wal/manager.cpp - WAL manager → Epoch manager: registers flusher
src/wal/manager.cpp - WAL manager → Hardware probe: uses capabilities
- WAL manager → Database identity: uses database identity
- WAL recovery reader → WAL segment pool: scans snapshots
src/wal/reader/reader.cpp - WAL recovery reader → Block validator: validates blocks
- WAL recovery reader → OS file services: reads WAL files
src/wal/reader/reader.cpp - WAL segment pool → OS file services: manages segment files
src/wal/pool/segment_pool.cpp - POSIX I/O engine → OS file services: uses POSIX calls