Skip to content

Commit fc86f4d

Browse files
committed
Revamp README with expanded overview and docs
Completely reorganize and expand README.md: replace the old compact header with a structured project overview, refreshed badges, and a clear one-line description. Add dedicated sections for Key Features (concurrency, WAL durability, structured data, zero-dependency build), Architecture (diagram), Crash Recovery flow, Project Structure, Installation/Build/Run/Test instructions, Performance Goals, Roadmap, Design Philosophy, and Contributing. Clarify WAL behavior and recovery, provide concrete build/run commands, and improve formatting for readability. Documentation-only change; no code or functional updates.
1 parent 6c56ca2 commit fc86f4d

File tree

1 file changed

+151
-46
lines changed

1 file changed

+151
-46
lines changed

README.md

Lines changed: 151 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,208 @@
11

2-
# ⚡ VoltCache
2+
---
33

4-
<p align="left"> <img src="https://img.shields.io/badge/status-Stable-brightgreen.svg" /> <img src="https://img.shields.io/github/license/arshc0der/VoltCache?color=green" /> <img src="https://img.shields.io/github/stars/arshc0der/VoltCache?style=social" /> <img src="https://img.shields.io/github/forks/arshc0der/VoltCache?style=social" /> <img src="https://img.shields.io/github/issues/arshc0der/VoltCache" /> <img src="https://img.shields.io/github/last-commit/arshc0der/VoltCache" /> <img src="https://img.shields.io/badge/language-C%2B%2B17-00599C?logo=c%2B%2B&logoColor=white" /> <img src="https://img.shields.io/badge/build-CMake-064F8C?logo=cmake&logoColor=white" /> <img src="https://img.shields.io/badge/platform-Windows%20%7C%20Linux-lightgrey" /> <img src="https://img.shields.io/badge/threading-std::shared__mutex-blue" /> <img src="https://img.shields.io/badge/persistence-Write--Ahead%20Logging-orange" /> <img src="https://img.shields.io/badge/testing-Python%20Integration%20Suite-yellow" /> <img src="https://img.shields.io/badge/dependencies-Zero-success" /> </p>
4+
# ⚡ VoltCache
55

6-
<p align="center">
7-
<img src="https://raw.githubusercontent.com/arshc0der/VoltCache/refs/heads/main/Testing/preview/logo.png" width="100%" alt="VoltCache"/>
6+
### High-Performance In-Memory Key-Value Engine (C++17)
7+
<p align="center"> <img src="https://raw.githubusercontent.com/arshc0der/VoltCache/refs/heads/main/Testing/preview/logo.png" width="100%" alt="VoltCache"/> </p>
8+
<p align="left">
9+
<img src="https://img.shields.io/badge/status-Stable-brightgreen.svg" />
10+
<img src="https://img.shields.io/github/license/arshc0der/VoltCache?color=green" />
11+
<img src="https://img.shields.io/github/stars/arshc0der/VoltCache?style=social" />
12+
<img src="https://img.shields.io/github/forks/arshc0der/VoltCache?style=social" />
13+
<img src="https://img.shields.io/github/issues/arshc0der/VoltCache" />
14+
<img src="https://img.shields.io/github/last-commit/arshc0der/VoltCache" />
15+
<img src="https://img.shields.io/badge/language-C%2B%2B17-00599C?logo=c%2B%2B&logoColor=white" />
16+
<img src="https://img.shields.io/badge/build-CMake-064F8C?logo=cmake&logoColor=white" />
17+
<img src="https://img.shields.io/badge/architecture-Multithreaded-critical" />
18+
<img src="https://img.shields.io/badge/concurrency-Reader--Writer%20Lock-blueviolet" />
19+
<img src="https://img.shields.io/badge/persistence-Write--Ahead%20Logging-orange" />
20+
<img src="https://img.shields.io/badge/dependencies-Zero-success" />
821
</p>
922

10-
> **Status:** High-performance in-memory engine with completed Durability (WAL) and Thread-Safe Concurrency layers.
23+
---
24+
25+
## 🚀 Overview
26+
27+
**VoltCache** is a lightweight, high-performance, multithreaded in-memory key-value store built in **C++17**.
1128

