How hrefto/shorterdb works
Project type and purpose
• From the file tree and absence of a filled-out README, we see:
• This is a standalone key-value store server implementation in Rust.
• It uses a Protocol Buffers schema (proto/commands.proto) for its network API.
• The “kv” folder contains the core storage engine (Memtable, WAL, SSTable).
• server.rs and main.rs wire up a networked RPC server around the engine.
• randomdata.py is a test/data generator.
File structure
• Top-level artifacts:
• Cargo.toml / build.rs → Rust build and dependency management.
• proto/commands.proto → gRPC or protobuf definitions.
• randomdata.py → external data-generation script.
• src/:
• main.rs → application entrypoint (initializes config, logging, server).
• server.rs → RPC server setup (imports the generated protobuf bindings and exposes handlers).
• errors.rs → centralized error types.
• kv/ (core storage engine):
– db.rs → high-level DB API (get, put, delete, iterate).
– wal.rs → write-ahead-log implementation for durability.
– memtable.rs → in-memory memtable for writes before flush.
– sst.rs → SSTable file format and reader logic.
– utils.rs → helper functions (file I/O, encoding/decoding).
README
• It’s still “todo!()”, so rely on file names and module responsibilities to infer architecture.
Detailed capture of architectural elements
• Lifecycle of a write and read.
• How the protobuf definitions flow into generated code (via build.rs) and into server.rs.