rippled
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ripple::RPC::RecoveryHandler Class Reference
Inheritance diagram for ripple::RPC::RecoveryHandler:
Inheritance graph
[legend]
Collaboration diagram for ripple::RPC::RecoveryHandler:
Collaboration graph
[legend]

Public Types

using TimerOpCounter = ClosureCounter< void, boost::system::error_code const & >
 

Public Member Functions

 RecoveryHandler (Application &app)
 
bool init ()
 
bool add (std::uint32_t shardIndex, std::pair< parsedURL, std::string > &&url)
 
bool start ()
 Starts downloading and importing archives. More...
 
void stop ()
 
void release ()
 

Static Public Member Functions

static boost::filesystem::path getDownloadDirectory (Config const &config)
 
static std::unique_ptr< ShardArchiveHandlermakeShardArchiveHandler (Application &app)
 
static std::unique_ptr< ShardArchiveHandlertryMakeRecoveryHandler (Application &app)
 

Private Member Functions

bool add (std::uint32_t shardIndex, parsedURL &&url, std::lock_guard< std::mutex > const &)
 Add an archive to be downloaded and imported. More...
 
bool initFromDB (std::lock_guard< std::mutex > const &)
 
bool next (std::lock_guard< std::mutex > const &l)
 
void complete (boost::filesystem::path dstPath)
 
void process (boost::filesystem::path const &dstPath)
 
void remove (std::lock_guard< std::mutex > const &)
 
void doRelease (std::lock_guard< std::mutex > const &)
 
bool onClosureFailed (std::string const &errorMsg, std::lock_guard< std::mutex > const &lock)
 
bool removeAndProceed (std::lock_guard< std::mutex > const &lock)
 

Private Attributes

std::mutex m_
 
std::atomic_bool stopping_ {false}
 
std::shared_ptr< DatabaseDownloaderdownloader_
 
std::map< std::uint32_t, parsedURLarchives_
 
bool process_
 
std::unique_ptr< DatabaseConsqlDB_
 
Applicationapp_
 
const beast::Journal j_
 
const boost::filesystem::path downloadDir_
 
boost::asio::basic_waitable_timer< std::chrono::steady_clocktimer_
 
JobCounter jobCounter_
 
TimerOpCounter timerCounter_
 
ShardVerificationScheduler verificationScheduler_
 

Detailed Description

Definition at line 167 of file ShardArchiveHandler.h.

Member Typedef Documentation

◆ TimerOpCounter

using ripple::RPC::ShardArchiveHandler::TimerOpCounter = ClosureCounter<void, boost::system::error_code const&>
inherited

Definition at line 46 of file ShardArchiveHandler.h.

Constructor & Destructor Documentation

◆ RecoveryHandler()

ripple::RPC::RecoveryHandler::RecoveryHandler ( Application app)
explicit

Definition at line 580 of file ShardArchiveHandler.cpp.

Member Function Documentation

◆ getDownloadDirectory()

boost::filesystem::path ripple::RPC::ShardArchiveHandler::getDownloadDirectory ( Config const &  config)
staticinherited

Definition at line 38 of file ShardArchiveHandler.cpp.

◆ makeShardArchiveHandler()

std::unique_ptr< ShardArchiveHandler > ripple::RPC::ShardArchiveHandler::makeShardArchiveHandler ( Application app)
staticinherited

Definition at line 50 of file ShardArchiveHandler.cpp.

◆ tryMakeRecoveryHandler()

std::unique_ptr< ShardArchiveHandler > ripple::RPC::ShardArchiveHandler::tryMakeRecoveryHandler ( Application app)
staticinherited

Definition at line 56 of file ShardArchiveHandler.cpp.

◆ init()

bool ripple::RPC::ShardArchiveHandler::init ( )
inherited

Definition at line 90 of file ShardArchiveHandler.cpp.

◆ add() [1/2]

bool ripple::RPC::ShardArchiveHandler::add ( std::uint32_t  shardIndex,
std::pair< parsedURL, std::string > &&  url 
)
inherited

Definition at line 200 of file ShardArchiveHandler.cpp.

◆ add() [2/2]

bool ripple::RPC::ShardArchiveHandler::add ( std::uint32_t  shardIndex,
parsedURL &&  url,
std::lock_guard< std::mutex > const &   
)
privateinherited

Add an archive to be downloaded and imported.

Parameters
shardIndexthe index of the shard to be imported.
urlthe location of the archive.
Returns
true if successfully added.
Note
Returns false if called while downloading.

Definition at line 215 of file ShardArchiveHandler.cpp.

◆ start()

bool ripple::RPC::ShardArchiveHandler::start ( )
inherited

