From 6763fc6a467930c4b34727c7314016b81646e6de Mon Sep 17 00:00:00 2001 From: Nicolas del Valle Date: Fri, 10 May 2024 18:21:53 +0700 Subject: [PATCH 1/4] Add documentation to lib.rs --- src/lib.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index cba3d99..f4374cc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,23 @@ +//! Rustdis is a partial Redis server implementation intended purely for educational purposes. +//! +//! The primary goal of rustdis is to offer a straightforward and comprehensible implementation, +//! with no optimization techniques to ensure the code remains accessible and easy to understand. +//! As of now, rustdis focuses exclusively on implementing Redis' String data type and its +//! associated methods. You can find more about Redis strings here: [Redis +//! Strings](https://redis.io/docs/data-types/strings/). +//! +//! # Architecture +//! +//! * `server`: Redis server module. Provides a run function that initiates the server, enabling it +//! to begin handling incoming connections from Redis clients. It manages client requests, executes +//! Redis commands, and handles connection lifecycles. +//! +//! * `connection`: The Connection module manages a TCP connection for a Redis client. It separates +//! the TCP stream into readable and writable components to facilitate data consumption and +//! transmission. The server uses this connection module to read data from the TCP connection. +//! Additionally, the connection module uses the codec module to convert raw TCP bytes into +//! comprehensible data structures (Frames). + pub mod codec; pub mod commands; pub mod connection; From bd2e18d6a0f7204de05a564d07ce3243111d4828 Mon Sep 17 00:00:00 2001 From: Nicolas del Valle Date: Sat, 18 May 2024 23:05:27 +0700 Subject: [PATCH 2/4] Update lib.rs documentation --- src/lib.rs | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 82 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f4374cc..8628e10 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,8 +15,88 @@ //! * `connection`: The Connection module manages a TCP connection for a Redis client. It separates //! the TCP stream into readable and writable components to facilitate data consumption and //! transmission. The server uses this connection module to read data from the TCP connection. -//! Additionally, the connection module uses the codec module to convert raw TCP bytes into -//! comprehensible data structures (Frames). +//! +//! * `codec`: This module is responsible for decoding raw TCP byte streams into `Frame` data +//! structures. This is an essential component for translating incoming client requests into +//! meaningful Redis commands. +//! +//! * `frame`: This module defines the `Frame` enum, representing different types of Redis protocol +//! messages, and provides parsing and serialization functionalities. It adheres to the RESP (Redis +//! Serialization Protocol) specifications. +//! +//! * `store`: This module provides a simple key-value store for managing Redis string data types. +//! It supports basic operations such as setting, getting, removing, and incrementing values +//! associated with keys. +//! +//! +--------------------------------------+ +//! | Redis Client | +//! +-------------------+------------------+ +//! | +//! | Request (e.g., SET key value) +//! v +//! +-------------------+------------------+ +//! | Server | +//! | (module: server, function: run) | +//! +-------------------+------------------+ +//! | +//! | Accept Connection +//! v +//! +-------------------+------------------+ +//! | Connection | +//! | (module: connection, manages TCP | +//! | connections and streams) | +//! +-------------------+------------------+ +//! | +//! | Read Data from TCP Stream +//! v +//! +-------------------+------------------+ +//! | Codec | +//! | (module: codec, function: decode) | +//! +-------------------+------------------+ +//! | +//! | Decode Request +//! v +//! +-------------------+------------------+ +//! | Frame | +//! | (module: frame, function: parse) | +//! +-------------------+------------------+ +//! | +//! | Parse Command and Data +//! v +//! +-------------------+------------------+ +//! | Store | +//! | (module: store, manages key-value | +//! | data storage) | +//! +-------------------+------------------+ +//! | +//! | Execute Command (e.g., set, get, incr_by) +//! v +//! +-------------------+------------------+ +//! | Frame | +//! | (module: frame, function: serialize)| +//! +-------------------+------------------+ +//! | +//! | Encode Response +//! v +//! +-------------------+------------------+ +//! | Codec | +//! | (module: codec, function: encode) | +//! +-------------------+------------------+ +//! | +//! | Write Data to TCP Stream +//! v +//! +-------------------+------------------+ +//! | Connection | +//! | (module: connection, manages TCP | +//! | connections and streams) | +//! +-------------------+------------------+ +//! | +//! | Send Response +//! v +//! +-------------------+------------------+ +//! | Redis Client | +//! +--------------------------------------+ +//! pub mod codec; pub mod commands; From 9ac3fec22b03c98d98af3d22dbb981864390b440 Mon Sep 17 00:00:00 2001 From: Nicolas del Valle Date: Sat, 18 May 2024 23:11:45 +0700 Subject: [PATCH 3/4] Wrap asci art with text tag --- src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 8628e10..d94959e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -28,6 +28,8 @@ //! It supports basic operations such as setting, getting, removing, and incrementing values //! associated with keys. //! +//! ```text +//! //! +--------------------------------------+ //! | Redis Client | //! +-------------------+------------------+ @@ -97,6 +99,7 @@ //! | Redis Client | //! +--------------------------------------+ //! +//! ``` pub mod codec; pub mod commands; From bd9091a539e0ab0e618bf890d5fdd6e396ad5302 Mon Sep 17 00:00:00 2001 From: Nicolas del Valle Date: Mon, 20 May 2024 19:01:52 +0700 Subject: [PATCH 4/4] Update src/lib.rs Co-authored-by: Christian Gill --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index d94959e..2af865d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,8 +3,8 @@ //! The primary goal of rustdis is to offer a straightforward and comprehensible implementation, //! with no optimization techniques to ensure the code remains accessible and easy to understand. //! As of now, rustdis focuses exclusively on implementing Redis' String data type and its -//! associated methods. You can find more about Redis strings here: [Redis -//! Strings](https://redis.io/docs/data-types/strings/). +//! associated methods. You can find more about Redis strings here: +//! [Redis Strings](https://redis.io/docs/data-types/strings/). //! //! # Architecture //!