22#include "data/cassandra/Error.hpp"
23#include "data/cassandra/Types.hpp"
24#include "util/Retry.hpp"
25#include "util/log/Logger.hpp"
27#include <boost/asio.hpp>
28#include <boost/asio/io_context.hpp>
29#include <boost/asio/strand.hpp>
33namespace data::cassandra::impl {
49 util::makeRetryExponentialBackoff(
50 std::chrono::milliseconds(1),
51 std::chrono::seconds(1),
52 boost::asio::make_strand(ioc)
66 auto const delayMs = std::chrono::duration_cast<std::chrono::milliseconds>(retry_.delayValue()).count();
67 LOG(log_.error()) <<
"Cassandra write error: " << err <<
", current retries " << retry_.attemptNumber()
68 <<
", retrying in " << delayMs <<
" milliseconds";
78 template <
typename Fn>
82 retry_.retry(std::forward<Fn>(fn));
A simple container for both error message and error code.
Definition Error.hpp:34
bool shouldRetry(CassandraError err)
Computes next retry delay and returns true unconditionally.
Definition RetryPolicy.hpp:64
ExponentialBackoffRetryPolicy(boost::asio::io_context &ioc)
Create a new retry policy instance with the io_context provided.
Definition RetryPolicy.hpp:47
void retry(Fn &&fn)
Schedules next retry.
Definition RetryPolicy.hpp:80
A simple thread-safe logger for the channel specified in the constructor.
Definition Logger.hpp:94
A retry mechanism.
Definition Retry.hpp:80
This namespace contains various utilities.
Definition AccountUtils.hpp:30