refactor: Refactor main (#1555)

For #442.
This commit is contained in:
Sergey Kuznetsov
2024-08-01 10:53:17 +01:00
committed by GitHub
parent fb90fb27ae
commit 2fef03d766
36 changed files with 920 additions and 376 deletions

View File

@@ -21,6 +21,7 @@
#include "data/cassandra/impl/ManagedObject.hpp"
#include "data/cassandra/impl/SslContext.hpp"
#include "util/OverloadSet.hpp"
#include "util/log/Logger.hpp"
#include <cassandra.h>
@@ -31,16 +32,9 @@
#include <variant>
namespace {
constexpr auto clusterDeleter = [](CassCluster* ptr) { cass_cluster_free(ptr); };
template <typename... Ts>
struct overloadSet : Ts... {
using Ts::operator()...;
};
// explicit deduction guide (not needed as of C++20, but clang be clang)
template <typename... Ts>
overloadSet(Ts...) -> overloadSet<Ts...>;
}; // namespace
namespace data::cassandra::impl {
@@ -90,7 +84,7 @@ void
Cluster::setupConnection(Settings const& settings)
{
std::visit(
overloadSet{
util::OverloadSet{
[this](Settings::ContactPoints const& points) { setupContactPoints(points); },
[this](Settings::SecureConnectionBundle const& bundle) { setupSecureBundle(bundle); }
},