Skip to content

sazid/mini-redis-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mini Redis Rust

A very simple implementation of a Redis like server in Rust - for learning purposes (specially the Tokio stack).

Notes:

  • Try to never use unwrap() in production, if you so require, try using expect().
  • In Tokio, a task is the equivalent of terms like green thread, fiber, coroutine, etc.
  • Rust async fn always returns an anonymous impl Future type.
  • Rust async is lazy in nature. Unless .await is called, a Future will never be executed.
  • Use type aliases to clarify and shorten; long types.
  • Sharding is a very basic but awesome concept - allows you to split your data storage into multiple parts (or shards) to reduce contentions for both reads and writes. Check lib.rs for a basic implementation.
  • Use tokio::sync::oneshot instead of callbacks for passing messages around and communicating among different tasks.
  • Pair tokio::sync::mpsc with tasks to create manager tasks that manage communication with services such as db, api clients, etc. See client.rs for an example.

Run

Run the server in one terminal.

cargo run --bin server

Run the client in another terminal.

cargo run --bin client

About

A partial implementation of Redis server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages