This project implements a simple database system with a client-server architecture.
- TCP-based client-server communication
- Interactive command-line interface for the client
- Basic key-value store operations (GET, SET, UPDATE, DEL)
- B-tree index for efficient data storage and retrieval
backend/: Contains the database server implementationdatabase-client/: Contains the client implementation
- Clone the repository
- Run
cargo buildto compile the project - Start the server with
cargo run - Run the client with
cargo run --bin client
Once connected to the database, you can use the following commands:
GET <key>: Retrieve the value associated with the given keySET <key> <value>: Set a key-value pair (also supports operations like +, -, ...)UPDATE <key> <value>: Update an existing key-value pairDEL <key>: Delete a key-value pairSTRLEN <key>: Get the length of the value associated with the given keySTRCAT <key> <key2>: Concatenate the values of two keys and store the result in a third keySUBSTR <key> <start> <end>: Get a substring of the value associated with the given keyexit: Quit the clienthelp: Display available commands
EXPR(GET 1 + GET 2): Retrieve the value associated with key 1 and key 2, then add them together.EXPR(GET 1 * 2): Retrieve the value associated with key 1 and multiply it by 2.
Use TAB for command completion in the client interface.
- Improve error handling and logging
Contributions are welcome! Please feel free to submit a Pull Request.