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>
27 #include <ripple/rpc/ShardVerificationScheduler.h>
29 #include <boost/asio/basic_waitable_timer.hpp>
30 #include <boost/filesystem.hpp>
34 class ShardArchiveHandler_test;
46 static boost::filesystem::path
106 complete(boost::filesystem::path dstPath);
110 process(boost::filesystem::path
const& dstPath);
142 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_
void remove(std::lock_guard< std::mutex > const &)
TimerOpCounter timerCounter_
ShardVerificationScheduler verificationScheduler_
ShardArchiveHandler & operator=(ShardArchiveHandler &&)=delete
bool removeAndProceed(std::lock_guard< std::mutex > const &lock)
virtual ~ShardArchiveHandler()=default
bool start()
Starts downloading and importing archives.
bool add(std::uint32_t shardIndex, std::pair< parsedURL, std::string > &&url)
void onStop() override
Override called when the stop notification is issued.
void doRelease(std::lock_guard< std::mutex > const &)
bool initFromDB(std::lock_guard< std::mutex > const &)
bool onClosureFailed(std::string const &errorMsg, std::lock_guard< std::mutex > const &lock)
boost::asio::basic_waitable_timer< std::chrono::steady_clock > timer_
Provides an interface for starting and stopping.
void process(boost::filesystem::path const &dstPath)
std::unique_ptr< DatabaseCon > sqliteDB_
void complete(boost::filesystem::path dstPath)
A generic endpoint for log messages.
static std::unique_ptr< ShardArchiveHandler > makeShardArchiveHandler(Application &app, Stoppable &parent)
RecoveryHandler(Application &app, Stoppable &parent)
static std::unique_ptr< ShardArchiveHandler > tryMakeRecoveryHandler(Application &app, Stoppable &parent)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool next(std::lock_guard< std::mutex > const &l)
std::map< std::uint32_t, parsedURL > archives_
Handles the download and import of one or more shard archives.
ShardArchiveHandler()=delete