Joedb 9.1.3
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Friends | List of all members
tutorial::Client Class Reference

Handle concurrent access to a joedb::Buffered_File using a joedb::Connection. More...

#include <tutorial/Client.h>

Inheritance diagram for tutorial::Client:
Inheritance graph
[legend]
Collaboration diagram for tutorial::Client:
Collaboration graph
[legend]

Public Member Functions

 Client (joedb::Buffered_File &file, joedb::Connection &connection, bool content_check=true, joedb::Readonly_Journal::Check check=joedb::Readonly_Journal::Check::all, joedb::Commit_Level commit_level=joedb::Commit_Level::no_commit)
 
const Databaseget_database () const
 
template<typename F >
void transaction (F transaction)
 Execute a write transaction.
 
- Public Member Functions inherited from joedb::Client
 Client (Readonly_Journal &journal, Connection &connection, bool content_check=true)
 
bool is_readonly () const
 
const Readonly_Journalget_journal () const
 
int64_t get_checkpoint () const
 
std::string read_blob_data (Blob blob) const
 
int64_t get_server_checkpoint () const
 
int64_t get_checkpoint_difference () const
 
int64_t pull (std::chrono::milliseconds wait=std::chrono::milliseconds(0))
 
void push_unlock ()
 
virtual ~Client ()
 

Protected Member Functions

void read_journal () override
 
- Protected Member Functions inherited from joedb::Client
template<typename F >
void transaction (F transaction)
 

Friends

class Client_Lock
 

Detailed Description

Definition at line 42 of file Client.h.

Constructor & Destructor Documentation

◆ Client()

tutorial::Client::Client ( joedb::Buffered_File file,
joedb::Connection connection,
bool  content_check = true,
joedb::Readonly_Journal::Check  check = joedb::Readonly_Journal::Check::all,
joedb::Commit_Level  commit_level = joedb::Commit_Level::no_commit 
)
inline

Definition at line 64 of file Client.h.

Member Function Documentation

◆ get_database()

const Database & tutorial::Client::get_database ( ) const
inline

Definition at line 87 of file Client.h.

◆ read_journal()

void tutorial::Client::read_journal ( )
inlineoverrideprotectedvirtual

Implements joedb::Client.

Definition at line 52 of file Client.h.

◆ transaction()

template<typename F >
void tutorial::Client::transaction ( transaction)
inline

This function can be called with a lambda like this:

client.transaction([](Writable_Database &db)
{
db.write_comment("Hello");
});
A writable Database constructed from a writable joedb::Buffered_File.
void write_comment(const std::string &comment)

The transaction function locks and pulls the connection before executing the lambda, pushes and unlocks it after.

Definition at line 103 of file Client.h.

Friends And Related Symbol Documentation

◆ Client_Lock

friend class Client_Lock
friend

Definition at line 46 of file Client.h.


The documentation for this class was generated from the following file: