Joedb 9.5.0
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Server_Client.h
Go to the documentation of this file.
1#ifndef joedb_Server_Client_declared
2#define joedb_Server_Client_declared
3
7
8#include <condition_variable>
9#include <thread>
10#include <iosfwd>
11#include <chrono>
12
13namespace joedb
14{
15 /// @ingroup concurrency
17 {
18 friend class Server_File;
19
20 private:
21 std::chrono::seconds keep_alive_interval;
22 std::condition_variable condition;
23 void ping(Channel_Lock &lock);
24 bool keep_alive_thread_must_stop;
25 std::thread keep_alive_thread;
26 void keep_alive();
27 void connect();
28 void disconnect();
29
30 protected:
32 std::ostream *log;
34
36
37 int64_t session_id;
40
41 void download(Async_Writer &writer, Channel_Lock &lock, int64_t size) const;
42
43 public:
44 Server_Client(Channel &channel, std::ostream *log = nullptr);
45
46 void set_keep_alive_interval(std::chrono::seconds duration)
47 {
48 keep_alive_interval = duration;
49 }
50
51 int64_t get_session_id() const {return session_id;}
53 void ping();
54
56 };
57}
58
59#endif
void set_keep_alive_interval(std::chrono::seconds duration)
void download(Async_Writer &writer, Channel_Lock &lock, int64_t size) const
int64_t get_session_id() const
Thread_Safe_Channel & get_channel()
Thread_Safe_Channel channel
std::ostream * log
Directly read file served from joedb_server.
Definition Server_File.h:22
Definition Blob.h:7