5 void Robust_Connection::log_exception(
const std::exception *e)
const
8 *log <<
"Robust_Connection: " << e->what() << std::endl;
17 std::this_thread::sleep_until(last_connection_time + period);
18 last_connection_time = clock::now();
25 connection = std::make_unique<Server_Connection>(*channel, log);
26 if (handshake_journal)
27 connection->handshake(*handshake_journal, handshake_content_check);
30 catch (std::exception &reconnect_exception)
32 log_exception(&reconnect_exception);
53 return connection->handshake(client_journal, content_check);
56 handshake_journal = &client_journal;
57 handshake_content_check = content_check;
67 std::chrono::milliseconds wait
72 return connection->pull(lock_action, data_transfer, client_journal, wait);
79 int64_t from_checkpoint,
80 int64_t until_checkpoint,
102 catch (
const std::exception &e)
105 *log <<
"Robust_Connection::unlock() error: " << e.what() <<
'\n';
virtual std::unique_ptr< Channel > new_channel() const =0
void reconnect(const std::exception *e) const
int64_t pull(Lock_Action lock_action, Data_Transfer data_transfer, Writable_Journal &client_journal, std::chrono::milliseconds wait) override
Pull from the connection.
std::unique_ptr< Server_Connection > connection
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.
auto try_until_success(const F &f) const
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.