Starts downloading and importing archives.

Definition at line 236 of file ShardArchiveHandler.cpp.

◆ stop()

void ripple::RPC::ShardArchiveHandler::stop ( )
inherited

Definition at line 177 of file ShardArchiveHandler.cpp.

◆ release()

void ripple::RPC::ShardArchiveHandler::release ( )
inherited

Definition at line 288 of file ShardArchiveHandler.cpp.

◆ initFromDB()

bool ripple::RPC::ShardArchiveHandler::initFromDB ( std::lock_guard< std::mutex > const &  lock)
privateinherited

Definition at line 132 of file ShardArchiveHandler.cpp.

◆ next()

bool ripple::RPC::ShardArchiveHandler::next ( std::lock_guard< std::mutex > const &  l)
privateinherited

Definition at line 295 of file ShardArchiveHandler.cpp.

◆ complete()

void ripple::RPC::ShardArchiveHandler::complete ( boost::filesystem::path  dstPath)
privateinherited

Definition at line 392 of file ShardArchiveHandler.cpp.

◆ process()

void ripple::RPC::ShardArchiveHandler::process ( boost::filesystem::path const &  dstPath)
privateinherited

Definition at line 473 of file ShardArchiveHandler.cpp.

◆ remove()

void ripple::RPC::ShardArchiveHandler::remove ( std::lock_guard< std::mutex > const &  )
privateinherited

Definition at line 512 of file ShardArchiveHandler.cpp.

◆ doRelease()

void ripple::RPC::ShardArchiveHandler::doRelease ( std::lock_guard< std::mutex > const &  )
privateinherited

Definition at line 534 of file ShardArchiveHandler.cpp.

◆ onClosureFailed()

bool ripple::RPC::ShardArchiveHandler::onClosureFailed ( std::string const &  errorMsg,
std::lock_guard< std::mutex > const &  lock 
)
privateinherited

Definition at line 561 of file ShardArchiveHandler.cpp.

◆ removeAndProceed()

bool ripple::RPC::ShardArchiveHandler::removeAndProceed ( std::lock_guard< std::mutex > const &  lock)
privateinherited

Definition at line 574 of file ShardArchiveHandler.cpp.

Member Data Documentation

◆ m_

std::mutex ripple::RPC::ShardArchiveHandler::m_
mutableprivateinherited

Definition at line 137 of file ShardArchiveHandler.h.

◆ stopping_

std::atomic_bool ripple::RPC::ShardArchiveHandler::stopping_ {false}
privateinherited

Definition at line 138 of file ShardArchiveHandler.h.

◆ downloader_

std::shared_ptr<DatabaseDownloader> ripple::RPC::ShardArchiveHandler::downloader_
privateinherited

Definition at line 139 of file ShardArchiveHandler.h.

◆ archives_

std::map<std::uint32_t, parsedURL> ripple::RPC::ShardArchiveHandler::archives_
privateinherited

Definition at line 140 of file ShardArchiveHandler.h.

◆ process_

bool ripple::RPC::ShardArchiveHandler::process_
privateinherited

Definition at line 141 of file ShardArchiveHandler.h.

◆ sqlDB_

std::unique_ptr<DatabaseCon> ripple::RPC::ShardArchiveHandler::sqlDB_
privateinherited

Definition at line 142 of file ShardArchiveHandler.h.

◆ app_

Application& ripple::RPC::ShardArchiveHandler::app_
privateinherited

Definition at line 145 of file ShardArchiveHandler.h.

◆ j_

const beast::Journal ripple::RPC::ShardArchiveHandler::j_
privateinherited

Definition at line 146 of file ShardArchiveHandler.h.

◆ downloadDir_

const boost::filesystem::path ripple::RPC::ShardArchiveHandler::downloadDir_
privateinherited

Definition at line 147 of file ShardArchiveHandler.h.

◆ timer_

boost::asio::basic_waitable_timer<std::chrono::steady_clock> ripple::RPC::ShardArchiveHandler::timer_
privateinherited

Definition at line 148 of file ShardArchiveHandler.h.

◆ jobCounter_

JobCounter ripple::RPC::ShardArchiveHandler::jobCounter_
privateinherited

Definition at line 149 of file ShardArchiveHandler.h.

◆ timerCounter_

TimerOpCounter ripple::RPC::ShardArchiveHandler::timerCounter_
privateinherited

Definition at line 150 of file ShardArchiveHandler.h.

◆ verificationScheduler_

ShardVerificationScheduler ripple::RPC::ShardArchiveHandler::verificationScheduler_
privateinherited

Definition at line 151 of file ShardArchiveHandler.h.