Skip to content

Commit ef7885d

Browse files
committed
README Update
1 parent 06da84a commit ef7885d

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,72 @@ A learning project to build a simple Log-Structured Merge (LSM) key–value stor
2121
- **SSTable**: Immutable on-disk sorted string table
2222
- **Compaction**: Merging SSTables to remove duplicates and reclaim space
2323
- **WAL**: Write-Ahead Log for crash recovery
24+
25+
### Phase 0 — Rust fundamentals & repo setup (deliverables)
26+
27+
- Deliverables:
28+
- Repo skeleton with Cargo workspace, CI (GitHub Actions), linting (clippy), formatting (rustfmt).
29+
- A README with project goals + glossary (LSM, memtable, sstable, compaction, WAL).
30+
- Learning tasks (self-study + tiny exercises):
31+
- Rust basics: ownership, borrowing, lifetimes, traits, `Result`/`Option`, pattern matching.
32+
- Modules, crates, cargo, unit testing.
33+
- Concurrency primitives and `async`/`await`.
34+
- Exercises: implement a command-line toy that stores key→value in-memory (HashMap), tests, and cargo fmt/clippy.
35+
- Tools: use `rustup`, `cargo`, and add `clippy`, `rustfmt`.
36+
37+
### Phase 1 — Core LSM (in-memory + on-disk basic) (deliverables)
38+
39+
- Deliverables:
40+
- Memtable (ordered) with unit tests.
41+
- WAL append with safe fsync and recovery test (crash simulation).
42+
- SSTable writer and reader (simple block layout, uncompressed).
43+
- A small CLI that can SET/GET locally (no networking).
44+
- Design choices (locked):
45+
- Memtable implementation: start with `BTreeMap<Vec<u8>, ValueEntry>` (easy for Rust beginners); later swap to a skiplist if you want lock-free behavior.
46+
- WAL: append binary records: `[len][crc32][key_len][key][value_len][value]`. Use CRC per record for corruption detection.
47+
- SSTable layout: write data blocks where each block contains contiguous entries; build a small in-memory sparse index (key → block offset) when opening file.
48+
- Recovery: on startup list SSTables, read manifest (or derive from filenames), then apply WALs (newest to oldest) to rebuild memtable.
49+
50+
### Phase 2 — Reads, bloom filters, and compaction basics (deliverables)
51+
52+
- Deliverables:
53+
- Read path: search memtable → recent SSTables (using bloom filter & index) → older SSTables (merge results).
54+
- Bloom filter implementation per SSTable.
55+
- Simple compaction: merge two or more SSTables into a new one; remove deleted keys / tombstones.
56+
- Tests for correctness (reads across levels, deletion semantics).
57+
- Design choices:
58+
- Use a per-SSTable bloom filter to avoid disk reads when key absent.
59+
- Tombstones for deletes: store tombstone markers during deletes and remove during compaction.
60+
61+
### Phase 3 — Robustness, concurrency & configuration knobs (deliverables)
62+
63+
- Deliverables:
64+
- Background compaction worker; max concurrent compactions configurable.
65+
- Config knobs for memtable size, compaction thresholds, WAL durability (`fsync` on every write vs batched).
66+
- Snapshot support (point-in-time view) possibly via sequence numbers.
67+
- More extensive tests: crash (kill while compaction), recovery, read/write consistency.
68+
- Design choices:
69+
- Compaction worker scheduling: simple priority rule (smallest level first).
70+
- Sequence numbers per write to support consistent snapshots.
71+
72+
### Phase 4 — RESP server & Java compatibility (deliverables)
73+
74+
- Deliverables:
75+
- RESP server supporting GET/SET/DEL and PING/INFO. Existing Redis clients should work unchanged.
76+
- Integration tests using a Java Redis client (e.g., Jedis) to exercise GET/SET/DEL.
77+
- Basic telemetry (metrics endpoint or INFO command).
78+
- Design choices:
79+
- Implement RESP parser (RESP2 subset first) and dispatcher in Tokio.
80+
- Command execution path: parse → map to engine call → write response.
81+
- Keep networking async; ensure storage engine calls that block are done in `spawn_blocking` or are non-blocking.
82+
83+
### Phase 5 — Performance, features, and polish (deliverables)
84+
85+
- Deliverables:
86+
- Benchmarks and tuning (use `criterion` or custom harness).
87+
- Optional features: TTL (expire), persistence compaction strategies (leveled), compression (snappy), LRU cache for data blocks, memory limits.
88+
- Documentation: design doc per component, API reference, "How it works" diagrams.
89+
- Example Java app that uses a Redis client (Jedis/Lettuce) to replace Redis with your store.
90+
- Engineering tasks:
91+
- Add metrics (prometheus), logging (tracing), CI for tests + benchmarks.
92+
- Add fuzzing (`cargo-fuzz`) and property tests (quickcheck / proptest) for invariants.

0 commit comments

Comments
 (0)