|
rippled
|
#include <ValidatorSite.h>

Classes | |
| struct | Site |
Public Member Functions | |
| ValidatorSite (Application &app, std::optional< beast::Journal > j=std::nullopt, std::chrono::seconds timeout=std::chrono::seconds{20}) | |
| ~ValidatorSite () | |
| bool | load (std::vector< std::string > const &siteURIs) |
| Load configured site URIs. | |
| void | start () |
| Start fetching lists from sites. | |
| void | join () |
| Wait for current fetches from sites to complete. | |
| void | stop () |
| Stop fetching lists from sites. | |
| Json::Value | getJson () const |
| Return JSON representation of configured validator sites. | |
Private Types | |
| using | error_code = boost::system::error_code |
| using | clock_type = std::chrono::system_clock |
| using | endpoint_type = boost::asio::ip::tcp::endpoint |
Private Member Functions | |
| bool | load (std::vector< std::string > const &siteURIs, std::lock_guard< std::mutex > const &) |
| Load configured site URIs. | |
| void | setTimer (std::lock_guard< std::mutex > const &, std::lock_guard< std::mutex > const &) |
| Queue next site to be fetched lock over site_mutex_ and state_mutex_ required. | |
| void | onRequestTimeout (std::size_t siteIdx, error_code const &ec) |
| request took too long | |
| void | onTimer (std::size_t siteIdx, error_code const &ec) |
| Fetch site whose time has come. | |
| void | onSiteFetch (boost::system::error_code const &ec, endpoint_type const &endpoint, detail::response_type &&res, std::size_t siteIdx) |
| Store latest list fetched from site. | |
| void | onTextFetch (boost::system::error_code const &ec, std::string const &res, std::size_t siteIdx) |
| Store latest list fetched from anywhere. | |
| void | makeRequest (std::shared_ptr< Site::Resource > resource, std::size_t siteIdx, std::lock_guard< std::mutex > const &) |
| Initiate request to given resource. | |
| void | parseJsonResponse (std::string const &res, std::size_t siteIdx, std::lock_guard< std::mutex > const &) |
| Parse json response from validator list site. | |
| std::shared_ptr< Site::Resource > | processRedirect (detail::response_type &res, std::size_t siteIdx, std::lock_guard< std::mutex > const &) |
| Interpret a redirect response. | |
| bool | missingSite (std::lock_guard< std::mutex > const &) |
| If no sites are provided, or a site fails to load, get a list of local cache files from the ValidatorList. | |
Private Attributes | |
| Application & | app_ |
| beast::Journal const | j_ |
| std::mutex | sites_mutex_ |
| std::mutex | state_mutex_ |
| std::condition_variable | cv_ |
| std::weak_ptr< detail::Work > | work_ |
| boost::asio::basic_waitable_timer< clock_type > | timer_ |
| std::atomic< bool > | fetching_ |
| std::atomic< bool > | pending_ |
| std::atomic< bool > | stopping_ |
| std::vector< Site > | sites_ |
| std::chrono::seconds const | requestTimeout_ |
Friends | |
| class | Work |
This class manages the set of configured remote sites used to fetch the latest published recommended validator lists.
Lists are fetched at a regular interval. Fetched lists are expected to be in JSON format and contain the following fields:
"blob": Base64-encoded JSON string containing a "sequence", "validUntil", and "validators" field. "validUntil" contains the Ripple timestamp (seconds since January 1st, 2000 (00:00 UTC)) for when the list expires. "validators" contains an array of objects with a "validation_public_key" and optional "manifest" field. "validation_public_key" should be the hex-encoded master public key. "manifest" should be the base64-encoded validator manifest."manifest": Base64-encoded serialization of a manifest containing the publisher's master and signing public keys."signature": Hex-encoded signature of the blob using the publisher's signing key."version": 1"refreshInterval" (optional, integer minutes). This value is clamped internally to [1,1440] (1 min - 1 day) Definition at line 49 of file ValidatorSite.h.
|
private |
Definition at line 54 of file ValidatorSite.h.
|
private |
Definition at line 55 of file ValidatorSite.h.
|
private |
Definition at line 56 of file ValidatorSite.h.
| ripple::ValidatorSite::ValidatorSite | ( | Application & | app, |
| std::optional< beast::Journal > | j = std::nullopt, |
||
| std::chrono::seconds | timeout = std::chrono::seconds{20} |
||
| ) |
Definition at line 69 of file ValidatorSite.cpp.
| ripple::ValidatorSite::~ValidatorSite | ( | ) |
Definition at line 83 of file ValidatorSite.cpp.
| bool ripple::ValidatorSite::load | ( | std::vector< std::string > const & | siteURIs | ) |
Load configured site URIs.
| siteURIs | List of URIs to fetch published validator lists |
May be called concurrently
false if an entry is invalid or unparsable Definition at line 108 of file ValidatorSite.cpp.
| void ripple::ValidatorSite::start | ( | ) |
Start fetching lists from sites.
This does nothing if list fetching has already started
May be called concurrently
Definition at line 148 of file ValidatorSite.cpp.
| void ripple::ValidatorSite::join | ( | ) |
Wait for current fetches from sites to complete.
May be called concurrently
Definition at line 157 of file ValidatorSite.cpp.
| void ripple::ValidatorSite::stop | ( | ) |
Stop fetching lists from sites.
This blocks until list fetching has stopped
May be called concurrently
Definition at line 164 of file ValidatorSite.cpp.
| Json::Value ripple::ValidatorSite::getJson | ( | ) | const |
Return JSON representation of configured validator sites.
Definition at line 653 of file ValidatorSite.cpp.
|
private |
Load configured site URIs.
Definition at line 118 of file ValidatorSite.cpp.
|
private |
Queue next site to be fetched lock over site_mutex_ and state_mutex_ required.
Definition at line 190 of file ValidatorSite.cpp.
|
private |
request took too long
Definition at line 293 of file ValidatorSite.cpp.
|
private |
Fetch site whose time has come.
Definition at line 321 of file ValidatorSite.cpp.
|
private |
Store latest list fetched from site.
Definition at line 523 of file ValidatorSite.cpp.
|
private |
Store latest list fetched from anywhere.
Definition at line 614 of file ValidatorSite.cpp.
|
private |
Initiate request to given resource.
lock over sites_mutex_ required
Definition at line 212 of file ValidatorSite.cpp.
|
private |
Parse json response from validator list site.
lock over sites_mutex_ required
Definition at line 353 of file ValidatorSite.cpp.
|
private |
Interpret a redirect response.
lock over sites_mutex_ required
Definition at line 477 of file ValidatorSite.cpp.
|
private |
If no sites are provided, or a site fails to load, get a list of local cache files from the ValidatorList.
Definition at line 101 of file ValidatorSite.cpp.
|
friend |
Definition at line 51 of file ValidatorSite.h.
|
private |
Definition at line 97 of file ValidatorSite.h.
|
private |
Definition at line 98 of file ValidatorSite.h.
|
mutableprivate |
Definition at line 102 of file ValidatorSite.h.
|
mutableprivate |
Definition at line 103 of file ValidatorSite.h.
|
private |
Definition at line 105 of file ValidatorSite.h.
|
private |
Definition at line 106 of file ValidatorSite.h.
|
private |
Definition at line 107 of file ValidatorSite.h.
|
private |
Definition at line 110 of file ValidatorSite.h.
|
private |
Definition at line 113 of file ValidatorSite.h.
|
private |
Definition at line 114 of file ValidatorSite.h.
|
private |
Definition at line 117 of file ValidatorSite.h.
|
private |
Definition at line 120 of file ValidatorSite.h.