Joedb 10.0.1
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Writable_Journal_Client.h
Go to the documentation of this file.
1#ifndef joedb_Writable_Journal_Client_declared
2#define joedb_Writable_Journal_Client_declared
3
5
6namespace joedb
7{
8 namespace detail
9 {
10 class Writable_Journal_Client_Data
11 {
12 protected:
13 Writable_Journal data_journal;
14
15 public:
16 Writable_Journal_Client_Data
17 (
18 Buffered_File &file,
19 Recovery recovery
20 ):
21 data_journal(Journal_Construction_Lock(file, recovery))
22 {
23 }
24 };
25 }
26
27 /// @ingroup concurrency
29 protected detail::Writable_Journal_Client_Data,
30 public Writable_Client
31 {
33
34 protected:
35 void read_journal() override
36 {
37 data_journal.skip_directly_to(data_journal.get_checkpoint());
38 }
39
40 public:
42 (
43 Buffered_File &file,
45 Content_Check content_check = Content_Check::fast,
46 Recovery recovery = Recovery::none
47 ):
48 Writable_Journal_Client_Data(file, recovery),
49 Writable_Client(data_journal, connection, content_check)
50 {
52 }
53
54 template<typename F> auto transaction(F transaction)
55 {
57 {
58 return transaction(data_journal);
59 });
60 }
61 };
62
63 /// @ingroup concurrency
78}
79
80#endif
Lock object that allows writing to a database managed by a joedb::Client.
Writable_Client & client
Connection & connection
Definition Client.h:16
Writable specialization of Client.
auto transaction(F transaction)
Writable_Journal_Client_Lock(Writable_Journal_Client &client)
Writable_Journal_Client(Buffered_File &file, Connection &connection, Content_Check content_check=Content_Check::fast, Recovery recovery=Recovery::none)
Content_Check
Definition Connection.h:19
#define JOEDB_DEBUG_ASSERT(x)
assertion tested in debug mode
Definition assert.h:19
@ none
default: fail if file size > checkpoint
Definition Blob.h:7