Joedb 9.1.4
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Public Member Functions | Protected 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/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 (Client &client)
 
 Client_Lock (const Client_Lock &)=delete
 
Client_Lockoperator= (const Client_Lock &)=delete
 
void push ()
 Checkpoint current journal, and push to the connection.
 
void push_unlock ()
 Confirm the transaction right before lock destruction.
 
void unlock ()
 Cancel the transaction right before lock destruction.
 
 ~Client_Lock ()
 

Protected Member Functions

bool is_locked () const
 

Protected Attributes

Clientclient
 
Journal_Lock journal_lock
 

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 160 of file Client.h.

Constructor & Destructor Documentation

◆ Client_Lock() [1/2]

joedb::Client_Lock::Client_Lock ( Client client)
inline

Definition at line 171 of file 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 216 of file Client.h.

Member Function Documentation

◆ is_locked()

bool joedb::Client_Lock::is_locked ( ) const
inlineprotected

Definition at line 168 of file Client.h.

◆ operator=()

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

◆ push()

void joedb::Client_Lock::push ( )
inline

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

Definition at line 186 of file Client.h.

◆ push_unlock()

void joedb::Client_Lock::push_unlock ( )
inline

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

Definition at line 197 of file 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 209 of file Client.h.

Member Data Documentation

◆ client

Client& joedb::Client_Lock::client
protected

Definition at line 166 of file Client.h.

◆ journal_lock

Journal_Lock joedb::Client_Lock::journal_lock
protected

Definition at line 167 of file Client.h.


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