20 #ifndef RIPPLE_APP_DATA_DATABASECON_H_INCLUDED
21 #define RIPPLE_APP_DATA_DATABASECON_H_INCLUDED
23 #include <ripple/app/main/DBInit.h>
24 #include <ripple/core/Config.h>
25 #include <ripple/core/SociDB.h>
26 #include <boost/filesystem/path.hpp>
36 template <
class T,
class TMutex>
51 :
it_(rhs.it_),
lock_(std::move(rhs.lock_))
74 explicit operator bool()
const
87 explicit Setup() =
default;
94 template <std::
size_t N, std::
size_t M>
106 boost::filesystem::path pPath =
107 useTempFiles ?
"" : (setup.
dataDir / DBName);
109 init(pPath, pragma, initSQL);
112 template <std::
size_t N, std::
size_t M>
114 boost::filesystem::path
const& dataDir,
119 init((dataDir / DBName), pragma, initSQL);
138 template <std::
size_t N, std::
size_t M>
141 boost::filesystem::path
const& pPath,
147 for (
auto const& p : pragma)
149 soci::statement st =
session_.prepare << p;
152 for (
auto const& sql : initSQL)
154 soci::statement st =
session_.prepare << sql;
DatabaseCon(boost::filesystem::path const &dataDir, std::string const &DBName, std::array< char const *, N > const &pragma, std::array< char const *, M > const &initSQL)
Manages partitions for logging.
LockedPointer< soci::session, std::recursive_mutex > LockedSociSession
DatabaseCon(Setup const &setup, std::string const &DBName, std::array< char const *, N > const &pragma, std::array< char const *, M > const &initSQL)
Config::StartUpType startUp
boost::filesystem::path dataDir
LockedPointer(T *it, mutex &m)
void setupCheckpointing(JobQueue *, Logs &)
LockedSociSession::mutex lock_
LockedPointer(LockedPointer &&rhs) noexcept
std::unique_lock< mutex > lock_
DatabaseCon::Setup setup_DatabaseCon(Config const &c)
LockedSociSession checkoutDb()
void init(boost::filesystem::path const &pPath, std::array< char const *, N > const &pragma, std::array< char const *, M > const &initSQL)
A pool of threads to perform work.
soci::session & getSession()
LockedPointer & operator=(LockedPointer const &rhs)=delete
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::unique_ptr< Checkpointer > checkpointer_
void open(soci::session &s, BasicConfig const &config, std::string const &dbName)
Open a soci session.