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

#include <joedb/concurrency/Server_Connection.h>

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

Public Member Functions

 Server_Connection (Channel &channel)
 
int64_t handshake (Readonly_Journal &client_journal, bool content_check) override
 Called during Client construction.
 
int64_t pull (Writable_Journal &client_journal, std::chrono::milliseconds wait) override
 Pull new data from the connection.
 
int64_t lock_pull (Writable_Journal &client_journal, std::chrono::milliseconds wait=std::chrono::milliseconds{0}) override
 Fused lock_pull, executed at the start of a write transaction.
 
int64_t get_checkpoint (Readonly_Journal &client_journal, std::chrono::milliseconds wait) override
 Get new connection checkpoint without pulling.
 
int64_t push_until (Readonly_Journal &client_journal, int64_t server_position, int64_t until_position, bool unlock_after) override
 Push new data to the connection.
 
void unlock () override
 Can be used to cancel a transaction without pushing.
 
- Public Member Functions inherited from joedb::Server_Client
 Server_Client (Channel &channel)
 
void set_log (std::ostream *stream)
 
void set_keep_alive_interval (std::chrono::seconds duration)
 
int64_t get_session_id () const
 
Thread_Safe_Channelget_channel ()
 
void ping ()
 
 ~Server_Client ()
 
- Public Member Functions inherited from joedb::Connection
int64_t push (Readonly_Journal &client_journal, int64_t from_checkpoint, bool unlock_after)
 Shortcut to call push_until until the client checkpoint.
 
virtual ~Connection ()
 

Protected Member Functions

int64_t pull (Writable_Journal *client_journal, std::chrono::milliseconds wait, char pull_type)
 
bool check_matching_content (Readonly_Journal &client_journal, int64_t server_checkpoint)
 
- Protected Member Functions inherited from joedb::Server_Client
void download (Async_Writer &writer, Channel_Lock &lock, int64_t size) const
 

Additional Inherited Members

- Static Protected Member Functions inherited from joedb::Connection
static void content_mismatch ()
 
- Protected Attributes inherited from joedb::Server_Client
Thread_Safe_Channel channel
 
std::ostream * log
 
bool connected
 
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)
inline

Definition at line 27 of file Server_Connection.h.

Member Function Documentation

◆ check_matching_content()

bool joedb::Server_Connection::check_matching_content ( Readonly_Journal client_journal,
int64_t  server_checkpoint 
)
protected

Definition at line 186 of file Server_Connection.cpp.

◆ get_checkpoint()

int64_t joedb::Server_Connection::get_checkpoint ( Readonly_Journal client_journal,
std::chrono::milliseconds  wait 
)
overridevirtual
Return values
server_checkpoint

Reimplemented from joedb::Connection.

Definition at line 110 of file Server_Connection.cpp.

◆ handshake()

int64_t joedb::Server_Connection::handshake ( Readonly_Journal client_journal,
bool  content_check 
)
overridevirtual
Parameters
client_journalmay be used to check matching content
content_checkindicates whether matching content is tested
Return values
server_checkpoint

Reimplemented from joedb::Connection.

Reimplemented in joedb::Server_File.

Definition at line 223 of file Server_Connection.cpp.

◆ lock_pull()

int64_t joedb::Server_Connection::lock_pull ( Writable_Journal client_journal,
std::chrono::milliseconds  wait = std::chrono::milliseconds{0} 
)
overridevirtual
Return values
server_checkpoint

Reimplemented from joedb::Connection.

Reimplemented in joedb::Server_File.

Definition at line 99 of file Server_Connection.cpp.

◆ pull() [1/2]

int64_t joedb::Server_Connection::pull ( Writable_Journal client_journal,
std::chrono::milliseconds  wait 
)
overridevirtual
Parameters
client_journaljournal to pull into
waitduration during which the connection may wait for new data if the pull would otherwise be empty
Return values
server_checkpoint

Reimplemented from joedb::Connection.

Reimplemented in joedb::Server_File.

Definition at line 88 of file Server_Connection.cpp.

◆ pull() [2/2]

int64_t joedb::Server_Connection::pull ( Writable_Journal client_journal,
std::chrono::milliseconds  wait,
char  pull_type 
)
protected

Definition at line 36 of file Server_Connection.cpp.

◆ push_until()

int64_t joedb::Server_Connection::push_until ( Readonly_Journal client_journal,
int64_t  from_checkpoint,
int64_t  until_checkpoint,
bool  unlock_after 
)
overridevirtual
Return values
server_checkpoint

Reimplemented from joedb::Connection.

Reimplemented in joedb::Server_File.

Definition at line 121 of file Server_Connection.cpp.

◆ unlock()

void joedb::Server_Connection::unlock ( )
overridevirtual

Reimplemented from joedb::Connection.

Definition at line 16 of file Server_Connection.cpp.


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