20 #ifndef RIPPLE_PEERFINDER_BOOTCACHE_H_INCLUDED
21 #define RIPPLE_PEERFINDER_BOOTCACHE_H_INCLUDED
23 #include <ripple/basics/comparators.h>
24 #include <ripple/beast/utility/Journal.h>
25 #include <ripple/beast/utility/PropertyStream.h>
26 #include <ripple/peerfinder/PeerfinderManager.h>
27 #include <ripple/peerfinder/impl/Store.h>
28 #include <boost/bimap.hpp>
29 #include <boost/bimap/multiset_of.hpp>
30 #include <boost/bimap/unordered_set_of.hpp>
31 #include <boost/iterator/transform_iterator.hpp>
34 namespace PeerFinder {
85 using left_t = boost::bimaps::unordered_set_of<
87 boost::hash<beast::IP::Endpoint>,
89 using right_t = boost::bimaps::multiset_of<Entry, ripple::less<Entry>>;
90 using map_type = boost::bimap<left_t, right_t>;
96 map_type::right_map::const_iterator::value_type
const&;
103 map_type::right_map::const_iterator::value_type
const& v)
const
126 transform_iterator<Transform, map_type::right_map::const_iterator>;
const_iterator cend() const
bool insertStatic(beast::IP::Endpoint const &endpoint)
Add a staticallyconfigured address to the cache.
boost::bimap< left_t, right_t > map_type
void on_failure(beast::IP::Endpoint const &endpoint)
Called when an outbound connection attempt fails to handshake.
boost::bimaps::multiset_of< Entry, ripple::less< Entry > > right_t
void periodicActivity()
Stores the cache in the persistent database on a timer.
Abstract persistence for PeerFinder data.
void load()
Load the persisted data from the Store into the container.
boost::transform_iterator< Transform, map_type::right_map::const_iterator > iterator
map_type::size_type size() const
Returns the number of entries in the cache.
Stores IP addresses useful for gaining initial connections.
bool insert(beast::IP::Endpoint const &endpoint)
Add a newly-learned address to the cache.
const_iterator end() const
Bootcache(Store &store, clock_type &clock, beast::Journal journal)
static constexpr int staticValence
friend bool operator<(Entry const &lhs, Entry const &rhs)
A generic endpoint for log messages.
void onWrite(beast::PropertyStream::Map &map)
Write the cache state to the property stream.
void on_success(beast::IP::Endpoint const &endpoint)
Called when an outbound connection handshake completes.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
map_type::value_type value_type
boost::bimaps::unordered_set_of< beast::IP::Endpoint, boost::hash< beast::IP::Endpoint >, ripple::equal_to< beast::IP::Endpoint > > left_t
const_iterator cbegin() const
bool empty() const
Returns true if the cache is empty.
const_iterator begin() const
IP::Endpoint iterators that traverse in decreasing valence.
A version-independent IP address and port combination.
clock_type::time_point m_whenUpdate
typename Clock::time_point time_point