1#ifndef XRPL_PEERFINDER_BOOTCACHE_H_INCLUDED
2#define XRPL_PEERFINDER_BOOTCACHE_H_INCLUDED
4#include <xrpld/peerfinder/PeerfinderManager.h>
5#include <xrpld/peerfinder/detail/Store.h>
7#include <xrpl/basics/comparators.h>
8#include <xrpl/beast/utility/Journal.h>
9#include <xrpl/beast/utility/PropertyStream.h>
11#include <boost/bimap.hpp>
12#include <boost/bimap/multiset_of.hpp>
13#include <boost/bimap/unordered_set_of.hpp>
14#include <boost/iterator/transform_iterator.hpp>
68 using left_t = boost::bimaps::unordered_set_of<
70 boost::hash<beast::IP::Endpoint>,
72 using right_t = boost::bimaps::multiset_of<Entry, ripple::less<Entry>>;
73 using map_type = boost::bimap<left_t, right_t>;
79 map_type::right_map::const_iterator::value_type
const&;
86 map_type::right_map::const_iterator::value_type
const& v)
const
109 transform_iterator<Transform, map_type::right_map::const_iterator>;
A version-independent IP address and port combination.
A generic endpoint for log messages.
typename Clock::time_point time_point
friend bool operator<(Entry const &lhs, Entry const &rhs)
Stores IP addresses useful for gaining initial connections.
map_type::size_type size() const
Returns the number of entries in the cache.
clock_type::time_point m_whenUpdate
const_iterator cbegin() const
const_iterator end() const
static constexpr int staticValence
const_iterator cend() const
void periodicActivity()
Stores the cache in the persistent database on a timer.
boost::transform_iterator< Transform, map_type::right_map::const_iterator > iterator
map_type::value_type value_type
bool insert(beast::IP::Endpoint const &endpoint)
Add a newly-learned address to the cache.
boost::bimaps::unordered_set_of< beast::IP::Endpoint, boost::hash< beast::IP::Endpoint >, ripple::equal_to< beast::IP::Endpoint > > left_t
void on_failure(beast::IP::Endpoint const &endpoint)
Called when an outbound connection attempt fails to handshake.
const_iterator begin() const
IP::Endpoint iterators that traverse in decreasing valence.
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.
bool empty() const
Returns true if the cache is empty.
bool insertStatic(beast::IP::Endpoint const &endpoint)
Add a staticallyconfigured address to the cache.
boost::bimaps::multiset_of< Entry, ripple::less< Entry > > right_t
void load()
Load the persisted data from the Store into the container.
boost::bimap< left_t, right_t > map_type
Abstract persistence for PeerFinder data.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.