go-distributed

This repository provides demo and examples of Go implementations of distributed paradigms and algorithms.
What paradigms/algorithms are implemented?
- client / server
- leader-election (Bully Algorithm)
- rpc (Remote Procedure Call)
Develop
Get this repo
git clone https://github.com/ottenwbe/go-distributed.git
Structure
.
├── client-server # Client/Server pattern implementation
├── leader-election # Bully leader election algorithm implementation
├── rpc # RPC pattern implementation
├── go.mod
├── go.sum
├── LICENSE
└── README.md
How to Run
The client-server example can be run in different modes using the -mode flag.
Demo Mode (Default)
This runs both the client and server in the same process for a quick demonstration.
go run ./client-server
Server & Client Mode
To demonstrate the distributed nature, run the server and client in separate terminals.
# Terminal 1: Run the server
go run ./client-server -mode server
# Terminal 2: Run the client
go run ./client-server -mode client
Test
We use ginkgo for testing.
go test ./...
or
ginkgo -v ./...