Joedb 9.5.0
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Client.h
Go to the documentation of this file.
1#ifndef joedb_Client_declared
2#define joedb_Client_declared
3
5
6namespace joedb
7{
8 /// Handle concurrent access to a file with a joedb::Connection
9 ///
10 /// @ingroup concurrency
11 class Client
12 {
13 protected:
14 virtual void read_journal() {}
18
19 int64_t push(Unlock_Action unlock_action)
20 {
22 (
23 journal,
26 unlock_action
27 );
28
30 }
31
32 public:
33 //////////////////////////////////////////////////////////////////////////
35 //////////////////////////////////////////////////////////////////////////
36 (
39 Content_Check content_check
40 ):
43 connection_checkpoint(connection.handshake(journal, content_check))
44 {
45 }
46
48 {
49 return journal;
50 }
51
52 bool is_shared() const
53 {
54 return journal.is_shared();
55 }
56
57 bool is_pullonly() const
58 {
59 return connection.is_pullonly();
60 }
61
62 int64_t get_journal_checkpoint() const
63 {
64 return get_journal().get_checkpoint();
65 }
66
67 std::string read_blob(Blob blob) const
68 {
69 return get_journal().get_file().read_blob(blob);
70 }
71
73 {
75 }
76
81
82 virtual int64_t push_if_ahead() = 0;
83 virtual int64_t pull
84 (
85 std::chrono::milliseconds wait = std::chrono::milliseconds(0)
86 ) = 0;
87
88 virtual ~Client();
89 };
90}
91
92#endif
Handle concurrent access to a file with a joedb::Connection.
Definition Client.h:12
virtual void read_journal()
Definition Client.h:14
int64_t connection_checkpoint
Definition Client.h:17
int64_t push(Unlock_Action unlock_action)
Definition Client.h:19
int64_t get_journal_checkpoint() const
Definition Client.h:62
bool is_pullonly() const
Definition Client.h:57
Readonly_Journal & journal
Definition Client.h:15
virtual int64_t push_if_ahead()=0
const Readonly_Journal & get_journal() const
Definition Client.h:47
bool is_shared() const
Definition Client.h:52
Connection & connection
Definition Client.h:16
int64_t get_checkpoint_difference() const
Definition Client.h:77
std::string read_blob(Blob blob) const
Definition Client.h:67
int64_t get_connection_checkpoint() const
Definition Client.h:72
virtual ~Client()
virtual int64_t pull(std::chrono::milliseconds wait=std::chrono::milliseconds(0))=0
virtual bool is_pullonly() const
virtual int64_t push(const Readonly_Journal &client_journal, int64_t from, int64_t until, Unlock_Action unlock_action)
Push new data to the connection.
const Buffered_File & get_file() const
int64_t get_checkpoint() const
Content_Check
Definition Connection.h:19
Unlock_Action
Definition Connection.h:41
Definition Blob.h:7