12-
VoltCache is a lightweight, multithreaded in-memory key-value store built with **C++17**. It is designed to handle low-latency data access while ensuring data integrity through a Write-Ahead Logging system. By utilizing modern C++ synchronization primitives, VoltCache supports high-throughput concurrent client connections.
29+
It is engineered to deliver:
30+
31+
* ⚡ Ultra-low latency reads
32+
* 🔒 Thread-safe concurrent access
33+
* 💾 Durable persistence via Write-Ahead Logging (WAL)
34+
* 🧵 Modern C++ synchronization using RAII
35+
36+
Designed to simulate production-grade caching systems like Redis — but implemented from scratch to demonstrate deep systems-level understanding.
1337

1438
---
1539

16-
### 🚀 Core Features (Implemented)
40+
## ✨ Key Features
41+
42+
### 🧵 Thread-Safe Concurrency
43+
44+
* Implements **Reader-Writer Lock pattern**
45+
* Uses `std::shared_mutex`
46+
* Unlimited concurrent reads
47+
* Exclusive writes via `std::unique_lock`
48+
* RAII-based lock safety
49+
50+
### 💾 Durability with Write-Ahead Logging
1751

18-
* **Thread-Safe Engine:** Implements a **Reader-Writer Lock pattern** using `std::shared_mutex`. This allows unlimited concurrent reads while ensuring exclusive access for writes, maximizing throughput.
19-
* **Durability (Write-Ahead Logging):** Every `SET` operation is flushed to `data/volt.log` before memory update. On system restart, the engine automatically replays the log to restore the state.
20-
* **Structured Data Support:** Advanced tokenization allows for storing complex strings and **JSON** objects (handling spaces and delimiters correctly).
21-
* **Zero-Dependency Build:** Managed entirely via **CMake**, ensuring the project is portable and easy to compile in any C++ environment.
52+
* Every `SET` operation is logged before memory mutation
53+
* Log file: `data/volt.log`
54+
* Crash recovery via automatic WAL replay
55+
* Prevents recursive re-logging during restore
56+
57+
### 📦 Structured Data Support
58+
59+
* Advanced token parsing
60+
* Stores:
61+
62+
* Strings with spaces
63+
* Delimiter-safe values
64+
* JSON payloads
65+
66+
### ⚙️ Zero Dependency Build
67+
68+
* Fully managed via **CMake**
69+
* No external libraries
70+
* Portable across Windows & Linux
2271

2372
---
2473

25-
### 🛠️ Technical Deep-Dive
74+
## 🏗 Architecture
2675

27-
#### **Concurrency & RAII**
76+
```
77+
Client Threads
78+
79+
80+
┌───────────────────────┐
81+
│ Shared Hash Map │
82+
│ (std::unordered_map) │
83+
└───────────────────────┘
84+
85+
86+
Reader-Writer Lock
87+
88+
89+
Write-Ahead Log (WAL)
90+
```
2891

29-
The system uses RAII (Resource Acquisition Is Initialization) to manage thread safety.
92+
### Concurrency Model
3093

31-
* **Writes:** Handled via `std::unique_lock` for exclusive access.
32-
* **Reads:** Handled via `std::shared_lock` for concurrent access.
94+
| Operation | Lock Type | Behavior |
95+
| --------- | ----------- | ----------- |
96+
| GET | shared_lock | Concurrent |
97+
| SET | unique_lock | Exclusive |
98+
| WAL Flush | File I/O | Synchronous |
3399

34-
#### **Data Recovery**
100+
---
35101

36-
The `load_from_wal()` sequence ensures that the database is fault-tolerant:
102+
## 🔄 Crash Recovery Flow
37103

38-
1. Check for existing `data/volt.log`.
39-
2. Parse commands and tokens line-by-line.
40-
3. Inject data into the hash map without re-logging, preventing log recursion.
104+
1. Detect `data/volt.log`
105+
2. Parse commands line-by-line
106+
3. Inject data directly into memory
107+
4. Skip logging during recovery phase
108+
5. Restore complete state
41109

