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

Public Types

using error_code = boost::system::error_code
 

Public Member Functions

virtual ~DatabaseDownloader ()=default
 
bool download (std::string const &host, std::string const &port, std::string const &target, int version, boost::filesystem::path const &dstPath, std::function< void(boost::filesystem::path)> complete, bool ssl=true)
 
void stop ()
 
bool sessionIsActive () const
 
bool isStopping () const
 
shared_from_this (T... args)
 
weak_from_this (T... args)
 

Protected Types

using parser = boost::beast::http::basic_parser< false >
 

Protected Member Functions

void fail (boost::filesystem::path dstPath, boost::system::error_code const &ec, std::string const &errMsg, std::shared_ptr< parser > parser)
 

Protected Attributes

const beast::Journal j_
 

Private Member Functions

 DatabaseDownloader (boost::asio::io_service &io_service, Config const &config, beast::Journal j)
 
std::shared_ptr< parsergetParser (boost::filesystem::path dstPath, std::function< void(boost::filesystem::path)> complete, boost::system::error_code &ec) override
 
bool checkPath (boost::filesystem::path const &dstPath) override
 
void closeBody (std::shared_ptr< parser > p) override
 
std::uint64_t size (std::shared_ptr< parser > p) override
 
void do_session (std::string host, std::string port, std::string target, int version, boost::filesystem::path dstPath, std::function< void(boost::filesystem::path)> complete, bool ssl, boost::asio::yield_context yield)
 

Private Attributes

Config const & config_
 
boost::asio::io_service & io_service_
 
boost::asio::io_service::strand strand_
 
std::unique_ptr< HTTPStreamstream_
 
boost::beast::flat_buffer read_buf_
 
std::atomic< bool > stop_
 
std::mutex m_
 
bool sessionActive_
 
std::condition_variable c_
 

Static Private Attributes

static const std::uint8_t MAX_PATH_LEN
 

Friends

std::shared_ptr< DatabaseDownloadermake_DatabaseDownloader (boost::asio::io_service &io_service, Config const &config, beast::Journal j)
 

Detailed Description

Definition at line 28 of file DatabaseDownloader.h.

Member Typedef Documentation

◆ error_code

using ripple::HTTPDownloader::error_code = boost::system::error_code
inherited

Definition at line 47 of file HTTPDownloader.h.

◆ parser

using ripple::HTTPDownloader::parser = boost::beast::http::basic_parser<false>
protectedinherited

Definition at line 78 of file HTTPDownloader.h.

Constructor & Destructor Documentation

◆ ~DatabaseDownloader()

virtual ripple::DatabaseDownloader::~DatabaseDownloader ( )
virtualdefault

◆ DatabaseDownloader()

ripple::DatabaseDownloader::DatabaseDownloader ( boost::asio::io_service &  io_service,
Config const &  config,
beast::Journal  j 
)
private

Definition at line 34 of file DatabaseDownloader.cpp.

Member Function Documentation

◆ getParser()

auto ripple::DatabaseDownloader::getParser ( boost::filesystem::path  dstPath,
std::function< void(boost::filesystem::path)>  complete,
boost::system::error_code &  ec 
)
overrideprivatevirtual

Implements ripple::HTTPDownloader.

Definition at line 45 of file DatabaseDownloader.cpp.

◆ checkPath()

bool ripple::DatabaseDownloader::checkPath ( boost::filesystem::path const &  dstPath)
overrideprivatevirtual

Implements ripple::HTTPDownloader.

Definition at line 63 of file DatabaseDownloader.cpp.

◆ closeBody()

void ripple::DatabaseDownloader::closeBody ( std::shared_ptr< parser p)
overrideprivatevirtual

Implements ripple::HTTPDownloader.

Definition at line 69 of file DatabaseDownloader.cpp.

◆ size()

std::uint64_t ripple::DatabaseDownloader::size ( std::shared_ptr< parser p)
overrideprivatevirtual

Implements ripple::HTTPDownloader.

Definition at line 81 of file DatabaseDownloader.cpp.

◆ download()

bool ripple::HTTPDownloader::download ( std::string const &  host,
std::string const &  port,
std::string const &  target,
int  version,
boost::filesystem::path const &  dstPath,
std::function< void(boost::filesystem::path)>  complete,
bool  ssl = true 
)
inherited

Definition at line 38 of file HTTPDownloader.cpp.

◆ stop()

void ripple::HTTPDownloader::stop ( )
inherited

Definition at line 284 of file HTTPDownloader.cpp.

◆ sessionIsActive()

bool ripple::HTTPDownloader::sessionIsActive ( ) const
inherited

Definition at line 297 of file HTTPDownloader.cpp.

◆ isStopping()

bool ripple::HTTPDownloader::isStopping ( ) const
inherited

Definition at line 304 of file HTTPDownloader.cpp.

◆ fail()

void ripple::HTTPDownloader::fail ( boost::filesystem::path  dstPath,
boost::system::error_code const &  ec,
std::string const &  errMsg,
std::shared_ptr< parser parser 
)
protectedinherited

Definition at line 311 of file HTTPDownloader.cpp.

◆ do_session()

void ripple::HTTPDownloader::do_session ( std::string  host,
std::string  port,
std::string  target,
int  version,
boost::filesystem::path  dstPath,
std::function< void(boost::filesystem::path)>  complete,
bool  ssl,
boost::asio::yield_context  yield 
)
privateinherited

Definition at line 87 of file HTTPDownloader.cpp.

Friends And Related Function Documentation

◆ make_DatabaseDownloader

std::shared_ptr<DatabaseDownloader> make_DatabaseDownloader ( boost::asio::io_service &  io_service,
Config const &  config,
beast::Journal  j 
)
friend

Definition at line 25 of file DatabaseDownloader.cpp.

Member Data Documentation

◆ MAX_PATH_LEN

const std::uint8_t ripple::DatabaseDownloader::MAX_PATH_LEN
staticprivate
Initial value:

Definition at line 39 of file DatabaseDownloader.h.

◆ config_

Config const& ripple::DatabaseDownloader::config_
private

Definition at line 57 of file DatabaseDownloader.h.

◆ io_service_

boost::asio::io_service& ripple::DatabaseDownloader::io_service_
private

Definition at line 58 of file DatabaseDownloader.h.

◆ j_

const beast::Journal ripple::HTTPDownloader::j_
protectedinherited

Definition at line 80 of file HTTPDownloader.h.

◆ strand_

boost::asio::io_service::strand ripple::HTTPDownloader::strand_
privateinherited

Definition at line 91 of file HTTPDownloader.h.

◆ stream_

std::unique_ptr<HTTPStream> ripple::HTTPDownloader::stream_
privateinherited

Definition at line 92 of file HTTPDownloader.h.

◆ read_buf_

boost::beast::flat_buffer ripple::HTTPDownloader::read_buf_
privateinherited

Definition at line 93 of file HTTPDownloader.h.

◆ stop_

std::atomic<bool> ripple::HTTPDownloader::stop_
privateinherited

Definition at line 94 of file HTTPDownloader.h.

◆ m_

std::mutex ripple::HTTPDownloader::m_
mutableprivateinherited

Definition at line 97 of file HTTPDownloader.h.

◆ sessionActive_

bool ripple::HTTPDownloader::sessionActive_
privateinherited

Definition at line 98 of file HTTPDownloader.h.

◆ c_

std::condition_variable ripple::HTTPDownloader::c_
privateinherited

Definition at line 99 of file HTTPDownloader.h.

std::numeric_limits::max
T max(T... args)