How jenish-1235/nosql-database-simulation-implementation works
This repository is a FastAPI-backed key-value database simulation. Requests enter through the API: writes update the in-memory table and append to the write-ahead log; reads check memory before falling back to SSTables. Startup reconstructs memory from persisted state, and sufficiently large tables are dumped to SSTables. The graph shows these documented flows and file-backed storage. Some storage paths are hard-coded in the sampled managers; unsampled behavior is not inferred.
Main entry points: file_io_manager.py File I/O · database_service.py Database service · database.py Database endpoints · ssTable_manager.py SSTable manager
Components 15
API
- FastAPI app
main.py - API router
api/v1/api.py - Database endpoints
api/v1/endpoints/database.py
Database service
- Database service
services/database_service.py - In-memory table
services/database_service.py - Request data schema
schemas/data.py
Storage managers
- Memtable recovery
core/memTable_manager.py - WAL manager
core/WAL_manager.py - SSTable manager
core/ssTable_manager.py - File I/O
core/file_io_manager.py - SSTable model
schemas/sorted_set_table.py
Persistent storage
- WAL file
persistent-storage/wal_file.txt - SSTable file
persistent-storage/sst_file.txt - SSTable ID file
persistent-storage/sstable_ids.txt
Other components
- API client
Connections 18
- API client → FastAPI app: sends requests
- FastAPI app → API router: mounts routes
main.py - API router → Database endpoints: registers routes
api/v1/api.py - API client → Database endpoints: calls endpoints
- Database endpoints → Database service: reads and writes
api/v1/endpoints/database.py - Database endpoints → WAL manager: appends writes
api/v1/endpoints/database.py - Database service → In-memory table: updates and checks
services/database_service.py - Database service → Memtable recovery: reconstructs from
services/database_service.py - Database service → SSTable manager: reads and dumps
services/database_service.py - Memtable recovery → SSTable manager: loads latest table
core/memTable_manager.py - Memtable recovery → File I/O: reads WAL
core/memTable_manager.py - WAL manager → File I/O: writes records
core/WAL_manager.py - SSTable manager → File I/O: reads and writes
core/ssTable_manager.py - File I/O → WAL file: reads and writes
core/file_io_manager.py - File I/O → SSTable file: reads and writes
core/file_io_manager.py - File I/O → SSTable ID file: reads and writes
core/file_io_manager.py - SSTable manager → SSTable model: creates tables
core/ssTable_manager.py - Database service → SSTable model: creates dump
services/database_service.py