42110
---
43111

44-
### 📂 Project Structure
112+
## 📂 Project Structure
45113

46114
```text
47115
VoltCache/
48-
├── include/ # Header files (Engine declarations)
49-
├── src/ # Core Implementation (Server & Engine logic)
50-
├── Testing/ # Python-based Integration Test Suite
51-
├── data/ # Persistent WAL storage (ignored by git)
52-
├── CMakeLists.txt # Cross-platform build configuration
53-
└── .gitignore # Configured to keep build/ and logs out of repo
54-
116+
├── include/ # Engine declarations
117+
├── src/ # Server & engine implementation
118+
├── Testing/ # Python integration tests
119+
├── data/ # WAL persistence layer
120+
├── CMakeLists.txt
121+
└── README.md
55122
```
56123

57124
---
58125

59-
### ⚙️ Installation & Build
126+
## ⚙️ Installation
60127

61-
**Prerequisites:**
128+
### 🔧 Requirements
62129

63130
* CMake 3.10+
64-
* MinGW-w64 (UCRT64 recommended) or GCC
131+
* GCC / MinGW-w64 (UCRT64 recommended)
132+
* Python 3 (for integration tests)
65133

66-
**Building:**
134+
### 🏗 Build
67135

68136
```bash
69137
mkdir build && cd build
70138
cmake -G "MinGW Makefiles" ..
71139
cmake --build .
72-
73140
```
74141

75-
**Running the Server:**
142+
### ▶ Run Server
76143

77144
```bash
78-
.\VoltCache.exe
79-
145+
./VoltCache
80146
```
81147

82-
**Running Tests:**
148+
### 🧪 Run Integration Tests
83149

84150
```bash
85151
python Testing/test_volt.py
86-
87152
```
88153

89154
---
90155

91-
### 🗺️ Roadmap (Upcoming Features)
156+
## 📈 Performance Goals
157+
158+
* O(1) average lookup (hash map)
159+
* Minimal lock contention
160+
* WAL durability with low overhead
161+
* Safe concurrent client simulation
162+
163+
---
164+
165+
## 🗺 Roadmap
92166

93-
* [ ] **LRU Eviction Policy:** Implement `std::list` + `std::unordered_map` for O(1) eviction of least recently used keys when memory limits are reached.
94-
* [ ] **Lock Striping:** Horizontal partitioning (sharding) of the database into 16 discrete buckets to reduce lock contention.
95-
* [ ] **Google Test Integration:** Unit testing for core engine components to ensure 100% logic coverage.
167+
* [ ] LRU Eviction Policy (O(1) eviction via list + hashmap)
168+
* [ ] Lock Striping (16 bucket sharding)
169+
* [ ] GoogleTest unit coverage
170+
* [ ] Benchmark suite (throughput + latency metrics)
171+
* [ ] Optional async WAL mode
172+
* [ ] Snapshotting mechanism
96173

97174
---
98175

99-
### 🏆 Why this project?
176+
## 🧠 Design Philosophy
177+
178+
VoltCache is built to demonstrate:
179+
180+
* Advanced C++17 mastery
181+
* RAII-driven concurrency safety
182+
* File I/O durability guarantees
183+
* Real-world system design principles
184+
185+
This is not just a CRUD store — it’s a **mini database engine**.
186+
187+
---
100188

101-
This project demonstrates proficiency in **System Design**, **Modern C++ synchronization**, and **File I/O performance**. It is built to simulate real-world constraints found in systems like Redis and Memcached.
189+
## 🏆 Why VoltCache Stands Out
102190

103-
---
191+
✔ Fully thread-safe architecture
192+
193+
✔ Persistent durability layer
194+
195+
✔ Clean modular structure
196+
197+
✔ Zero third-party dependencies
198+
199+
Built as a foundational stepping stone toward distributed caching and database engines.
200+
201+
---
202+
203+
## 🤝 Contributing
204+
205+
Contributions are welcome.
206+
If you'd like to improve performance, add benchmarking, or implement eviction strategies — open a PR.
207+
208+
---

0 commit comments

Comments
 (0)