Joedb 10.2.1
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Connector.h
Go to the documentation of this file.
1#ifndef joedb_Connector_declared
2#define joedb_Connector_declared
3
5
6#include <memory>
7#include <chrono>
8
9namespace joedb
10{
11 /// Used by @ref Robust_Connection to reconnect after an error
12 ///
13 /// @ingroup concurrency
15 {
16 private:
17 std::chrono::milliseconds keep_alive_interval = std::chrono::seconds(0);
18
19 public:
20 virtual std::unique_ptr<Channel> new_channel() const = 0;
21 virtual ~Connector() = default;
22
23 std::chrono::milliseconds get_keep_alive_interval() const
24 {
25 return keep_alive_interval;
26 }
27
28 Connector &set_keep_alive_interval(std::chrono::milliseconds interval)
29 {
30 keep_alive_interval = interval;
31 return *this;
32 }
33 };
34}
35
36#endif
Used by Robust_Connection to reconnect after an error.
Definition Connector.h:15
std::chrono::milliseconds get_keep_alive_interval() const
Definition Connector.h:23
virtual std::unique_ptr< Channel > new_channel() const =0
Connector & set_keep_alive_interval(std::chrono::milliseconds interval)
Definition Connector.h:28
virtual ~Connector()=default