Skip to content

ReWar1311/RDX-database

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dev in progress

Checklist

  • Stage 1

    • Setup TCP server
    • Make RESP command Parser
    • Hashmap to store key-value
    • PING, ECHO, GET, SET commands
    • RESP2 parser for arrays and bulk strings
    • Implement custom hash to enhance searching and add more data types.
    • Update Db to store (value, Option<expire_at>)
    • Implement EXPIRE command (if key expired, return nil)
    • Impliment Other required Commands
    • Background task to remove expired keys (periodic cleanup)
  • Stage 2

    • Impliment Lists → push/pop, range commands
    • Impliment Sets → add, remove, exists, union, intersection
    • Impliment Hashes → hset, hget, hgetall
    • Impliment Sorted Sets → zadd, zrange, zscore
  • Stage 3

    • RDB snapshots → Periodically save Db to file.
    • AOF (Append-Only File) → Log each write command.
    • On restart → load RDB or replay AOF.
  • Stage 4

    • Implement LRU or LFU policies.
    • Trigger eviction when memory limit reached.
    • Implement PUBLISH, SUBSCRIBE commands.
    • Notify subscribed clients asynchronously.
  • Stage 5

    • Implement master-replica replication.
    • Maintain backlog for partial sync , Support multiple replicas.
    • Benchmark using redis-benchmark
    • Optimize RwLock usage, sharding, and skip lists for sorted sets.
    • Inspect Memory usage

RDX - Redis in Rust

A lightweight Redis-compatible server implementation written in Rust with Tokio. This project implements basic Redis functionality with an in-memory database.

Features

  • Redis protocol (RESP) support
  • In-memory key-value storage
  • Asynchronous I/O with Tokio
  • Thread-safe concurrent access

Supported Commands

  • PING - Test server connectivity
  • ECHO - Echo the given string
  • SET - Set a key to hold a string value
  • GET - Get the value of a key

Installation

Prerequisites

  • Rust and Cargo (latest stable version)

Build

git clone https://github.com/ReWar1311/RDX-database.git
cd RDX-database
cargo build --release

The compiled binary will be available at RDX.

Usage

Running the Server

cargo run --release

The server will start listening on 127.0.0.1:6379.

Connecting with redis-cli

You can use the standard Redis CLI to interact with RDX:

redis-cli

Example Commands

127.0.0.1:6379> PING
PONG
127.0.0.1:6379> ECHO hello
"hello"
127.0.0.1:6379> SET mykey "Hello World"
OK
127.0.0.1:6379> GET mykey
"Hello World"

Implementation Details

RDX is built using:

  • Tokio for asynchronous I/O
  • Rust's standard library for data structures (HashMap)
  • RESP (Redis Serialization Protocol) for client-server communication

Future Improvements

  • Support for more Redis commands
  • Persistence options
  • Pub/Sub functionality
  • Cluster mode

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages