Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pumpum7/rust-database

A simple database system with client-server architecture in rust
https://github.com/pumpum7/rust-database

database rust

Last synced: about 1 month ago
JSON representation

A simple database system with client-server architecture in rust

Awesome Lists containing this project

README

        

# Database Project

This project implements a simple database system with a client-server architecture.

## Features

- 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

## Project Structure

- `backend/`: Contains the database server implementation
- `database-client/`: Contains the client implementation

## Getting Started

1. Clone the repository
2. Run `cargo build` to compile the project
3. Start the server with `cargo run`
4. Run the client with `cargo run --bin client`

## Usage

Once connected to the database, you can use the following commands:

- `GET `: Retrieve the value associated with the given key
- `SET `: Set a key-value pair (also supports operations like +, -, ...)
- `UPDATE `: Update an existing key-value pair
- `DEL `: Delete a key-value pair
- `STRLEN `: Get the length of the value associated with the given key
- `STRCAT `: Concatenate the values of two keys and store the result in a third key
- `SUBSTR `: Get a substring of the value associated with the given key
- `exit`: Quit the client
- `help`: Display available commands

### Expression Examples:
- `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.

## Future Improvements

- Improve error handling and logging

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.