Joedb 10.5.0
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
joedb::Connection Class Reference

#include <joedb/concurrency/Connection.h>

Inheritance diagram for joedb::Connection:
Collaboration diagram for joedb::Connection:

Public Member Functions

virtual int64_t handshake (const Readonly_Journal &client_journal, Content_Check content_check)
 Called during Client construction.
virtual void check_matching_content (const Readonly_Journal &client_journal, Content_Check content_check, int64_t from, int64_t until)
 Compare content of file and connection. Throw if mismatch.
virtual int64_t pull (Lock_Action lock_action, Data_Transfer data_transfer, Writable_Journal &client_journal, std::chrono::milliseconds wait=std::chrono::milliseconds(0))
 Pull from the connection.
virtual int64_t push (const Readonly_Journal &client_journal, int64_t from, int64_t until, Unlock_Action unlock_action)
 Push new data to the connection.
virtual void unlock ()
 Unlock the connection.
virtual bool is_pullonly () const
virtual ~Connection ()

Static Public Attributes

static Connection dummy
 Since this class has no internal state, this global variable can be used instead of creating an instance.

Protected Member Functions

 Connection ()=default

Static Protected Member Functions

static void content_mismatch ()
 Called by handshake when the file and the connection do not match.

Detailed Description

Definition at line 48 of file Connection.h.

Constructor & Destructor Documentation

◆ Connection()

joedb::Connection::Connection ( )
protecteddefault

◆ ~Connection()

joedb::Connection::~Connection ( )
virtualdefault

Member Function Documentation

◆ check_matching_content()

void joedb::Connection::check_matching_content ( const Readonly_Journal & client_journal,
Content_Check content_check,
int64_t from,
int64_t until )
virtual

◆ content_mismatch()

void joedb::Connection::content_mismatch ( )
staticprotected

Definition at line 9 of file Connection.cpp.

◆ handshake()

int64_t joedb::Connection::handshake ( const Readonly_Journal & client_journal,
Content_Check content_check )
virtual
Parameters
client_journalmay be used to check matching content
content_checkindicates how matching content is tested
Returns
connection checkpoint

Reimplemented in joedb::Pullonly_Journal_Connection, joedb::Robust_Connection, joedb::Server_Connection, and joedb::Server_File.

Definition at line 14 of file Connection.cpp.

◆ is_pullonly()

bool joedb::Connection::is_pullonly ( ) const
virtual

◆ pull()

int64_t joedb::Connection::pull ( Lock_Action lock_action,
Data_Transfer data_transfer,
Writable_Journal & client_journal,
std::chrono::milliseconds wait = std::chrono::milliseconds(0) )
virtual
Parameters
lock_actionwhether the connection should be locked before pulling
data_transferwhether data should be transferred
client_journaljournal to pull into
waitduration during which the connection may wait for new data if the pull would otherwise be empty
Returns
connection checkpoint

Reimplemented in joedb::Journal_Connection, joedb::Pullonly_Journal_Connection, joedb::Robust_Connection, joedb::Server_Connection, and joedb::Server_File.

Definition at line 33 of file Connection.cpp.

◆ push()

int64_t joedb::Connection::push ( const Readonly_Journal & client_journal,
int64_t from,
int64_t until,
Unlock_Action unlock_action )
virtual

◆ unlock()

void joedb::Connection::unlock ( )
virtual

Member Data Documentation

◆ dummy

Connection joedb::Connection::dummy
static

The default constructor is protected to force using it.

Definition at line 116 of file Connection.h.


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