How itsmadpig/chat_with_paxos works
This is a command-line chat system backed by servers that replicate committed messages with Paxos. Users submit messages through a client; the load balancer waits for server readiness and assigns clients to the least-loaded live server. Servers commit messages through Paxos and serve log reads; clients periodically refresh logs and retry through the balancer after a server failure. The README also documents server recovery, log catch-up, and simulated delay or disconnection. The main workflow is visible in the excerpts; other RPC protocol details are represented only where the shown code supports them.
Main entry points: server_impl.go Chat server · paxos.go Paxos consensus · client.go Chat client · loadbalancer_impl.go Load balancer
Components 7
Client access
- Chat client
src/github.com/itsmadpig/client/client.go
Server routing
- Load balancer
src/github.com/itsmadpig/loadbalancer/loadbalancer_impl.go - Chat server
src/github.com/itsmadpig/server/server_impl.go
Replication
- Paxos consensus
src/github.com/itsmadpig/paxos/paxos.go - Replicated message log
src/github.com/itsmadpig/paxos/paxos.go
Recovery and faults
- Fault-injection wrapper
src/github.com/itsmadpig/paxosTestWrap/paxosWrap.go
Other components
- Chat user
Connections 13
- Chat user → Chat client: enters messages
- Chat client → Load balancer: requests route
src/github.com/itsmadpig/client/client.go - Load balancer → Chat client: returns server address
src/github.com/itsmadpig/loadbalancer/loadbalancer_impl.go - Chat client → Chat server: submits messages
src/github.com/itsmadpig/client/client.go - Chat client → Chat server: fetches logs
src/github.com/itsmadpig/client/client.go - Chat server → Load balancer: registers server
src/github.com/itsmadpig/server/server_impl.go - Chat server → Paxos consensus: proposes messages
src/github.com/itsmadpig/server/server_impl.go - Chat server → Paxos consensus: reads logs
src/github.com/itsmadpig/server/server_impl.go - Paxos consensus → Replicated message log: commits rounds
src/github.com/itsmadpig/paxos/paxos.go - Paxos consensus → Paxos consensus: exchanges consensus RPCs
src/github.com/itsmadpig/paxos/paxos.go - Chat server → Paxos consensus: catches up on recovery
src/github.com/itsmadpig/server/server_impl.go - Chat server → Fault-injection wrapper: selects test mode
src/github.com/itsmadpig/server/server_impl.go - Fault-injection wrapper → Paxos consensus: delays or delegates
src/github.com/itsmadpig/paxosTestWrap/paxosWrap.go