20 #ifndef RIPPLE_RPC_SHARDARCHIVEHANDLER_H_INCLUDED
21 #define RIPPLE_RPC_SHARDARCHIVEHANDLER_H_INCLUDED
23 #include <ripple/app/main/Application.h>
24 #include <ripple/basics/BasicConfig.h>
25 #include <ripple/basics/StringUtilities.h>
26 #include <ripple/net/DatabaseDownloader.h>
28 #include <boost/asio/basic_waitable_timer.hpp>
29 #include <boost/filesystem.hpp>
32 namespace test {
class ShardArchiveHandler_test; }
46 boost::filesystem::path
93 bool recovery =
false);
113 complete(boost::filesystem::path dstPath);
117 process(boost::filesystem::path
const& dstPath);
135 boost::asio::basic_waitable_timer<std::chrono::steady_clock>
timer_;
static boost::filesystem::path getDownloadDirectory(Config const &config)
std::shared_ptr< DatabaseDownloader > downloader_
const boost::filesystem::path downloadDir_
ShardArchiveHandler & operator=(ShardArchiveHandler &&)=delete
bool start()
Starts downloading and importing archives.
bool add(std::uint32_t shardIndex, std::pair< parsedURL, std::string > &&url)
static pointer recoverInstance(Application &app, Stoppable &parent)
void onStop() override
Override called when the stop notification is issued.
void doRelease(std::lock_guard< std::mutex > const &)
boost::asio::basic_waitable_timer< std::chrono::steady_clock > timer_
Provides an interface for starting and stopping.
void process(boost::filesystem::path const &dstPath)
void remove(std::lock_guard< std::mutex > &)
~ShardArchiveHandler()=default
std::unique_ptr< DatabaseCon > sqliteDB_
void complete(boost::filesystem::path dstPath)
A generic endpoint for log messages.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::map< std::uint32_t, parsedURL > archives_
static bool hasInstance()
Handles the download and import one or more shard archives.
ShardArchiveHandler()=delete
static std::mutex instance_mutex_
static pointer getInstance()
bool next(std::lock_guard< std::mutex > &l)