<commit_before># 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](https://raft.github.io/raft.pdf) by <NAME> and <NAME>, 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](#dependencies)
- [Getting Started](#getting-started)
 - [Installing](#installing)
 - [Configuring](#configuring)
 - [Running](#running)

## Dependencies
GoRaft depends on the following external packages:
* [github.com/boltdb/bolt](https://github.com/boltdb/bolt) - To act as the persistent finite state machine (FSM)
* [github.com/go-yaml/yaml](https://github.com/go-yaml/yaml) - To parse the YAML config file
* [github.com/gorilla/mux](https://github.com/gorilla/mux) - For simple REST API construction, though I may switch from mux to gRPC later to stay true to the Raft article

## Getting Started

### Installing
To install GoRaft, first install Go and then run "go get":
```sh
$ go get github.com/thomasylee/GoRaft
```

### Configuring
Configurations can be found in [config.yaml](https://github.com/thomasylee/GoRaft/blob/master/config.yaml). The details of each configuration is explained in the comments above the relevant key-value pairs.

### Running
Run using "go run" from the source directory, or run "go run" on the main.go file itself:
```sh
$ go run main.go
```
<commit_msg>Add curl append_entries command to README<commit_after># 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](https://raft.github.io/raft.pdf) by <NAME> and <NAME>, 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](#dependencies)
- [Getting Started](#getting-started)
 - [Installing](#installing)
 - [Configuring](#configuring)
 - [Running](#running)

## Dependencies
GoRaft depends on the following external packages:
* [github.com/boltdb/bolt](https://github.com/boltdb/bolt) - To act as the persistent finite state machine (FSM)
* [github.com/go-yaml/yaml](https://github.com/go-yaml/yaml) - To parse the YAML config file
* [github.com/gorilla/mux](https://github.com/gorilla/mux) - For simple REST API construction, though I may switch from mux to gRPC later to stay true to the Raft article

## Getting Started

### Installing
To install GoRaft, first install Go and then run "go get":
```sh
$ go get github.com/thomasylee/GoRaft
```

### Configuring
Configurations can be found in [config.yaml](https://github.com/thomasylee/GoRaft/blob/master/config.yaml). The details of each configuration is explained in the comments above the relevant key-value pairs.

### Running
Run using "go run" from the source directory, or run "go run" on the main.go file itself:
```sh
$ go run main.go
```

Curl can be used to append new entries to the node logs:
```sh
curl -s -w "%{http_code}\n" localhost:8000/append_entries -d '{"term": 1, "entries": [{"key":"a","value":"1"}], "prevLogTerm": 0, "prevLogIndex": -1}'
```

{'fraction_non_alphanumeric': 0.11104767342278048, 'fraction_numerical': 0.0022837567799029405, 'mean_word_length': 4.697560975609756, 'pattern_counts': {'":': 8, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1105178', 'n_tokens_mistral': 1061, 'n_tokens_neox': 1001, 'n_words': 420}