How cshekharsharma/universum works
Main Components
• Request Processing Engine: This includes components under the “engine” directory (e.g., commands.go, datastore.go, eviction.go, and snapshot.go) that process client commands, parse them, and route the workflow.
• Storage Engine: Split this into two parts:
• In-Memory Storage: Found under storage/memory (for TTL support and snapshot functionalities).
• Cluster and Distributed Module: Even though multi-node cluster mode is a roadmap feature, the “cluster” directory (gossip, heartbeat, partitions, etc.) should be represented as a supporting module that will eventually interact with the main engine if/when distributed functionalities are enabled.
• Configuration Management: The “config” directory holds config, defaults, TOML parsing, and validation that initialize system settings; show how this layer feeds into other components at startup.
• Compression & Crypto Libraries: Illustrate the “compression” (e.g., LZ4 implementations) and “crypto” (murmur hash) modules as supporting libraries used by the storage layer (and possibly by the network protocol or engine) to improve performance and data integrity.
• Internal Services: Such as the logger in the “internal/logger” and the RESP3 protocol handling (“resp3/resp3.go”), which indicates that responses are formatted according to the RESP3 protocol.
Relationships and Flows
• Bidirectional data flow where applicable (for instance, engine requesting snapshots from storage modules).
• Dependencies such as configuration feeding into both the engine initialization and storage setups.
• That the compression and crypto modules serve as libraries included by the storage components when handling data (e.g., compressing SSTable blocks or hashing keys).
Architectural Patterns and Design Principles
• Separation of concerns: networking layer (server), business logic layer (engine), and data persistence layer (storage).
• Use of modular design—each functionality (cluster, config, compression, crypto) is self-contained, which supports future extensibility, especially toward a distributed design.
• Worker-based multithreaded I/O engine (as mentioned in the README), so lifetime threads handling commands and leveraging worker pools should be marked as part of the engine component.
• Visible patterns like the use of interfaces (e.g., storage/interface.go) that abstract storage so that in-memory and persistent implementations can be switched or combined.