Joedb 9.6.2
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
joedb::Client_Lock Class Reference

Lock object that allows writing to a database managed by a joedb::Client. More...

#include <joedb/concurrency/Writable_Client.h>

Inheritance diagram for joedb::Client_Lock:
Inheritance graph
[legend]
Collaboration diagram for joedb::Client_Lock:
Collaboration graph
[legend]

Public Member Functions

 Client_Lock (Writable_Client &client)
 
 Client_Lock (const Client_Lock &)=delete
 
Client_Lockoperator= (const Client_Lock &)=delete
 
void do_checkpoint ()
 Checkpoint current journal, but do not push yet.
 
void push_if_ahead ()
 Push if the journal checkpoint is ahead of the connection checkpoint.
 
void checkpoint_and_push ()
 Checkpoint current journal, and push to the connection.
 
void checkpoint_and_push_unlock ()
 Confirm the transaction right before lock destruction.
 
void unlock ()
 Cancel the transaction right before lock destruction.
 
 ~Client_Lock ()
 The destructor unlocks the connection if necessary.
 

Protected Attributes

Writable_Clientclient
 
const Journal_Lock journal_lock
 
bool locked
 

Detailed Description

At the end of the life of this object, right before destruction, you should call either unlock to cancel the transaction, or push_unlock to confirm it. If you fail to do so, the destructor will call unlock. But calling unlock explicitly is better, if possible, because it can throw exceptions, unlike the destructor.

Definition at line 170 of file Writable_Client.h.

Constructor & Destructor Documentation

◆ Client_Lock() [1/2]

joedb::Client_Lock::Client_Lock ( Writable_Client client)
inline

Definition at line 178 of file Writable_Client.h.

◆ Client_Lock() [2/2]

joedb::Client_Lock::Client_Lock ( const Client_Lock )
delete

◆ ~Client_Lock()

joedb::Client_Lock::~Client_Lock ( )
inline

Definition at line 241 of file Writable_Client.h.

Member Function Documentation

◆ checkpoint_and_push()

void joedb::Client_Lock::checkpoint_and_push ( )
inline

Unlike push_unlock, you can call this function multiple times during the life of the lock.

Definition at line 210 of file Writable_Client.h.

◆ checkpoint_and_push_unlock()

void joedb::Client_Lock::checkpoint_and_push_unlock ( )
inline

Destruction should happen right after this function. Do not call any other member function after this one.

Definition at line 221 of file Writable_Client.h.

◆ do_checkpoint()

void joedb::Client_Lock::do_checkpoint ( )
inline

Definition at line 190 of file Writable_Client.h.

◆ operator=()

Client_Lock & joedb::Client_Lock::operator= ( const Client_Lock )
delete

◆ push_if_ahead()

void joedb::Client_Lock::push_if_ahead ( )
inline

This function keeps the connection locked

Definition at line 199 of file Writable_Client.h.

◆ unlock()

void joedb::Client_Lock::unlock ( )
inline

Destruction should happen right after this function. Do not call any other member function after this one.

Definition at line 233 of file Writable_Client.h.

Member Data Documentation

◆ client

Writable_Client& joedb::Client_Lock::client
protected

Definition at line 173 of file Writable_Client.h.

◆ journal_lock

const Journal_Lock joedb::Client_Lock::journal_lock
protected

Definition at line 174 of file Writable_Client.h.

◆ locked

bool joedb::Client_Lock::locked
protected

Definition at line 175 of file Writable_Client.h.


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