Joedb 10.5.0
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Journal_Construction_Lock.h
Go to the documentation of this file.
1#ifndef joedb_Journal_Construction_Lock_declared
2#define joedb_Journal_Construction_Lock_declared
3
6
7namespace joedb
8{
9 /// @ingroup journal
10 enum class Recovery
11 {
12 none = 0, ///< default: fail if file size > checkpoint
13 ignore_header = 1, ///< use file size as checkpoint
14 overwrite = 2 ///< allow overwriting an uncheckpointed tail
15 };
16
17 /// @ingroup journal
19 {
20 friend class Writable_Journal;
21
22 private:
23 // Acquire the tail before the head, and release them in reverse order.
24 File_Tail_Lock tail_lock;
25 File_Head_Lock head_lock;
26
27 bool for_writable_journal = false;
28 Journal_Construction_Lock &set_for_writable_journal()
29 {
30 for_writable_journal = true;
31 return *this;
32 }
33
34 public:
37 const int64_t size;
39
40 bool is_for_writable_journal() const {return for_writable_journal;}
41
43 (
46 );
47
50 };
51}
52
53#endif
Journal_Construction_Lock(Abstract_File &file, Recovery recovery=Recovery::none)
Journal_Construction_Lock(const Journal_Construction_Lock &)=delete
Journal_Construction_Lock & operator=(const Journal_Construction_Lock &)=delete
@ none
default: fail if file size > checkpoint
@ overwrite
allow overwriting an uncheckpointed tail
@ ignore_header
use file size as checkpoint