Joedb 9.4.0
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, joedb::Content_Check content_check=joedb::Content_Check::quick)
 
const Databaseget_database () const
 
template<typename F >
auto transaction (F transaction)
 Execute a write transaction.
 
- Public Member Functions inherited from joedb::Writable_Client
 Writable_Client (Writable_Journal &journal, Connection &connection, Content_Check content_check=Content_Check::quick)
 
void set_valid_data (bool b)
 Automatically write valid_data at every checkpoint (default = false)
 
void set_timestamp (bool b)
 Automatically write time stamp at every checkpoint (default = false)
 
void set_hard_checkpoint (bool b)
 Use hard checkpoints (default = false)
 
int64_t pull (std::chrono::milliseconds wait=std::chrono::milliseconds(0)) override
 
void pull_push ()
 
int64_t push_unlock ()
 
int64_t push () override
 
- Public Member Functions inherited from joedb::Client
 Client (Readonly_Journal &journal, Connection &connection, Content_Check content_check)
 
const Readonly_Journalget_journal () const
 
bool is_shared () const
 
int64_t get_journal_checkpoint () const
 
std::string read_blob (Blob blob) const
 
int64_t get_connection_checkpoint () const
 
int64_t get_checkpoint_difference () const
 
virtual ~Client ()
 

Protected Member Functions

void read_journal () override
 
- Protected Member Functions inherited from joedb::Writable_Client
template<typename F >
auto transaction (F transaction)
 
- Protected Member Functions inherited from joedb::Client
int64_t push (Unlock_Action unlock_action)
 

Friends

class Client_Lock
 

Additional Inherited Members

- Protected Attributes inherited from joedb::Client
Readonly_Journaljournal
 
Connectionconnection
 
int64_t connection_checkpoint
 

Detailed Description

Definition at line 36 of file Client.h.

Constructor & Destructor Documentation

◆ Client()

tutorial::Client::Client ( joedb::Buffered_File file,
joedb::Connection connection,
joedb::Content_Check  content_check = joedb::Content_Check::quick 
)
inline

Definition at line 58 of file Client.h.

Member Function Documentation

◆ get_database()

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

Definition at line 79 of file Client.h.

◆ read_journal()

void tutorial::Client::read_journal ( )
inlineoverrideprotectedvirtual

Reimplemented from joedb::Client.

Definition at line 46 of file Client.h.

◆ transaction()

template<typename F >
auto 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 95 of file Client.h.

Friends And Related Symbol Documentation

◆ Client_Lock

friend class Client_Lock
friend

Definition at line 40 of file Client.h.


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