6#include "raft/errors.hpp"
7#include "raft/network.hpp"
8#include "raft/server.hpp"
10namespace raft::enhanced
27 using GlobalCommitCallback =
28 std::function<void(std::vector<std::byte> data,
bool local,
bool duplicate)>;
33 std::vector<std::byte>
data;
39 using LocalCommitCallback = std::function<void(tl::expected<LocalCommitInfo, Error> result)>;
42 using EndSessionCallback = std::function<void(tl::expected<void, Error> result)>;
48 std::shared_ptr<raft::Server>
server;
84 const std::vector<std::byte>& value,
85 LocalCommitCallback callback);
90 void endSession(std::string
const& clientID, EndSessionCallback callback);
92 void setCommitCallback(GlobalCommitCallback callback);
93 void clearCommitCallback();
96 std::shared_ptr<ServerImpl> pImpl_;
void endSession(std::string const &clientID, EndSessionCallback callback)
void commit(RequestInfo const &info, const std::vector< std::byte > &value, LocalCommitCallback callback)
Information about a committed entry.
Definition server.hpp:32
bool duplicate
Whether the entry was a duplicate.
Definition server.hpp:34
std::vector< std::byte > data
The committed data.
Definition server.hpp:33
uint64_t requestID
The request ID for this request.
Definition server.hpp:20
std::string clientID
The client ID for this request.
Definition server.hpp:19
Configuration for creating an enhanced Raft server.
Definition server.hpp:46
std::optional< GlobalCommitCallback > commitCallback
The commit callback to use.
Definition server.hpp:51
uint64_t threadCount
The number of threads to use for timer management.
Definition server.hpp:50
std::shared_ptr< raft::Server > server
The underlying Raft server instance.
Definition server.hpp:48
std::chrono::nanoseconds commitTimeout
The commit timeout.
Definition server.hpp:49
std::shared_ptr< raft::Network > network
The network interface for Raft communication.
Definition server.hpp:47