https://github.com/filinvadim/easy-raft
A simple wrapper for Hashicorp Raft.
https://github.com/filinvadim/easy-raft
go libp2p libp2p-raft raft raft-consensus-algorithm raft-go
Last synced: 10 months ago
JSON representation
A simple wrapper for Hashicorp Raft.
- Host: GitHub
- URL: https://github.com/filinvadim/easy-raft
- Owner: filinvadim
- License: apache-2.0
- Created: 2025-02-27T19:31:36.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-07-02T13:01:14.000Z (12 months ago)
- Last Synced: 2025-07-02T14:22:34.251Z (12 months ago)
- Topics: go, libp2p, libp2p-raft, raft, raft-consensus-algorithm, raft-go
- Language: Go
- Homepage: https://raft.github.io/
- Size: 26.4 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# easy-raft
A simple wrapper for HashiCorp's Raft implementation in Go.
## Overview
`easy-raft` provides a straightforward interface to integrate Raft consensus into your Go applications, leveraging HashiCorp's robust Raft library.
## Ratio
It is not easy to use HashiCorp's Raft library without knowing many details related to Raft consensus
algorithm spec. This wrapper is taking away any such overhead providing simple Raft node setup
and access to it interface.
## Features
- Simplified setup and management of Raft nodes
- Easy integration into existing Go projects
- Example usage provided in the `example` directory
## Getting Started
### Prerequisites
- Go 1.21 or later
### Installation
```sh
go get github.com/filinvadim/easy-raft
```
### Usage
```go
package main
import (
"github.com/filinvadim/easy-raft"
)
func main() {
// Initialize and start your Raft node
node, err := easyraft.NewEasyRaft(
ctx,
"localhost:6969",
logger,
logStore,
stableStore,
snapshotStore,
transport,
) // Set your own configuration parameters
// Handle error
defer node.Shutdown()
raft := node.Raft()
raft.Apply([]byte("some cmd"), time.Second*5) // Your application logic here
}
```
For a complete example, refer to the example directory in the repository.
### Contributing
Contributions are welcome! Please fork the repository and submit a pull request.
### License
This project is licensed under the Apache License.