3#include "data/cassandra/Error.hpp"
4#include "data/cassandra/Types.hpp"
5#include "util/Retry.hpp"
6#include "util/log/Logger.hpp"
8#include <boost/asio.hpp>
9#include <boost/asio/io_context.hpp>
10#include <boost/asio/strand.hpp>
14namespace data::cassandra::impl {
30 util::makeRetryExponentialBackoff(
31 std::chrono::milliseconds(1),
32 std::chrono::seconds(1),
33 boost::asio::make_strand(ioc)
48 std::chrono::duration_cast<std::chrono::milliseconds>(retry_.delayValue()).count();
49 LOG(log_.error()) <<
"Cassandra write error: " << err <<
", current retries "
50 << retry_.attemptNumber() <<
", retrying in " << delayMs
61 template <
typename Fn>
65 retry_.retry(std::forward<Fn>(fn));
A simple container for both error message and error code.
Definition Error.hpp:15
bool shouldRetry(CassandraError err)
Computes next retry delay and returns true unconditionally.
Definition RetryPolicy.hpp:45
ExponentialBackoffRetryPolicy(boost::asio::io_context &ioc)
Create a new retry policy instance with the io_context provided.
Definition RetryPolicy.hpp:28
void retry(Fn &&fn)
Schedules next retry.
Definition RetryPolicy.hpp:63
A simple thread-safe logger for the channel specified in the constructor.
Definition Logger.hpp:77
A retry mechanism.
Definition Retry.hpp:61
This namespace contains various utilities.
Definition AccountUtils.hpp:11