raft 0.1.0
Loading...
Searching...
No Matches
network.hpp
1#pragma once
2
3#include <memory>
4#include <optional>
5
6#include "raft/client.hpp"
7#include "raft/server.hpp"
8
9namespace raft
10{
12 class Network
13 {
14 public:
15 virtual ~Network() = default;
16
22 virtual tl::expected<std::string, Error> start(std::string const& address) = 0;
23
26 virtual tl::expected<void, Error> stop() = 0;
27 };
28
30 {
31 std::shared_ptr<ServiceHandler> handler;
32 };
33
38 tl::expected<std::shared_ptr<Network>, Error> createNetwork(NetworkCreateConfig const& config);
39} // namespace raft
The network interface for the Raft server.
Definition network.hpp:13
virtual tl::expected< std::string, Error > start(std::string const &address)=0
virtual tl::expected< void, Error > stop()=0
Definition network.hpp:30