rippled
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | 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

 DatabaseDownloader (boost::asio::io_service &io_service, beast::Journal j, Config const &config)
 
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)
 
void onStop ()
 

Protected Types

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

Protected Member Functions

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

Protected Attributes

const beast::Journal j_
 

Private Member Functions

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, boost::asio::yield_context yield)
 

Private Attributes

Config const & config_
 
boost::asio::io_service & io_service_
 
HTTPClientSSLContext ssl_ctx_
 
boost::asio::io_service::strand strand_
 
boost::optional< boost::asio::ssl::stream< boost::asio::ip::tcp::socket > > stream_
 
boost::beast::flat_buffer read_buf_
 
std::atomic< bool > cancelDownloads_
 
std::mutex m_
 
bool sessionActive_
 
std::condition_variable c_
 

Static Private Attributes

static const std::uint8_t MAX_PATH_LEN
 

Detailed Description

Definition at line 28 of file DatabaseDownloader.h.

Member Typedef Documentation

◆ error_code

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

Definition at line 47 of file SSLHTTPDownloader.h.

◆ parser

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

Definition at line 69 of file SSLHTTPDownloader.h.

Constructor & Destructor Documentation

◆ DatabaseDownloader()

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

Definition at line 24 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::SSLHTTPDownloader.

Definition at line 35 of file DatabaseDownloader.cpp.

◆ checkPath()

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

Implements ripple::SSLHTTPDownloader.

Definition at line 55 of file DatabaseDownloader.cpp.

◆ closeBody()

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

Implements ripple::SSLHTTPDownloader.

Definition at line 61 of file DatabaseDownloader.cpp.

◆ size()

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

Implements ripple::SSLHTTPDownloader.

Definition at line 73 of file DatabaseDownloader.cpp.

◆ download()

bool ripple::SSLHTTPDownloader::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 
)
inherited

Definition at line 38 of file SSLHTTPDownloader.cpp.

◆ onStop()

void ripple::SSLHTTPDownloader::onStop ( )
inherited

Definition at line 85 of file SSLHTTPDownloader.cpp.

◆ fail()

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

Definition at line 315 of file SSLHTTPDownloader.cpp.

◆ do_session()

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

Definition at line 99 of file SSLHTTPDownloader.cpp.

Member Data Documentation

◆ MAX_PATH_LEN

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

Definition at line 37 of file DatabaseDownloader.h.

◆ config_

Config const& ripple::DatabaseDownloader::config_
private

Definition at line 55 of file DatabaseDownloader.h.

◆ io_service_

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

Definition at line 56 of file DatabaseDownloader.h.

◆ j_

const beast::Journal ripple::SSLHTTPDownloader::j_
protectedinherited

Definition at line 71 of file SSLHTTPDownloader.h.

◆ ssl_ctx_

HTTPClientSSLContext ripple::SSLHTTPDownloader::ssl_ctx_
privateinherited

Definition at line 82 of file SSLHTTPDownloader.h.

◆ strand_

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

Definition at line 83 of file SSLHTTPDownloader.h.

◆ stream_

boost::optional<boost::asio::ssl::stream<boost::asio::ip::tcp::socket> > ripple::SSLHTTPDownloader::stream_
privateinherited

Definition at line 85 of file SSLHTTPDownloader.h.

◆ read_buf_

boost::beast::flat_buffer ripple::SSLHTTPDownloader::read_buf_
privateinherited

Definition at line 86 of file SSLHTTPDownloader.h.

◆ cancelDownloads_

std::atomic<bool> ripple::SSLHTTPDownloader::cancelDownloads_
privateinherited

Definition at line 87 of file SSLHTTPDownloader.h.

◆ m_

std::mutex ripple::SSLHTTPDownloader::m_
privateinherited

Definition at line 90 of file SSLHTTPDownloader.h.

◆ sessionActive_

bool ripple::SSLHTTPDownloader::sessionActive_
privateinherited

Definition at line 91 of file SSLHTTPDownloader.h.

◆ c_

std::condition_variable ripple::SSLHTTPDownloader::c_
privateinherited

Definition at line 92 of file SSLHTTPDownloader.h.

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