Joedb 9.1.4
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Readonly_Client.h
Go to the documentation of this file.
1/////////////////////////////////////////////////////////////////////////////
2//
3// This code was automatically generated by the joedb compiler
4// https://www.joedb.org/
5//
6// Path to compiler: /home/rcoulom/repos/joedb/doc/source/tutorial/build/joedbc
7// Version: 9.1.4
8// joedbc compilation time: Apr 15 2025 14:46:29
9// Generation of this file: 2025-04-15 12:46:31 GMT
10//
11/////////////////////////////////////////////////////////////////////////////
12#ifndef joedb_db_multi_server_Readonly_Client_declared
13#define joedb_db_multi_server_Readonly_Client_declared
14
15#include "Database.h"
17#include "joedb/journal/File.h"
18
20{
21 namespace detail
22 {
23 class Readonly_Client_Data
24 {
25 protected:
26 joedb::Connection connection;
28 Database db;
29
30 Readonly_Client_Data(joedb::File &file): journal(file)
31 {
32 db.initialize_with_readonly_journal(journal);
33 }
34 };
35 }
36
37 /// Client for a read-only file (allows pulling, unlike @ref Readonly_Database)
39 private detail::Readonly_Client_Data,
40 public joedb::Client
41 {
42 private:
43 const int64_t schema_checkpoint;
44
45 protected:
46 virtual void read_journal() override
47 {
48 journal.play_until_checkpoint(db);
49 if (db.get_schema_checkpoint() > schema_checkpoint)
50 Database::throw_exception("Pulled a schema change");
51 }
52
53 public:
55 detail::Readonly_Client_Data(file),
57 (
58 journal,
59 Readonly_Client_Data::connection,
60 false
61 ),
62 schema_checkpoint(db.get_schema_checkpoint())
63 {
64 }
65
66 const Database &get_database() const {return db;}
67 };
68}
69
70#endif
Handle concurrent access to a file with a joedb::Connection.
Definition Client.h:12
Handle concurrent access to a joedb::Buffered_File using a joedb::Connection.
Definition Client.h:45
Store all the tables of the database.
Definition Database.h:82
static void throw_exception(const std::string &message)
Definition Database.h:89
Client for a read-only file (allows pulling, unlike Readonly_Database)
Automatically generated by joedbc.
Definition Client.h:19
Definition Blob.h:7
JOEDB_FILE File
Definition File.h:25