|
xrpld
|
The Logic for maintaining the list of Slot addresses. More...
#include <Logic.h>

Public Types | |
| using | Slots = std::map<beast::ip::Endpoint, std::shared_ptr<SlotImp>> |
Public Member Functions | |
| Logic (clock_type &clock, Store &store, Checker &checker, beast::Journal journal) | |
| void | load () |
| void | stop () |
| Stop the logic. | |
| void | config (Config const &c) |
| Config | config () |
| void | addFixedPeer (std::string_view name, beast::ip::Endpoint const &ep) |
| void | addFixedPeer (std::string_view name, std::vector< beast::ip::Endpoint > const &addresses) |
| void | checkComplete (beast::ip::Endpoint const &remoteAddress, beast::ip::Endpoint const &checkedAddress, boost::system::error_code ec) |
| std::pair< SlotImp::ptr, Result > | newInboundSlot (beast::ip::Endpoint const &localEndpoint, beast::ip::Endpoint const &remoteEndpoint) |
| std::pair< SlotImp::ptr, Result > | newOutboundSlot (beast::ip::Endpoint const &remoteEndpoint) |
| bool | onConnected (SlotImp::ptr const &slot, beast::ip::Endpoint const &localEndpoint) |
| Result | activate (SlotImp::ptr const &slot, PublicKey const &key, bool reserved) |
| std::vector< Endpoint > | redirect (SlotImp::ptr const &slot) |
| Return a list of addresses suitable for redirection. | |
| std::vector< beast::ip::Endpoint > | autoconnect () |
| Create new outbound connection attempts as needed. | |
| std::vector< std::pair< std::shared_ptr< Slot >, std::vector< Endpoint > > > | buildEndpointsForPeers () |
| void | oncePerSecond () |
| void | preprocess (SlotImp::ptr const &slot, Endpoints &list) |
| void | onEndpoints (SlotImp::ptr const &slot, Endpoints list) |
| void | remove (SlotImp::ptr const &slot) |
| void | onClosed (SlotImp::ptr const &slot) |
| void | onFailure (SlotImp::ptr const &slot) |
| template<class FwdIter> | |
| void | onRedirects (FwdIter first, FwdIter last, boost::asio::ip::tcp::endpoint const &remoteAddress) |
| bool | fixed (beast::ip::Endpoint const &endpoint) const |
| bool | fixed (beast::ip::Address const &address) const |
| template<class Container> | |
| void | getFixed (std::size_t needed, Container &c, ConnectHandouts::Squelches &squelches) |
| Adds eligible Fixed addresses for outbound attempts. | |
| void | addStaticSource (std::shared_ptr< Source > const &source) |
| void | addSource (std::shared_ptr< Source > const &source) |
| int | addBootcacheAddresses (IPAddresses const &list) |
| void | fetch (std::shared_ptr< Source > const &source) |
| bool | isValidAddress (beast::ip::Endpoint const &address) |
| void | writeSlots (beast::PropertyStream::Set &set, Slots const &slots) |
| void | onWrite (beast::PropertyStream::Map &map) |
| Counts const & | counts () const |
Static Public Member Functions | |
| static std::string | stateString (Slot::State state) |
Private Attributes | |
| Config | config_ |
| Counts | counts_ |
| std::map< beast::ip::Endpoint, Fixed > | fixed_ |
The Logic for maintaining the list of Slot addresses.
We keep this in a separate class so it can be instantiated for unit tests.
Definition at line 54 of file peerfinder/detail/Logic.h.
| using xrpl::peer_finder::Logic< Checker >::Slots = std::map<beast::ip::Endpoint, std::shared_ptr<SlotImp>> |
Definition at line 60 of file peerfinder/detail/Logic.h.
| xrpl::peer_finder::Logic< Checker >::Logic | ( | clock_type & | clock, |
| Store & | store, | ||
| Checker & | checker, | ||
| beast::Journal | journal ) |
Definition at line 113 of file peerfinder/detail/Logic.h.
| void xrpl::peer_finder::Logic< Checker >::load | ( | ) |
Definition at line 129 of file peerfinder/detail/Logic.h.
| void xrpl::peer_finder::Logic< Checker >::stop | ( | ) |
Stop the logic.
This will cancel the current fetch and set the stopping flag to true to prevent further fetches. Thread safety: Safe to call from any thread.
Definition at line 143 of file peerfinder/detail/Logic.h.
| void xrpl::peer_finder::Logic< Checker >::config | ( | Config const & | c | ) |
Definition at line 158 of file peerfinder/detail/Logic.h.
| Config xrpl::peer_finder::Logic< Checker >::config | ( | ) |
Definition at line 166 of file peerfinder/detail/Logic.h.
| void xrpl::peer_finder::Logic< Checker >::addFixedPeer | ( | std::string_view | name, |
| beast::ip::Endpoint const & | ep ) |
Definition at line 173 of file peerfinder/detail/Logic.h.
| void xrpl::peer_finder::Logic< Checker >::addFixedPeer | ( | std::string_view | name, |
| std::vector< beast::ip::Endpoint > const & | addresses ) |
Definition at line 179 of file peerfinder/detail/Logic.h.
| void xrpl::peer_finder::Logic< Checker >::checkComplete | ( | beast::ip::Endpoint const & | remoteAddress, |
| beast::ip::Endpoint const & | checkedAddress, | ||
| boost::system::error_code | ec ) |
Definition at line 215 of file peerfinder/detail/Logic.h.
| std::pair< SlotImp::ptr, Result > xrpl::peer_finder::Logic< Checker >::newInboundSlot | ( | beast::ip::Endpoint const & | localEndpoint, |
| beast::ip::Endpoint const & | remoteEndpoint ) |
Definition at line 258 of file peerfinder/detail/Logic.h.
| std::pair< SlotImp::ptr, Result > xrpl::peer_finder::Logic< Checker >::newOutboundSlot | ( | beast::ip::Endpoint const & | remoteEndpoint | ) |
Definition at line 309 of file peerfinder/detail/Logic.h.
| bool xrpl::peer_finder::Logic< Checker >::onConnected | ( | SlotImp::ptr const & | slot, |
| beast::ip::Endpoint const & | localEndpoint ) |
Definition at line 345 of file peerfinder/detail/Logic.h.
| Result xrpl::peer_finder::Logic< Checker >::activate | ( | SlotImp::ptr const & | slot, |
| PublicKey const & | key, | ||
| bool | reserved ) |
Definition at line 383 of file peerfinder/detail/Logic.h.
| std::vector< Endpoint > xrpl::peer_finder::Logic< Checker >::redirect | ( | SlotImp::ptr const & | slot | ) |
Return a list of addresses suitable for redirection.
This is a legacy function, redirects should be returned in the HTTP handshake and not via TMEndpoints.
Definition at line 463 of file peerfinder/detail/Logic.h.
| std::vector< beast::ip::Endpoint > xrpl::peer_finder::Logic< Checker >::autoconnect | ( | ) |
Create new outbound connection attempts as needed.
This implements PeerFinder's "Outbound Connection Strategy"
Definition at line 480 of file peerfinder/detail/Logic.h.
| std::vector< std::pair< std::shared_ptr< Slot >, std::vector< Endpoint > > > xrpl::peer_finder::Logic< Checker >::buildEndpointsForPeers | ( | ) |
Definition at line 586 of file peerfinder/detail/Logic.h.
| void xrpl::peer_finder::Logic< Checker >::oncePerSecond | ( | ) |
Definition at line 666 of file peerfinder/detail/Logic.h.
| void xrpl::peer_finder::Logic< Checker >::preprocess | ( | SlotImp::ptr const & | slot, |
| Endpoints & | list ) |
Definition at line 687 of file peerfinder/detail/Logic.h.
| void xrpl::peer_finder::Logic< Checker >::onEndpoints | ( | SlotImp::ptr const & | slot, |
| Endpoints | list ) |
Definition at line 751 of file peerfinder/detail/Logic.h.
| void xrpl::peer_finder::Logic< Checker >::remove | ( | SlotImp::ptr const & | slot | ) |
Definition at line 846 of file peerfinder/detail/Logic.h.
| void xrpl::peer_finder::Logic< Checker >::onClosed | ( | SlotImp::ptr const & | slot | ) |
Definition at line 894 of file peerfinder/detail/Logic.h.
| void xrpl::peer_finder::Logic< Checker >::onFailure | ( | SlotImp::ptr const & | slot | ) |
Definition at line 954 of file peerfinder/detail/Logic.h.
| void xrpl::peer_finder::Logic< Checker >::onRedirects | ( | FwdIter | first, |
| FwdIter | last, | ||
| boost::asio::ip::tcp::endpoint const & | remoteAddress ) |
Definition at line 1216 of file peerfinder/detail/Logic.h.
| bool xrpl::peer_finder::Logic< Checker >::fixed | ( | beast::ip::Endpoint const & | endpoint | ) | const |
Definition at line 971 of file peerfinder/detail/Logic.h.
| bool xrpl::peer_finder::Logic< Checker >::fixed | ( | beast::ip::Address const & | address | ) | const |
Definition at line 981 of file peerfinder/detail/Logic.h.
| void xrpl::peer_finder::Logic< Checker >::getFixed | ( | std::size_t | needed, |
| Container & | c, | ||
| ConnectHandouts::Squelches & | squelches ) |
Adds eligible Fixed addresses for outbound attempts.
Definition at line 998 of file peerfinder/detail/Logic.h.
| void xrpl::peer_finder::Logic< Checker >::addStaticSource | ( | std::shared_ptr< Source > const & | source | ) |
Definition at line 1019 of file peerfinder/detail/Logic.h.
| void xrpl::peer_finder::Logic< Checker >::addSource | ( | std::shared_ptr< Source > const & | source | ) |
Definition at line 1025 of file peerfinder/detail/Logic.h.
| int xrpl::peer_finder::Logic< Checker >::addBootcacheAddresses | ( | IPAddresses const & | list | ) |
Definition at line 1040 of file peerfinder/detail/Logic.h.
| void xrpl::peer_finder::Logic< Checker >::fetch | ( | std::shared_ptr< Source > const & | source | ) |
Definition at line 1054 of file peerfinder/detail/Logic.h.
| bool xrpl::peer_finder::Logic< Checker >::isValidAddress | ( | beast::ip::Endpoint const & | address | ) |
Definition at line 1102 of file peerfinder/detail/Logic.h.
| void xrpl::peer_finder::Logic< Checker >::writeSlots | ( | beast::PropertyStream::Set & | set, |
| Slots const & | slots ) |
Definition at line 1120 of file peerfinder/detail/Logic.h.
| void xrpl::peer_finder::Logic< Checker >::onWrite | ( | beast::PropertyStream::Map & | map | ) |
Definition at line 1141 of file peerfinder/detail/Logic.h.
| Counts const & xrpl::peer_finder::Logic< Checker >::counts | ( | ) | const |
Definition at line 1184 of file peerfinder/detail/Logic.h.
|
static |
Definition at line 1190 of file peerfinder/detail/Logic.h.
| beast::Journal xrpl::peer_finder::Logic< Checker >::journal |
Definition at line 62 of file peerfinder/detail/Logic.h.
| clock_type& xrpl::peer_finder::Logic< Checker >::clock |
Definition at line 63 of file peerfinder/detail/Logic.h.
| Store& xrpl::peer_finder::Logic< Checker >::store |
Definition at line 64 of file peerfinder/detail/Logic.h.
| Checker& xrpl::peer_finder::Logic< Checker >::checker |
Definition at line 65 of file peerfinder/detail/Logic.h.
| std::recursive_mutex xrpl::peer_finder::Logic< Checker >::lock |
Definition at line 67 of file peerfinder/detail/Logic.h.
| bool xrpl::peer_finder::Logic< Checker >::stopping = false |
Definition at line 70 of file peerfinder/detail/Logic.h.
| std::shared_ptr<Source> xrpl::peer_finder::Logic< Checker >::fetchSource |
Definition at line 74 of file peerfinder/detail/Logic.h.
|
private |
Definition at line 78 of file peerfinder/detail/Logic.h.
|
private |
Definition at line 81 of file peerfinder/detail/Logic.h.
|
private |
Definition at line 84 of file peerfinder/detail/Logic.h.
| Livecache xrpl::peer_finder::Logic< Checker >::livecache |
Definition at line 88 of file peerfinder/detail/Logic.h.
| Bootcache xrpl::peer_finder::Logic< Checker >::bootcache |
Definition at line 91 of file peerfinder/detail/Logic.h.
| Slots xrpl::peer_finder::Logic< Checker >::slots |
Definition at line 94 of file peerfinder/detail/Logic.h.
| std::multiset<beast::ip::Address> xrpl::peer_finder::Logic< Checker >::connectedAddresses |
Definition at line 99 of file peerfinder/detail/Logic.h.
| std::set<PublicKey> xrpl::peer_finder::Logic< Checker >::keys |
Definition at line 102 of file peerfinder/detail/Logic.h.
| std::vector<std::shared_ptr<Source> > xrpl::peer_finder::Logic< Checker >::sources |
Definition at line 105 of file peerfinder/detail/Logic.h.
| clock_type::time_point xrpl::peer_finder::Logic< Checker >::whenBroadcast |
Definition at line 107 of file peerfinder/detail/Logic.h.
| ConnectHandouts::Squelches xrpl::peer_finder::Logic< Checker >::squelches |
Definition at line 109 of file peerfinder/detail/Logic.h.