Skip to content
This repository has been archived by the owner on Jun 10, 2020. It is now read-only.
/ GoRaft Public archive

A basic Raft implementation written in Go.

License

Notifications You must be signed in to change notification settings

thomasylee/GoRaft

Repository files navigation

Build Status Codacy Coverage Badge Codacy Grade Badge Go Report Card

GoRaft

GoRaft is an implementation of the Raft consensus algorithm written in Go.

The goal of this project is for me to learn Go and become better acquainted with Raft's inner workings. The implementation mostly follows the Raft definition found in In Search of an Understandable Consensus Algorithm by Diego Ongaro and John Ousterhout, though some parts of the code may stray as I play with different ways to get Go to fulfill various functionalities of Raft.

Table of Contents

Dependencies

GoRaft depends on the following external packages:

This package uses gRPC to send/receive rpc requests between nodes. *.proto files will need to be compiled into Go code using protoc to be usable by gRPC. The executable file generate_protobuf.sh runs the necessary commands to compile all *.proto files.

Getting Started

Installing

To install GoRaft, first install Go and then run "go get":

$ go get github.com/thomasylee/GoRaft

Configuring

Configurations can be found in config.yaml. The details of each configuration is explained in the comments above the relevant key-value pairs.

Testing

$ go test -cover -v ./...

Running

Run using "go run" from the source directory, or run "go run" on the main.go file itself:

$ go run main.go

For now, the send_test_append_entries.go program can be used to append new entries to the node logs. It must be edited before being run to include the correct request values.

# Rename, since two files with main() methods will break the test setup.
mv send_test_append_entries.go2 send_test_append_entries.go
go run send_test_append_entries.go

The inspect_bolt.go file can be used to alter and inspect Bolt database files.

# Rename, since two files with main() methods will break the test setup.
mv run inspect_bolt.go2 inspect_bolt.go
go run inspect_bolt.go

About

A basic Raft implementation written in Go.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published