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

Server_Connection that automatically reconnects on error More...

#include <joedb/concurrency/Robust_Connection.h>

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

Public Member Functions

 Robust_Connection (const Connector &connector, std::ostream *log)
 
size_t pread (char *data, size_t size, int64_t offset) const
 
int64_t handshake (const Readonly_Journal &client_journal, Content_Check content_check) override
 Called during Client construction.
 
int64_t pull (Lock_Action lock_action, Data_Transfer data_transfer, Writable_Journal &client_journal, std::chrono::milliseconds wait) override
 Pull from the connection.
 
int64_t push (const Readonly_Journal &client_journal, int64_t from_checkpoint, int64_t until_checkpoint, Unlock_Action unlock_action) override
 Push new data to the connection.
 
void unlock () override
 Unlock the connection.
 
- Public Member Functions inherited from joedb::Connection
virtual ~Connection ()
 

Protected Member Functions

void reconnect (const std::exception *e) const
 
template<typename F >
auto try_until_success (const F &f) const
 

Protected Attributes

std::unique_ptr< Server_Connectionconnection
 

Additional Inherited Members

- Static Protected Member Functions inherited from joedb::Connection
static void content_mismatch ()
 Called by handshake when the file and the connection do not match.
 

Detailed Description

Definition at line 14 of file Robust_Connection.h.

Constructor & Destructor Documentation

◆ Robust_Connection()

joedb::Robust_Connection::Robust_Connection ( const Connector connector,
std::ostream *  log 
)
inline

Definition at line 81 of file Robust_Connection.h.

Member Function Documentation

◆ handshake()

int64_t joedb::Robust_Connection::handshake ( const Readonly_Journal client_journal,
Content_Check  content_check 
)
inlineoverridevirtual
Parameters
client_journalmay be used to check matching content
content_checkindicates how matching content is tested
Return values
connectioncheckpoint

Reimplemented from joedb::Connection.

Reimplemented in joedb::Server_File.

Definition at line 96 of file Robust_Connection.h.

◆ pread()

size_t joedb::Robust_Connection::pread ( char *  data,
size_t  size,
int64_t  offset 
) const
inline

Definition at line 88 of file Robust_Connection.h.

◆ pull()

int64_t joedb::Robust_Connection::pull ( Lock_Action  lock_action,
Data_Transfer  data_transfer,
Writable_Journal client_journal,
std::chrono::milliseconds  wait 
)
inlineoverridevirtual
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
Return values
servercheckpoint

Reimplemented from joedb::Connection.

Reimplemented in joedb::Server_File.

Definition at line 113 of file Robust_Connection.h.

◆ push()

int64_t joedb::Robust_Connection::push ( const Readonly_Journal client_journal,
int64_t  from,
int64_t  until,
Unlock_Action  unlock_action 
)
inlineoverridevirtual
Return values
servercheckpoint

Reimplemented from joedb::Connection.

Reimplemented in joedb::Server_File.

Definition at line 127 of file Robust_Connection.h.

◆ reconnect()

void joedb::Robust_Connection::reconnect ( const std::exception *  e) const
inlineprotected

Definition at line 39 of file Robust_Connection.h.

◆ try_until_success()

template<typename F >
auto joedb::Robust_Connection::try_until_success ( const F &  f) const
inlineprotected

Definition at line 65 of file Robust_Connection.h.

◆ unlock()

void joedb::Robust_Connection::unlock ( )
inlineoverridevirtual

Reimplemented from joedb::Connection.

Definition at line 147 of file Robust_Connection.h.

Member Data Documentation

◆ connection

std::unique_ptr<Server_Connection> joedb::Robust_Connection::connection
mutableprotected

Definition at line 37 of file Robust_Connection.h.


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