How tejas-techstack/huus works
Huus is a persistent, integer-oriented B+ tree key-value store. The primary workflow starts at the CLI, reads REPL commands, parses them, dispatches CRUD operations, and persists tree pages to a database file. The engine also includes split and deletion-rebalancing logic, stack-based traversal support, and binary encoding. Several engine relationships are documented in the README, but their call sites were not sampled; those links are shown as documented rather than inferred from imports. The command-line UPDATE branch currently parses input without updating the tree.
Main entry points: storage.go Storage coordinator · crud.go CRUD API · repl.go REPL loop · delete_helpers.go Delete rebalancing
Components 16
User interface
- CLI entry
cmd/main.go - REPL loop
internal/engine/repl.go - Command parser
internal/parser/lychee.go
B+ tree engine
- CRUD API
internal/engine/crud.go - Tree search
internal/engine/helpers.go - Insertion logic
internal/engine/insert_helpers.go - Delete rebalancing
internal/engine/delete_helpers.go - Node splitting
internal/engine/split.go - Traversal stack
internal/engine/btstack.go - Tree structures
internal/engine/types.go - Tree initialization
internal/engine/config.go
Persistence
- Storage coordinator
internal/engine/storage.go - Page management
internal/engine/pager.go - Binary encoding
internal/engine/encoding.go - Database file
Other components
- CLI user
Connections 17
- CLI user → CLI entry: starts
README.md - CLI entry → REPL loop: starts loop
cmd/main.go - REPL loop → Command parser: parses commands
internal/engine/repl.go - REPL loop → CRUD API: dispatches operations
internal/engine/repl.go - CRUD API → Tree search: searches tree
- CRUD API → Insertion logic: inserts values
- CRUD API → Delete rebalancing: deletes keys
- Insertion logic → Node splitting: splits nodes
- Delete rebalancing → Traversal stack: tracks ancestors
internal/engine/delete_helpers.go - Node splitting → Tree structures: updates nodes
internal/engine/split.go - Delete rebalancing → Storage coordinator: loads and updates
internal/engine/delete_helpers.go - Node splitting → Storage coordinator: loads and updates
internal/engine/split.go - Tree initialization → Storage coordinator: opens storage
- Storage coordinator → Page management: uses page operations
internal/engine/pager.go - Storage coordinator → Binary encoding: encodes metadata
internal/engine/storage.go - Storage coordinator → Database file: reads and writes
internal/engine/storage.go - CRUD API → Storage coordinator: persists tree