22#include "data/BackendInterface.hpp"
23#include "data/CassandraBackend.hpp"
24#include "data/cassandra/SettingsProvider.hpp"
25#include "util/log/Logger.hpp"
26#include "util/newconfig/ConfigDefinition.hpp"
28#include <boost/algorithm/string.hpp>
29#include <boost/algorithm/string/predicate.hpp>
43inline std::shared_ptr<BackendInterface>
47 LOG(log.info()) <<
"Constructing BackendInterface";
49 auto const readOnly = config.
get<
bool>(
"read_only");
51 auto const type = config.
get<std::string>(
"database.type");
52 std::shared_ptr<BackendInterface> backend =
nullptr;
54 if (boost::iequals(type,
"cassandra")) {
55 auto const cfg = config.
getObject(
"database." + type);
60 throw std::runtime_error(
"Invalid database type");
62 auto const rng = backend->hardFetchLedgerRangeNoThrow();
64 backend->setRange(rng->minSequence, rng->maxSequence);
66 LOG(log.info()) <<
"Constructed BackendInterface Successfully";
Provides settings for BasicCassandraBackend.
Definition SettingsProvider.hpp:35
A simple thread-safe logger for the channel specified in the constructor.
Definition Logger.hpp:110
All the config data will be stored and extracted from this class.
Definition ConfigDefinition.hpp:54
ObjectView getObject(std::string_view prefix, std::optional< std::size_t > idx=std::nullopt) const
Returns the ObjectView specified with the prefix.
Definition ConfigDefinition.cpp:61
T get(std::string_view fullKey) const
Returns the specified value of given string if value exists.
Definition ConfigDefinition.hpp:108
This namespace implements the data access layer and related components.
Definition AmendmentCenter.cpp:70
std::shared_ptr< BackendInterface > makeBackend(util::config::ClioConfigDefinition const &config)
A factory function that creates the backend based on a config.
Definition BackendFactory.hpp:44