|
virtual tl::expected< void, Error > | start ()=0 |
| Starts Raft consensus.
|
|
virtual void | shutdown ()=0 |
| Shuts down the Raft server.
|
|
virtual tl::expected< Peer, Error > | getLeader () const =0 |
|
virtual tl::expected< EntryInfo, Error > | append (std::vector< std::byte > data)=0 |
|
virtual void | setCommitCallback (CommitCallback callback)=0 |
|
virtual void | clearCommitCallback ()=0 |
| Clears the commit callback.
|
|
virtual void | setLeaderChangedCallback (LeaderChangedCallback callback)=0 |
|
virtual void | clearLeaderChangedCallback ()=0 |
| Clears the leader changed callback.
|
|
virtual tl::expected< uint64_t, Error > | getTerm () const =0 |
|
virtual tl::expected< uint64_t, Error > | getCommitIndex () const =0 |
|
virtual tl::expected< uint64_t, Error > | getLogByteCount () const =0 |
|
virtual std::string | getId () const =0 |
|
virtual tl::expected< Status, Error > | getStatus () const =0 |
|
Public Member Functions inherited from raft::ServiceHandler |
virtual void | handleAppendEntries (const data::AppendEntriesRequest &request, std::function< void(tl::expected< data::AppendEntriesResponse, Error >)> callback)=0 |
|
virtual void | handleRequestVote (const data::RequestVoteRequest &request, std::function< void(tl::expected< data::RequestVoteResponse, Error >)> callback)=0 |
|
The Raft server interface. This is the main interface for the Raft server.
All functions are thread-safe. However, callbacks may block the main Raft logic. Therefore, user callbacks should be lightweight and non-blocking.