Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions docs/specs/grpc/context.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"product_vision": {
"phase_1_goal": "Build a 3-node distributed Redis-compatible KV store with Raft consensus",
"networking_requirements": {
"protocol": "gRPC on port 7379 for internal Raft RPC between nodes",
"success_criteria": [
"Leader election <2s",
"11 chaos tests passing",
">5,000 ops/sec performance"
]
}
},
"existing_features": [
{
"name": "openraft-migration",
"status": "In Design",
"relevance": "Phase 4 includes Network Stub Implementation - gRPC will replace StubNetwork"
},
{
"name": "resp-protocol",
"status": "Complete (100%, 487 tests)",
"relevance": "Handles client-facing Redis protocol, separate from internal gRPC"
},
{
"name": "kv-service",
"status": "Specified, not started",
"relevance": "Will use raft crate for consensus operations"
}
],
"architecture": {
"raft_crate_role": "Consensus + Transport Layer - wraps openraft with gRPC server/client",
"grpc_integration": {
"description": "Implements RaftNetwork trait for inter-node communication",
"location": "crates/raft/, protos in crates/raft/proto/",
"replaces": "StubNetwork placeholder with OpenRaftNetwork implementation",
"trait": "openraft::RaftNetwork<RaftTypeConfig>",
"server_port": 7379,
"rpc_types": ["RequestVote", "AppendEntries", "InstallSnapshot"]
},
"dependencies": {
"upstream": ["storage crate", "common crate"],
"downstream": ["kv service", "seshat binary"],
"external": [
"openraft 0.10+",
"tonic 0.11+",
"prost 0.14+ (MUST match tonic version)"
]
}
},
"standards": {
"tech_stack": {
"rust_version": "1.90+",
"async_runtime": "tokio",
"grpc": "tonic 0.11+ / prost 0.14+",
"serialization": "Protocol Buffers",
"errors": "thiserror",
"logging": "tracing"
},
"key_requirements": [
"5s connection/request timeout",
"TDD workflow mandatory",
"Single prost version (0.14) - CRITICAL for compatibility",
"Async-first design"
],
"testing_approach": {
"unit": "protobuf serialization, client/server logic",
"integration": "2-node message exchange",
"chaos": "11 scenarios (network partitions, failures)"
}
},
"implementation_guidance": {
"relationship_to_openraft": "OpenRaft migration defines StubNetwork placeholder, gRPC spec replaces stub with full tonic/prost implementation",
"key_design_decisions": [
"Connection pooling with HashMap<NodeId, GrpcClient>",
"Retry logic with exponential backoff (max 3 attempts)",
"DNS-based peer discovery (hostname:port)",
"Comprehensive error mapping (tonic::Status → RaftError)"
],
"file_organization": {
"proto_files": "crates/raft/proto/*.proto",
"server": "crates/raft/src/grpc_server.rs",
"client": "crates/raft/src/grpc_client.rs",
"network": "crates/raft/src/network.rs (replaces network_stub.rs)"
}
},
"reference_documents": [
"docs/specs/openraft/design.md - OpenRaft migration design",
"docs/standards/tech.md - gRPC standards",
"docs/architecture/crates.md - Raft crate architecture"
],
"next_steps": "Ready for /spec:design grpc to generate technical design"
}
Loading