https://github.com/calvinneo/nuft
Nuft is an C++17 implementation of the Raft consensus algorithm.
https://github.com/calvinneo/nuft
consensus-algorithm consensus-protocol raft raft-cpp
Last synced: 4 months ago
JSON representation
Nuft is an C++17 implementation of the Raft consensus algorithm.
- Host: GitHub
- URL: https://github.com/calvinneo/nuft
- Owner: CalvinNeo
- License: gpl-3.0
- Created: 2018-12-03T12:40:27.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-04-12T14:30:03.000Z (almost 4 years ago)
- Last Synced: 2025-04-23T15:14:56.606Z (10 months ago)
- Topics: consensus-algorithm, consensus-protocol, raft, raft-cpp
- Language: C++
- Homepage:
- Size: 199 KB
- Stars: 26
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Nuft
Nuft is an C++17 implementation of the Raft protocol.
# Build
## Requirement
1. C++17 standard(e.g. g++ 7.2)
2. gRPC
3. [Nuke](https://github.com/CalvinNeo/Nuke), which is already packed in source
4. gtest(in /usr/local/lib)
## Build tests
Build all tests by
```
make
```
Run all tests by
```
./test
```
Run all tests until failby(This can be used to debug)
```
python ./src/test/test_until_fail.py
```
Some tests maybe fail, I will later revise them.
# Usage
## API
1. `NuftResult RaftNode::do_log(const std::string & log_string)`
2. `NuftResult RaftNode::do_log(raft_messages::LogEntry entry, int command = 0)`
3. `void RaftNode::run()`
4. `void RaftNode::run(const std::string & new_name)`
5. `void RaftNode::stop()`
6. `void RaftNode::resume()`
7. `NuftResult RaftNode::do_install_snapshot(IndexID last_included_index, const std::string & state_machine_state)`
8. `NuftResult RaftNode::update_configuration(const std::vector & app, const std::vector & rem)`
9. `std::string RaftNode::get_leader_name() const`
10. `void safe_leave()`
## Callbacks
# License
Nuft -- A C++17 Raft consensus algorithm library
Copyright (C) 2018 Calvin Neo
Email: calvinneo@calvinneo.com;calvinneo1995@gmail.com
Github: https://github.com/CalvinNeo/Nuft/
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .