|
xrpld
|
Stores IP addresses useful for gaining initial connections. More...
#include <Bootcache.h>

Classes | |
| class | Entry |
| struct | Transform |
Public Types | |
| using | iterator = boost::transform_iterator<Transform, map_type::right_map::const_iterator> |
| using | const_iterator = iterator |
Public Member Functions | |
| Bootcache (Store &store, clock_type &clock, beast::Journal journal) | |
| ~Bootcache () | |
| bool | empty () const |
| Returns true if the cache is empty. | |
| map_type::size_type | size () const |
| Returns the number of entries in the cache. | |
| void | load () |
| Load the persisted data from the Store into the container. | |
| bool | insert (beast::ip::Endpoint const &endpoint) |
| Add a newly-learned address to the cache. | |
| bool | insertStatic (beast::ip::Endpoint const &endpoint) |
| Add a staticallyconfigured address to the cache. | |
| void | onSuccess (beast::ip::Endpoint const &endpoint) |
| Called when an outbound connection handshake completes. | |
| void | onFailure (beast::ip::Endpoint const &endpoint) |
| Called when an outbound connection attempt fails to handshake. | |
| void | periodicActivity () |
| Stores the cache in the persistent database on a timer. | |
| void | onWrite (beast::PropertyStream::Map &map) |
| Write the cache state to the property stream. | |
| const_iterator | begin () const |
| ip::Endpoint iterators that traverse in decreasing valence. | |
| const_iterator | cbegin () const |
| const_iterator | end () const |
| const_iterator | cend () const |
| void | clear () |
Static Public Attributes | |
| static constexpr int | kStaticValence = 32 |
Private Types | |
| using | left_t |
| using | right_t = boost::bimaps::multiset_of<Entry, std::less<>> |
| using | map_type = boost::bimap<left_t, right_t> |
| using | value_type = map_type::value_type |
Private Member Functions | |
| void | prune () |
| void | update () |
| void | checkUpdate () |
| void | flagForUpdate () |
Private Attributes | |
| map_type | map_ |
| Store & | store_ |
| clock_type & | clock_ |
| beast::Journal | journal_ |
| clock_type::time_point | whenUpdate_ |
| bool | needsUpdate_ {false} |
Stores IP addresses useful for gaining initial connections.
This is one of the caches that is consulted when additional outgoing connections are needed. Along with the address, each entry has this additional metadata:
Valence A signed integer which represents the number of successful consecutive connection attempts when positive, and the number of failed consecutive connection attempts when negative.
When choosing addresses from the boot cache for the purpose of establishing outgoing connections, addresses are ranked in decreasing order of high uptime, with valence as the tie breaker.
Definition at line 35 of file Bootcache.h.
|
private |
Definition at line 67 of file Bootcache.h.
|
private |
Definition at line 69 of file Bootcache.h.
|
private |
Definition at line 70 of file Bootcache.h.
|
private |
Definition at line 71 of file Bootcache.h.
| using xrpl::peer_finder::Bootcache::iterator = boost::transform_iterator<Transform, map_type::right_map::const_iterator> |
Definition at line 103 of file Bootcache.h.
Definition at line 105 of file Bootcache.h.
| xrpl::peer_finder::Bootcache::Bootcache | ( | Store & | store, |
| clock_type & | clock, | ||
| beast::Journal | journal ) |
Definition at line 21 of file Bootcache.cpp.
| xrpl::peer_finder::Bootcache::~Bootcache | ( | ) |
Definition at line 27 of file Bootcache.cpp.
|
nodiscard |
Returns true if the cache is empty.
Definition at line 33 of file Bootcache.cpp.
|
nodiscard |
Returns the number of entries in the cache.
Definition at line 39 of file Bootcache.cpp.
|
nodiscard |
ip::Endpoint iterators that traverse in decreasing valence.
Definition at line 45 of file Bootcache.cpp.
|
nodiscard |
Definition at line 51 of file Bootcache.cpp.
|
nodiscard |
Definition at line 57 of file Bootcache.cpp.
|
nodiscard |
Definition at line 63 of file Bootcache.cpp.
| void xrpl::peer_finder::Bootcache::clear | ( | ) |
Definition at line 69 of file Bootcache.cpp.
| void xrpl::peer_finder::Bootcache::load | ( | ) |
Load the persisted data from the Store into the container.
Definition at line 78 of file Bootcache.cpp.
| bool xrpl::peer_finder::Bootcache::insert | ( | beast::ip::Endpoint const & | endpoint | ) |
Add a newly-learned address to the cache.
Definition at line 99 of file Bootcache.cpp.
| bool xrpl::peer_finder::Bootcache::insertStatic | ( | beast::ip::Endpoint const & | endpoint | ) |
Add a staticallyconfigured address to the cache.
Definition at line 112 of file Bootcache.cpp.
| void xrpl::peer_finder::Bootcache::onSuccess | ( | beast::ip::Endpoint const & | endpoint | ) |
Called when an outbound connection handshake completes.
Definition at line 133 of file Bootcache.cpp.
| void xrpl::peer_finder::Bootcache::onFailure | ( | beast::ip::Endpoint const & | endpoint | ) |
Called when an outbound connection attempt fails to handshake.
Definition at line 157 of file Bootcache.cpp.
| void xrpl::peer_finder::Bootcache::periodicActivity | ( | ) |
Stores the cache in the persistent database on a timer.
Definition at line 181 of file Bootcache.cpp.
| void xrpl::peer_finder::Bootcache::onWrite | ( | beast::PropertyStream::Map & | map | ) |
Write the cache state to the property stream.
Definition at line 189 of file Bootcache.cpp.
|
private |
Definition at line 202 of file Bootcache.cpp.
|
private |
Definition at line 231 of file Bootcache.cpp.
|
private |
Definition at line 252 of file Bootcache.cpp.
|
private |
Definition at line 260 of file Bootcache.cpp.
|
private |
Definition at line 88 of file Bootcache.h.
|
private |
Definition at line 90 of file Bootcache.h.
|
private |
Definition at line 91 of file Bootcache.h.
|
private |
Definition at line 92 of file Bootcache.h.
|
private |
Definition at line 95 of file Bootcache.h.
|
private |
Definition at line 98 of file Bootcache.h.
|
staticconstexpr |
Definition at line 101 of file Bootcache.h.