Extend Protocol with Memcached-like Commands and Statistical Actions The current protocol in MerkleKV only supports basic operations: GET, SET, and DELETE. To make the system more powerful and feature-complete, we should extend the protocol with additional Memcached-like commands and statistical operations. Requirements
- Add Numeric Operations • INC [amount] - Increment a numeric value (default increment: 1) • DEC [amount] - Decrement a numeric value (default decrement: 1) • APPEND - Append value to existing string • PREPEND - Prepend value to existing string
- Add Bulk Operations • MGET ... - Get multiple keys in one command • MSET ... - Set multiple key-value pairs • TRUNCATE - Clear all keys/values in the store
- Add Statistical Commands • STATS - Return general server statistics (connections, operations, memory usage) • INFO - Return detailed server information (version, uptime, config) • PING - Simple health check command
- Add Server Management
• VERSION - Return server version
• FLUSH - Force replication of pending changes
• SHUTDOWN - Gracefully shut down the server
Implementation Guidelines
- Update the Command enum in protocol.rs to include new command variants
- Extend the parser logic to handle the new commands
- Implement handlers for each new command in server.rs
- Add comprehensive tests for each new command
- Update documentation to reflect the new protocol capabilities Technical Considerations • All numeric operations should validate that values are valid numbers • Statistical operations should collect metrics from various parts of the system • Consider backward compatibility with existing clients • Update relevant integration tests m Medium - This enhancement will significantly improve the functionality of MerkleKV without affecting the current core functionality."