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

#include <joedb/concurrency/Server_Connection.h>

Inheritance diagram for joedb::Server_Connection:
Collaboration diagram for joedb::Server_Connection:

Public Member Functions

 Server_Connection (Channel &channel, Logger &logger=Logger::dummy_logger, std::chrono::milliseconds keep_alive_interval=std::chrono::seconds(0))
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.
void check_matching_content (const Readonly_Journal &client_journal, Content_Check content_check, int64_t from, int64_t until) override
 Compare content of file and connection. Throw if mismatch.
int64_t pull (Lock_Action lock_action, Data_Transfer data_transfer, Writable_Journal &client_journal, std::chrono::milliseconds wait=std::chrono::milliseconds(0)) override
 Pull from the connection.
int64_t push (const Readonly_Journal &client_journal, int64_t from, int64_t until, Unlock_Action unlock_action) override
 Push new data to the connection.
void unlock () override
 Unlock the connection.
bool is_pullonly () const override
Public Member Functions inherited from joedb::Server_Client
 Server_Client (Channel &channel, Logger &logger=Logger::dummy_logger, std::chrono::milliseconds keep_alive_interval=std::chrono::milliseconds(0))
int64_t get_session_id () const
Thread_Safe< Channel & > & get_channel () override final
 ~Server_Client ()
Public Member Functions inherited from joedb::Logger
virtual ~Logger ()=default
Public Member Functions inherited from joedb::Ping_Client
void ping ()
virtual ~Ping_Client ()=default
Public Member Functions inherited from joedb::Connection
virtual ~Connection ()

Additional Inherited Members

Static Public Attributes inherited from joedb::Logger
static Logger dummy_logger
Static Public Attributes inherited from joedb::Connection
static Connection dummy
 Since this class has no internal state, this global variable can be used instead of creating an instance.
Protected Member Functions inherited from joedb::Server_Client
void download (Async_Writer &writer, Lock< Channel & > &lock, int64_t size) const
void log (beman::cstring_view message) noexcept override
Protected Member Functions inherited from joedb::Connection
 Connection ()=default
Static Protected Member Functions inherited from joedb::Connection
static void content_mismatch ()
 Called by handshake when the file and the connection do not match.
Protected Attributes inherited from joedb::Server_Client
Thread_Safe< Channel & > channel
Logger & logger
Buffer< 13 > buffer
int64_t session_id
bool pullonly_server
int64_t server_checkpoint

Detailed Description

Definition at line 10 of file Server_Connection.h.

Constructor & Destructor Documentation

◆ Server_Connection()

joedb::Server_Connection::Server_Connection ( Channel & channel,
Logger & logger = Logger::dummy_logger,
std::chrono::milliseconds keep_alive_interval = std::chrono::seconds(0) )
inline

Definition at line 13 of file Server_Connection.h.

Member Function Documentation

◆ check_matching_content()

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

Reimplemented from joedb::Connection.

Definition at line 54 of file Server_Connection.cpp.

◆ handshake()

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

Reimplemented from joedb::Connection.

Definition at line 35 of file Server_Connection.cpp.

◆ is_pullonly()

bool joedb::Server_Connection::is_pullonly ( ) const
inlineoverridevirtual

Reimplemented from joedb::Connection.

Definition at line 57 of file Server_Connection.h.

◆ pread()

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

Definition at line 9 of file Server_Connection.cpp.

◆ pull()

int64_t joedb::Server_Connection::pull ( Lock_Action lock_action,
Data_Transfer data_transfer,
Writable_Journal & client_journal,
std::chrono::milliseconds wait = std::chrono::milliseconds(0) )
overridevirtual
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 from joedb::Connection.

Definition at line 93 of file Server_Connection.cpp.

◆ push()

int64_t joedb::Server_Connection::push ( const Readonly_Journal & client_journal,
int64_t from,
int64_t until,
Unlock_Action unlock_action )
overridevirtual
Returns
connection checkpoint

Reimplemented from joedb::Connection.

Definition at line 142 of file Server_Connection.cpp.

◆ unlock()

void joedb::Server_Connection::unlock ( )
overridevirtual

Reimplemented from joedb::Connection.

Definition at line 201 of file Server_Connection.cpp.


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