Joedb 10.3.2
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
6#include "joedb/Thread_Safe.h"
10
11#include <chrono>
12
13namespace joedb
14{
15 /// @ingroup concurrency
16 class Server_Client: public Logger, public Ping_Client
17 {
18 friend class Server_File;
19
20 private:
21 void locked_ping(Lock<Channel&> &lock) override;
22 Keep_Alive_Thread keep_alive;
23
24 void connect();
25 void disconnect();
26
27 protected:
31
33
34 int64_t session_id;
37
38 void download
39 (
40 Async_Writer &writer,
41 Lock<Channel&> &lock,
42 int64_t size
43 ) const;
44
45 void log(const std::string &message) noexcept override;
46
47 public:
48 ///
49 /// @param keep_alive_interval: a background thread will send a ping
50 /// to the server at this interval. Setting this parameter to zero disables
51 /// the keep-alive background thread.
52 ///
54 (
57 std::chrono::milliseconds keep_alive_interval = std::chrono::milliseconds(0)
58 );
59
60 int64_t get_session_id() const {return session_id;}
62
64 };
65}
66
67#endif
static Logger dummy_logger
Definition Logger.h:14
void log(const std::string &message) noexcept override
Thread_Safe< Channel & > & get_channel() override
Thread_Safe< Channel & > channel
void download(Async_Writer &writer, Lock< Channel & > &lock, int64_t size) const
int64_t get_session_id() const
Directly read file served from joedb_server.
Definition Server_File.h:22