How shigosag/shigosagdb works
ShigosagDB is an educational C++ database engine with a command-line interface, SQL-like command handling, in-memory tables, and file-based persistence. Its main workflow reads commands in the CLI, parses supported queries, dispatches database operations, and stores table records in .tbl files. The README also describes logging, indexing, and transactions; the latter two are marked optional or future-facing there. Some implementation relationships are documented only at the interface level, so the graph avoids guessing about unsampled calls.
Main entry points: main.cpp Command loop · StorageEngine.cpp Storage engine · Database.cpp Database operations · Parser.cpp Query parser
Components 13
Command line
- Command loop
src/main.cpp - Logging
src/utils/Logger.cpp
Query handling
- Query parser
src/parser/Parser.cpp - Tokenizer
src/parser/Tokenizer.cpp - Query model
include/parser/AST.hpp
Database engine
- Database operations
src/core/Database.cpp - Table records
src/core/Table.cpp - Record format
include/core/Record.hpp
Persistence
- Storage engine
src/core/StorageEngine.cpp - Table files
Optional modules
- B+ tree
src/index/BPlusTree.cpp - Transactions and WAL
include/transaction/TransactionManager.hpp
Other components
- CLI user
Connections 10
- CLI user → Command loop: enters commands
src/main.cpp - Command loop → Query parser: parses queries
src/main.cpp - Query parser → Query model: produces query
- Command loop → Database operations: dispatches operations
src/main.cpp - Database operations → Table records: manages tables
- Database operations → Storage engine: loads and saves
README.md - Storage engine → Table files: reads and writes
src/core/StorageEngine.cpp - Storage engine → Record format: serializes records
src/core/StorageEngine.cpp - Storage engine → Table records: loads records into
src/core/StorageEngine.cpp - Command loop → Logging: logs messages
src/main.cpp