diff --git a/Bootcache_8cpp_source.html b/Bootcache_8cpp_source.html index 3d334bc2c4..6ee23a8dec 100644 --- a/Bootcache_8cpp_source.html +++ b/Bootcache_8cpp_source.html @@ -360,7 +360,7 @@ $(function() {
ripple::PeerFinder::Bootcache::cend
const_iterator cend() const
Definition: Bootcache.cpp:73
beast::PropertyStream::Map
Definition: PropertyStream.h:224
std::vector::reserve
T reserve(T... args)
-
ripple::PeerFinder::Bootcache::m_store
Store & m_store
Definition: Bootcache.h:119
+
ripple::PeerFinder::Bootcache::m_store
Store & m_store
Definition: Bootcache.h:112
std::vector
STL class.
ripple::PeerFinder::Bootcache::clear
void clear()
Definition: Bootcache.cpp:79
ripple::PeerFinder::Store
Abstract persistence for PeerFinder data.
Definition: Store.h:27
@@ -368,11 +368,11 @@ $(function() {
ripple::PeerFinder::Bootcache::load
void load()
Load the persisted data from the Store into the container.
Definition: Bootcache.cpp:88
std::vector::push_back
T push_back(T... args)
ripple::PeerFinder::Bootcache::size
map_type::size_type size() const
Returns the number of entries in the cache.
Definition: Bootcache.cpp:49
-
ripple::PeerFinder::Bootcache::const_iterator
iterator const_iterator
Definition: Bootcache.h:135
+
ripple::PeerFinder::Bootcache::const_iterator
iterator const_iterator
Definition: Bootcache.h:128
ripple::PeerFinder::Bootcache::~Bootcache
~Bootcache()
Definition: Bootcache.cpp:37
ripple::PeerFinder::Bootcache::end
const_iterator end() const
Definition: Bootcache.cpp:67
ripple::PeerFinder::Bootcache::Bootcache
Bootcache(Store &store, clock_type &clock, beast::Journal journal)
Definition: Bootcache.cpp:28
-
ripple::PeerFinder::Bootcache::m_map
map_type m_map
Definition: Bootcache.h:117
+
ripple::PeerFinder::Bootcache::m_map
map_type m_map
Definition: Bootcache.h:110
ripple::PeerFinder::Store::Entry::valence
int valence
Definition: Store.h:45
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
std::int32_t
@@ -381,7 +381,7 @@ $(function() {
beast::leftw
Left justifies a field at the specified width.
Definition: iosformat.h:33
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::PeerFinder::Bootcache::value_type
map_type::value_type value_type
Definition: Bootcache.h:91
-
ripple::PeerFinder::Bootcache::m_needsUpdate
bool m_needsUpdate
Definition: Bootcache.h:127
+
ripple::PeerFinder::Bootcache::m_needsUpdate
bool m_needsUpdate
Definition: Bootcache.h:120
ripple::PeerFinder::Bootcache::cbegin
const_iterator cbegin() const
Definition: Bootcache.cpp:61
ripple::PeerFinder::Bootcache::empty
bool empty() const
Returns true if the cache is empty.
Definition: Bootcache.cpp:43
ripple::PeerFinder::Bootcache::begin
const_iterator begin() const
IP::Endpoint iterators that traverse in decreasing valence.
Definition: Bootcache.cpp:55
diff --git a/Bootcache_8h_source.html b/Bootcache_8h_source.html index 1a3034b884..f82ebbf7ce 100644 --- a/Bootcache_8h_source.html +++ b/Bootcache_8h_source.html @@ -147,155 +147,147 @@ $(function() {
91  using value_type = map_type::value_type;
92 
93  struct Transform
-
94 #ifdef _LIBCPP_VERSION
-
95  : std::unary_function<
-
96  map_type::right_map::const_iterator::value_type const&,
-
97  beast::IP::Endpoint const&>
-
98 #endif
-
99  {
-
100 #ifndef _LIBCPP_VERSION
-
101  using first_argument_type =
-
102  map_type::right_map::const_iterator::value_type const&;
-
103  using result_type = beast::IP::Endpoint const&;
-
104 #endif
-
105 
-
106  explicit Transform() = default;
-
107 
-
108  beast::IP::Endpoint const&
-
109  operator()(
-
110  map_type::right_map::const_iterator::value_type const& v) const
-
111  {
-
112  return v.get_left();
-
113  }
-
114  };
+
94  {
+
95  using first_argument_type =
+
96  map_type::right_map::const_iterator::value_type const&;
+
97  using result_type = beast::IP::Endpoint const&;
+
98 
+
99  explicit Transform() = default;
+
100 
+
101  beast::IP::Endpoint const&
+
102  operator()(
+
103  map_type::right_map::const_iterator::value_type const& v) const
+
104  {
+
105  return v.get_left();
+
106  }
+
107  };
+
108 
+
109 private:
+
110  map_type m_map;
+
111 
+
112  Store& m_store;
+
113  clock_type& m_clock;
+
114  beast::Journal m_journal;
115 
-
116 private:
-
117  map_type m_map;
+
116  // Time after which we can update the database again
+
117  clock_type::time_point m_whenUpdate;
118 
-
119  Store& m_store;
-
120  clock_type& m_clock;
-
121  beast::Journal m_journal;
-
122 
-
123  // Time after which we can update the database again
-
124  clock_type::time_point m_whenUpdate;
-
125 
-
126  // Set to true when a database update is needed
-
127  bool m_needsUpdate;
-
128 
-
129 public:
-
130  static constexpr int staticValence = 32;
+
119  // Set to true when a database update is needed
+
120  bool m_needsUpdate;
+
121 
+
122 public:
+
123  static constexpr int staticValence = 32;
+
124 
+
125  using iterator = boost::
+
126  transform_iterator<Transform, map_type::right_map::const_iterator>;
+
127 
+
128  using const_iterator = iterator;
+
129 
+
130  Bootcache(Store& store, clock_type& clock, beast::Journal journal);
131 
-
132  using iterator = boost::
-
133  transform_iterator<Transform, map_type::right_map::const_iterator>;
-
134 
-
135  using const_iterator = iterator;
-
136 
-
137  Bootcache(Store& store, clock_type& clock, beast::Journal journal);
-
138 
-
139  ~Bootcache();
-
140 
-
142  bool
-
143  empty() const;
-
144 
-
146  map_type::size_type
-
147  size() const;
-
148 
-
151  const_iterator
-
152  begin() const;
-
153  const_iterator
-
154  cbegin() const;
-
155  const_iterator
-
156  end() const;
-
157  const_iterator
-
158  cend() const;
-
159  void
-
160  clear();
-
164  void
-
165  load();
-
166 
-
168  bool
-
169  insert(beast::IP::Endpoint const& endpoint);
-
170 
-
172  bool
-
173  insertStatic(beast::IP::Endpoint const& endpoint);
-
174 
-
176  void
-
177  on_success(beast::IP::Endpoint const& endpoint);
-
178 
-
180  void
-
181  on_failure(beast::IP::Endpoint const& endpoint);
-
182 
-
184  void
-
185  periodicActivity();
-
186 
-
188  void
-
189  onWrite(beast::PropertyStream::Map& map);
-
190 
-
191 private:
-
192  void
-
193  prune();
-
194  void
-
195  update();
-
196  void
-
197  checkUpdate();
-
198  void
-
199  flagForUpdate();
-
200 };
-
201 
-
202 } // namespace PeerFinder
-
203 } // namespace ripple
-
204 
-
205 #endif
+
132  ~Bootcache();
+
133 
+
135  bool
+
136  empty() const;
+
137 
+
139  map_type::size_type
+
140  size() const;
+
141 
+
144  const_iterator
+
145  begin() const;
+
146  const_iterator
+
147  cbegin() const;
+
148  const_iterator
+
149  end() const;
+
150  const_iterator
+
151  cend() const;
+
152  void
+
153  clear();
+
157  void
+
158  load();
+
159 
+
161  bool
+
162  insert(beast::IP::Endpoint const& endpoint);
+
163 
+
165  bool
+
166  insertStatic(beast::IP::Endpoint const& endpoint);
+
167 
+
169  void
+
170  on_success(beast::IP::Endpoint const& endpoint);
+
171 
+
173  void
+
174  on_failure(beast::IP::Endpoint const& endpoint);
+
175 
+
177  void
+
178  periodicActivity();
+
179 
+
181  void
+
182  onWrite(beast::PropertyStream::Map& map);
+
183 
+
184 private:
+
185  void
+
186  prune();
+
187  void
+
188  update();
+
189  void
+
190  checkUpdate();
+
191  void
+
192  flagForUpdate();
+
193 };
+
194 
+
195 } // namespace PeerFinder
+
196 } // namespace ripple
+
197 
+
198 #endif
ripple::PeerFinder::Bootcache::cend
const_iterator cend() const
Definition: Bootcache.cpp:73
ripple::PeerFinder::Bootcache::insertStatic
bool insertStatic(beast::IP::Endpoint const &endpoint)
Add a staticallyconfigured address to the cache.
Definition: Bootcache.cpp:125
ripple::PeerFinder::Bootcache::Entry::valence
int valence() const
Definition: Bootcache.h:68
beast::PropertyStream::Map
Definition: PropertyStream.h:224
ripple::PeerFinder::Bootcache::checkUpdate
void checkUpdate()
Definition: Bootcache.cpp:272
-
ripple::PeerFinder::Bootcache::Transform::first_argument_type
map_type::right_map::const_iterator::value_type const & first_argument_type
Definition: Bootcache.h:102
-
ripple::PeerFinder::Bootcache::m_store
Store & m_store
Definition: Bootcache.h:119
+
ripple::PeerFinder::Bootcache::Transform::first_argument_type
map_type::right_map::const_iterator::value_type const & first_argument_type
Definition: Bootcache.h:96
+
ripple::PeerFinder::Bootcache::m_store
Store & m_store
Definition: Bootcache.h:112
ripple::PeerFinder::Bootcache::map_type
boost::bimap< left_t, right_t > map_type
Definition: Bootcache.h:90
ripple::PeerFinder::Bootcache::on_failure
void on_failure(beast::IP::Endpoint const &endpoint)
Called when an outbound connection attempt fails to handshake.
Definition: Bootcache.cpp:173
ripple::PeerFinder::Bootcache::clear
void clear()
Definition: Bootcache.cpp:79
-
ripple::PeerFinder::Bootcache::m_journal
beast::Journal m_journal
Definition: Bootcache.h:121
+
ripple::PeerFinder::Bootcache::m_journal
beast::Journal m_journal
Definition: Bootcache.h:114
ripple::PeerFinder::Bootcache::right_t
boost::bimaps::multiset_of< Entry, ripple::less< Entry > > right_t
Definition: Bootcache.h:89
ripple::PeerFinder::Bootcache::periodicActivity
void periodicActivity()
Stores the cache in the persistent database on a timer.
Definition: Bootcache.cpp:199
ripple::PeerFinder::Store
Abstract persistence for PeerFinder data.
Definition: Store.h:27
ripple::PeerFinder::Bootcache::flagForUpdate
void flagForUpdate()
Definition: Bootcache.cpp:280
ripple::PeerFinder::Bootcache::prune
void prune()
Definition: Bootcache.cpp:220
ripple::PeerFinder::Bootcache::load
void load()
Load the persisted data from the Store into the container.
Definition: Bootcache.cpp:88
-
ripple::PeerFinder::Bootcache::iterator
boost::transform_iterator< Transform, map_type::right_map::const_iterator > iterator
Definition: Bootcache.h:133
+
ripple::PeerFinder::Bootcache::iterator
boost::transform_iterator< Transform, map_type::right_map::const_iterator > iterator
Definition: Bootcache.h:126
ripple::PeerFinder::Bootcache::size
map_type::size_type size() const
Returns the number of entries in the cache.
Definition: Bootcache.cpp:49
-
ripple::PeerFinder::Bootcache::const_iterator
iterator const_iterator
Definition: Bootcache.h:135
+
ripple::PeerFinder::Bootcache::const_iterator
iterator const_iterator
Definition: Bootcache.h:128
ripple::PeerFinder::Bootcache::~Bootcache
~Bootcache()
Definition: Bootcache.cpp:37
ripple::PeerFinder::Bootcache
Stores IP addresses useful for gaining initial connections.
Definition: Bootcache.h:51
ripple::PeerFinder::Bootcache::insert
bool insert(beast::IP::Endpoint const &endpoint)
Add a newly-learned address to the cache.
Definition: Bootcache.cpp:111
ripple::equal_to
Definition: comparators.h:53
ripple::PeerFinder::Bootcache::end
const_iterator end() const
Definition: Bootcache.cpp:67
ripple::PeerFinder::Bootcache::Bootcache
Bootcache(Store &store, clock_type &clock, beast::Journal journal)
Definition: Bootcache.cpp:28
-
ripple::PeerFinder::Bootcache::m_clock
clock_type & m_clock
Definition: Bootcache.h:120
-
ripple::PeerFinder::Bootcache::m_map
map_type m_map
Definition: Bootcache.h:117
-
ripple::PeerFinder::Bootcache::staticValence
static constexpr int staticValence
Definition: Bootcache.h:130
+
ripple::PeerFinder::Bootcache::m_clock
clock_type & m_clock
Definition: Bootcache.h:113
+
ripple::PeerFinder::Bootcache::m_map
map_type m_map
Definition: Bootcache.h:110
+
ripple::PeerFinder::Bootcache::staticValence
static constexpr int staticValence
Definition: Bootcache.h:123
ripple::PeerFinder::Bootcache::Entry::operator<
friend bool operator<(Entry const &lhs, Entry const &rhs)
Definition: Bootcache.h:74
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
ripple::PeerFinder::Bootcache::Transform::Transform
Transform()=default
-
ripple::PeerFinder::Bootcache::Transform::operator()
beast::IP::Endpoint const & operator()(map_type::right_map::const_iterator::value_type const &v) const
Definition: Bootcache.h:109
+
ripple::PeerFinder::Bootcache::Transform::operator()
beast::IP::Endpoint const & operator()(map_type::right_map::const_iterator::value_type const &v) const
Definition: Bootcache.h:102
beast::abstract_clock< std::chrono::steady_clock >
ripple::PeerFinder::Bootcache::onWrite
void onWrite(beast::PropertyStream::Map &map)
Write the cache state to the property stream.
Definition: Bootcache.cpp:207
-
std::unary_function
ripple::PeerFinder::Bootcache::on_success
void on_success(beast::IP::Endpoint const &endpoint)
Called when an outbound connection handshake completes.
Definition: Bootcache.cpp:147
ripple::PeerFinder::Bootcache::update
void update()
Definition: Bootcache.cpp:251
ripple::PeerFinder::Bootcache::Transform
Definition: Bootcache.h:93
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::PeerFinder::Bootcache::value_type
map_type::value_type value_type
Definition: Bootcache.h:91
-
ripple::PeerFinder::Bootcache::m_needsUpdate
bool m_needsUpdate
Definition: Bootcache.h:127
+
ripple::PeerFinder::Bootcache::m_needsUpdate
bool m_needsUpdate
Definition: Bootcache.h:120
ripple::PeerFinder::Bootcache::left_t
boost::bimaps::unordered_set_of< beast::IP::Endpoint, boost::hash< beast::IP::Endpoint >, ripple::equal_to< beast::IP::Endpoint > > left_t
Definition: Bootcache.h:88
ripple::PeerFinder::Bootcache::cbegin
const_iterator cbegin() const
Definition: Bootcache.cpp:61
ripple::PeerFinder::Bootcache::empty
bool empty() const
Returns true if the cache is empty.
Definition: Bootcache.cpp:43
ripple::PeerFinder::Bootcache::begin
const_iterator begin() const
IP::Endpoint iterators that traverse in decreasing valence.
Definition: Bootcache.cpp:55
beast::IP::Endpoint
A version-independent IP address and port combination.
Definition: IPEndpoint.h:38
-
ripple::PeerFinder::Bootcache::m_whenUpdate
clock_type::time_point m_whenUpdate
Definition: Bootcache.h:124
-
ripple::PeerFinder::Bootcache::Transform::result_type
beast::IP::Endpoint const & result_type
Definition: Bootcache.h:103
+
ripple::PeerFinder::Bootcache::m_whenUpdate
clock_type::time_point m_whenUpdate
Definition: Bootcache.h:117
+
ripple::PeerFinder::Bootcache::Transform::result_type
beast::IP::Endpoint const & result_type
Definition: Bootcache.h:97
ripple::PeerFinder::Bootcache::Entry::m_valence
int m_valence
Definition: Bootcache.h:82
beast::abstract_clock::time_point
typename Clock::time_point time_point
Definition: abstract_clock.h:63
ripple::PeerFinder::Bootcache::Entry::valence
int & valence()
Definition: Bootcache.h:62
diff --git a/Handouts_8h_source.html b/Handouts_8h_source.html index 0402e2c79b..2f4d861adb 100644 --- a/Handouts_8h_source.html +++ b/Handouts_8h_source.html @@ -437,7 +437,7 @@ $(function() {
ripple::PeerFinder::RedirectHandouts
Receives handouts for redirecting a connection.
Definition: Handouts.h:102
iterator
beast::IP::Endpoint::address
Address const & address() const
Returns the address portion of this endpoint.
Definition: IPEndpoint.h:76
-
beast::detail::aged_ordered_container::insert
auto insert(value_type const &value) -> typename std::enable_if<!maybe_multi, std::pair< iterator, bool >>::type
Definition: aged_ordered_container.h:1780
+
beast::detail::aged_ordered_container::insert
auto insert(value_type const &value) -> typename std::enable_if<!maybe_multi, std::pair< iterator, bool >>::type
Definition: aged_ordered_container.h:1747
ripple::PeerFinder::SlotHandouts::slot
SlotImp::ptr const & slot() const
Definition: Handouts.h:209
ripple::PeerFinder::RedirectHandouts::RedirectHandouts
RedirectHandouts(SlotImp::ptr const &slot)
Definition: Handouts.h:142
std::any_of
T any_of(T... args)
diff --git a/Livecache_8h_source.html b/Livecache_8h_source.html index 0878d8c212..6acd58f06d 100644 --- a/Livecache_8h_source.html +++ b/Livecache_8h_source.html @@ -136,525 +136,514 @@ $(function() {
69  public:
70  // Iterator transformation to extract the endpoint from Element
71  struct Transform
-
72 #ifdef _LIBCPP_VERSION
-
73  : public std::unary_function<Element, Endpoint>
-
74 #endif
-
75  {
-
76 #ifndef _LIBCPP_VERSION
-
77  using first_argument = Element;
-
78  using result_type = Endpoint;
-
79 #endif
-
80 
-
81  explicit Transform() = default;
-
82 
-
83  Endpoint const&
-
84  operator()(Element const& e) const
-
85  {
-
86  return e.endpoint;
-
87  }
-
88  };
-
89 
-
90  public:
-
91  using iterator = boost::
-
92  transform_iterator<Transform, typename list_type::const_iterator>;
-
93 
-
94  using const_iterator = iterator;
-
95 
-
96  using reverse_iterator = boost::transform_iterator<
-
97  Transform,
-
98  typename list_type::const_reverse_iterator>;
-
99 
-
100  using const_reverse_iterator = reverse_iterator;
-
101 
-
102  iterator
-
103  begin() const
-
104  {
-
105  return iterator(m_list.get().cbegin(), Transform());
-
106  }
-
107 
-
108  iterator
-
109  cbegin() const
-
110  {
-
111  return iterator(m_list.get().cbegin(), Transform());
-
112  }
-
113 
-
114  iterator
-
115  end() const
-
116  {
-
117  return iterator(m_list.get().cend(), Transform());
-
118  }
-
119 
-
120  iterator
-
121  cend() const
-
122  {
-
123  return iterator(m_list.get().cend(), Transform());
-
124  }
-
125 
-
126  reverse_iterator
-
127  rbegin() const
-
128  {
-
129  return reverse_iterator(m_list.get().crbegin(), Transform());
-
130  }
-
131 
-
132  reverse_iterator
-
133  crbegin() const
-
134  {
-
135  return reverse_iterator(m_list.get().crbegin(), Transform());
-
136  }
-
137 
-
138  reverse_iterator
-
139  rend() const
-
140  {
-
141  return reverse_iterator(m_list.get().crend(), Transform());
-
142  }
-
143 
-
144  reverse_iterator
-
145  crend() const
-
146  {
-
147  return reverse_iterator(m_list.get().crend(), Transform());
-
148  }
-
149 
-
150  // move the element to the end of the container
-
151  void
-
152  move_back(const_iterator pos)
-
153  {
-
154  auto& e(const_cast<Element&>(*pos.base()));
-
155  m_list.get().erase(m_list.get().iterator_to(e));
-
156  m_list.get().push_back(e);
-
157  }
-
158 
-
159  private:
-
160  explicit Hop(
-
161  typename beast::maybe_const<IsConst, list_type>::type& list)
-
162  : m_list(list)
-
163  {
-
164  }
-
165 
-
166  friend class LivecacheBase;
+
72  {
+
73  using first_argument = Element;
+
74  using result_type = Endpoint;
+
75 
+
76  explicit Transform() = default;
+
77 
+
78  Endpoint const&
+
79  operator()(Element const& e) const
+
80  {
+
81  return e.endpoint;
+
82  }
+
83  };
+
84 
+
85  public:
+
86  using iterator = boost::
+
87  transform_iterator<Transform, typename list_type::const_iterator>;
+
88 
+
89  using const_iterator = iterator;
+
90 
+
91  using reverse_iterator = boost::transform_iterator<
+
92  Transform,
+
93  typename list_type::const_reverse_iterator>;
+
94 
+
95  using const_reverse_iterator = reverse_iterator;
+
96 
+
97  iterator
+
98  begin() const
+
99  {
+
100  return iterator(m_list.get().cbegin(), Transform());
+
101  }
+
102 
+
103  iterator
+
104  cbegin() const
+
105  {
+
106  return iterator(m_list.get().cbegin(), Transform());
+
107  }
+
108 
+
109  iterator
+
110  end() const
+
111  {
+
112  return iterator(m_list.get().cend(), Transform());
+
113  }
+
114 
+
115  iterator
+
116  cend() const
+
117  {
+
118  return iterator(m_list.get().cend(), Transform());
+
119  }
+
120 
+
121  reverse_iterator
+
122  rbegin() const
+
123  {
+
124  return reverse_iterator(m_list.get().crbegin(), Transform());
+
125  }
+
126 
+
127  reverse_iterator
+
128  crbegin() const
+
129  {
+
130  return reverse_iterator(m_list.get().crbegin(), Transform());
+
131  }
+
132 
+
133  reverse_iterator
+
134  rend() const
+
135  {
+
136  return reverse_iterator(m_list.get().crend(), Transform());
+
137  }
+
138 
+
139  reverse_iterator
+
140  crend() const
+
141  {
+
142  return reverse_iterator(m_list.get().crend(), Transform());
+
143  }
+
144 
+
145  // move the element to the end of the container
+
146  void
+
147  move_back(const_iterator pos)
+
148  {
+
149  auto& e(const_cast<Element&>(*pos.base()));
+
150  m_list.get().erase(m_list.get().iterator_to(e));
+
151  m_list.get().push_back(e);
+
152  }
+
153 
+
154  private:
+
155  explicit Hop(
+
156  typename beast::maybe_const<IsConst, list_type>::type& list)
+
157  : m_list(list)
+
158  {
+
159  }
+
160 
+
161  friend class LivecacheBase;
+
162 
+
163  std::reference_wrapper<
+
164  typename beast::maybe_const<IsConst, list_type>::type>
+
165  m_list;
+
166  };
167 
-
168  std::reference_wrapper<
-
169  typename beast::maybe_const<IsConst, list_type>::type>
-
170  m_list;
-
171  };
-
172 
-
173 protected:
-
174  // Work-around to call Hop's private constructor from Livecache
-
175  template <bool IsConst>
-
176  static Hop<IsConst>
-
177  make_hop(typename beast::maybe_const<IsConst, list_type>::type& list)
-
178  {
-
179  return Hop<IsConst>(list);
-
180  }
-
181 };
-
182 
-
183 } // namespace detail
-
184 
-
185 //------------------------------------------------------------------------------
-
186 
-
199 template <class Allocator = std::allocator<char>>
-
200 class Livecache : protected detail::LivecacheBase
-
201 {
-
202 private:
-
203  using cache_type = beast::aged_map<
-
204  beast::IP::Endpoint,
-
205  Element,
-
206  std::chrono::steady_clock,
-
207  std::less<beast::IP::Endpoint>,
-
208  Allocator>;
-
209 
-
210  beast::Journal m_journal;
-
211  cache_type m_cache;
-
212 
-
213 public:
-
214  using allocator_type = Allocator;
-
215 
-
217  Livecache(
-
218  clock_type& clock,
-
219  beast::Journal journal,
-
220  Allocator alloc = Allocator());
-
221 
+
168 protected:
+
169  // Work-around to call Hop's private constructor from Livecache
+
170  template <bool IsConst>
+
171  static Hop<IsConst>
+
172  make_hop(typename beast::maybe_const<IsConst, list_type>::type& list)
+
173  {
+
174  return Hop<IsConst>(list);
+
175  }
+
176 };
+
177 
+
178 } // namespace detail
+
179 
+
180 //------------------------------------------------------------------------------
+
181 
+
194 template <class Allocator = std::allocator<char>>
+
195 class Livecache : protected detail::LivecacheBase
+
196 {
+
197 private:
+
198  using cache_type = beast::aged_map<
+
199  beast::IP::Endpoint,
+
200  Element,
+
201  std::chrono::steady_clock,
+
202  std::less<beast::IP::Endpoint>,
+
203  Allocator>;
+
204 
+
205  beast::Journal m_journal;
+
206  cache_type m_cache;
+
207 
+
208 public:
+
209  using allocator_type = Allocator;
+
210 
+
212  Livecache(
+
213  clock_type& clock,
+
214  beast::Journal journal,
+
215  Allocator alloc = Allocator());
+
216 
+
217  //
+
218  // Iteration by hops
+
219  //
+
220  // The range [begin, end) provides a sequence of list_type
+
221  // where each list contains endpoints at a given hops.
222  //
-
223  // Iteration by hops
-
224  //
-
225  // The range [begin, end) provides a sequence of list_type
-
226  // where each list contains endpoints at a given hops.
-
227  //
-
228 
-
229  class hops_t
-
230  {
-
231  private:
-
232  // An endpoint at hops=0 represents the local node.
-
233  // Endpoints coming in at maxHops are stored at maxHops +1,
-
234  // but not given out (since they would exceed maxHops). They
-
235  // are used for automatic connection attempts.
-
236  //
-
237  using Histogram = std::array<int, 1 + Tuning::maxHops + 1>;
-
238  using lists_type = std::array<list_type, 1 + Tuning::maxHops + 1>;
-
239 
-
240  template <bool IsConst>
-
241  struct Transform
-
242 #ifdef _LIBCPP_VERSION
-
243  : public std::
-
244  unary_function<typename lists_type::value_type, Hop<IsConst>>
-
245 #endif
-
246  {
-
247 #ifndef _LIBCPP_VERSION
-
248  using first_argument = typename lists_type::value_type;
-
249  using result_type = Hop<IsConst>;
-
250 #endif
+
223 
+
224  class hops_t
+
225  {
+
226  private:
+
227  // An endpoint at hops=0 represents the local node.
+
228  // Endpoints coming in at maxHops are stored at maxHops +1,
+
229  // but not given out (since they would exceed maxHops). They
+
230  // are used for automatic connection attempts.
+
231  //
+
232  using Histogram = std::array<int, 1 + Tuning::maxHops + 1>;
+
233  using lists_type = std::array<list_type, 1 + Tuning::maxHops + 1>;
+
234 
+
235  template <bool IsConst>
+
236  struct Transform
+
237  {
+
238  using first_argument = typename lists_type::value_type;
+
239  using result_type = Hop<IsConst>;
+
240 
+
241  explicit Transform() = default;
+
242 
+
243  Hop<IsConst>
+
244  operator()(typename beast::maybe_const<
+
245  IsConst,
+
246  typename lists_type::value_type>::type& list) const
+
247  {
+
248  return make_hop<IsConst>(list);
+
249  }
+
250  };
251 
-
252  explicit Transform() = default;
-
253 
-
254  Hop<IsConst>
-
255  operator()(typename beast::maybe_const<
-
256  IsConst,
-
257  typename lists_type::value_type>::type& list) const
-
258  {
-
259  return make_hop<IsConst>(list);
-
260  }
-
261  };
-
262 
-
263  public:
-
264  using iterator = boost::
-
265  transform_iterator<Transform<false>, typename lists_type::iterator>;
-
266 
-
267  using const_iterator = boost::transform_iterator<
-
268  Transform<true>,
-
269  typename lists_type::const_iterator>;
-
270 
-
271  using reverse_iterator = boost::transform_iterator<
-
272  Transform<false>,
-
273  typename lists_type::reverse_iterator>;
-
274 
-
275  using const_reverse_iterator = boost::transform_iterator<
-
276  Transform<true>,
-
277  typename lists_type::const_reverse_iterator>;
-
278 
-
279  iterator
-
280  begin()
-
281  {
-
282  return iterator(m_lists.begin(), Transform<false>());
-
283  }
-
284 
-
285  const_iterator
-
286  begin() const
-
287  {
-
288  return const_iterator(m_lists.cbegin(), Transform<true>());
-
289  }
-
290 
-
291  const_iterator
-
292  cbegin() const
-
293  {
-
294  return const_iterator(m_lists.cbegin(), Transform<true>());
-
295  }
-
296 
-
297  iterator
-
298  end()
-
299  {
-
300  return iterator(m_lists.end(), Transform<false>());
-
301  }
-
302 
-
303  const_iterator
-
304  end() const
-
305  {
-
306  return const_iterator(m_lists.cend(), Transform<true>());
-
307  }
-
308 
-
309  const_iterator
-
310  cend() const
-
311  {
-
312  return const_iterator(m_lists.cend(), Transform<true>());
-
313  }
-
314 
-
315  reverse_iterator
-
316  rbegin()
-
317  {
-
318  return reverse_iterator(m_lists.rbegin(), Transform<false>());
-
319  }
-
320 
-
321  const_reverse_iterator
-
322  rbegin() const
-
323  {
-
324  return const_reverse_iterator(m_lists.crbegin(), Transform<true>());
-
325  }
-
326 
-
327  const_reverse_iterator
-
328  crbegin() const
-
329  {
-
330  return const_reverse_iterator(m_lists.crbegin(), Transform<true>());
-
331  }
-
332 
-
333  reverse_iterator
-
334  rend()
-
335  {
-
336  return reverse_iterator(m_lists.rend(), Transform<false>());
-
337  }
-
338 
-
339  const_reverse_iterator
-
340  rend() const
-
341  {
-
342  return const_reverse_iterator(m_lists.crend(), Transform<true>());
-
343  }
-
344 
-
345  const_reverse_iterator
-
346  crend() const
-
347  {
-
348  return const_reverse_iterator(m_lists.crend(), Transform<true>());
-
349  }
-
350 
-
352  void
-
353  shuffle();
-
354 
-
355  std::string
-
356  histogram() const;
-
357 
-
358  private:
-
359  explicit hops_t(Allocator const& alloc);
-
360 
-
361  void
-
362  insert(Element& e);
-
363 
-
364  // Reinsert e at a new hops
-
365  void
-
366  reinsert(Element& e, std::uint32_t hops);
-
367 
-
368  void
-
369  remove(Element& e);
-
370 
-
371  friend class Livecache;
-
372  lists_type m_lists;
-
373  Histogram m_hist;
-
374  } hops;
-
375 
-
377  bool
-
378  empty() const
-
379  {
-
380  return m_cache.empty();
-
381  }
+
252  public:
+
253  using iterator = boost::
+
254  transform_iterator<Transform<false>, typename lists_type::iterator>;
+
255 
+
256  using const_iterator = boost::transform_iterator<
+
257  Transform<true>,
+
258  typename lists_type::const_iterator>;
+
259 
+
260  using reverse_iterator = boost::transform_iterator<
+
261  Transform<false>,
+
262  typename lists_type::reverse_iterator>;
+
263 
+
264  using const_reverse_iterator = boost::transform_iterator<
+
265  Transform<true>,
+
266  typename lists_type::const_reverse_iterator>;
+
267 
+
268  iterator
+
269  begin()
+
270  {
+
271  return iterator(m_lists.begin(), Transform<false>());
+
272  }
+
273 
+
274  const_iterator
+
275  begin() const
+
276  {
+
277  return const_iterator(m_lists.cbegin(), Transform<true>());
+
278  }
+
279 
+
280  const_iterator
+
281  cbegin() const
+
282  {
+
283  return const_iterator(m_lists.cbegin(), Transform<true>());
+
284  }
+
285 
+
286  iterator
+
287  end()
+
288  {
+
289  return iterator(m_lists.end(), Transform<false>());
+
290  }
+
291 
+
292  const_iterator
+
293  end() const
+
294  {
+
295  return const_iterator(m_lists.cend(), Transform<true>());
+
296  }
+
297 
+
298  const_iterator
+
299  cend() const
+
300  {
+
301  return const_iterator(m_lists.cend(), Transform<true>());
+
302  }
+
303 
+
304  reverse_iterator
+
305  rbegin()
+
306  {
+
307  return reverse_iterator(m_lists.rbegin(), Transform<false>());
+
308  }
+
309 
+
310  const_reverse_iterator
+
311  rbegin() const
+
312  {
+
313  return const_reverse_iterator(m_lists.crbegin(), Transform<true>());
+
314  }
+
315 
+
316  const_reverse_iterator
+
317  crbegin() const
+
318  {
+
319  return const_reverse_iterator(m_lists.crbegin(), Transform<true>());
+
320  }
+
321 
+
322  reverse_iterator
+
323  rend()
+
324  {
+
325  return reverse_iterator(m_lists.rend(), Transform<false>());
+
326  }
+
327 
+
328  const_reverse_iterator
+
329  rend() const
+
330  {
+
331  return const_reverse_iterator(m_lists.crend(), Transform<true>());
+
332  }
+
333 
+
334  const_reverse_iterator
+
335  crend() const
+
336  {
+
337  return const_reverse_iterator(m_lists.crend(), Transform<true>());
+
338  }
+
339 
+
341  void
+
342  shuffle();
+
343 
+
344  std::string
+
345  histogram() const;
+
346 
+
347  private:
+
348  explicit hops_t(Allocator const& alloc);
+
349 
+
350  void
+
351  insert(Element& e);
+
352 
+
353  // Reinsert e at a new hops
+
354  void
+
355  reinsert(Element& e, std::uint32_t hops);
+
356 
+
357  void
+
358  remove(Element& e);
+
359 
+
360  friend class Livecache;
+
361  lists_type m_lists;
+
362  Histogram m_hist;
+
363  } hops;
+
364 
+
366  bool
+
367  empty() const
+
368  {
+
369  return m_cache.empty();
+
370  }
+
371 
+
373  typename cache_type::size_type
+
374  size() const
+
375  {
+
376  return m_cache.size();
+
377  }
+
378 
+
380  void
+
381  expire();
382 
-
384  typename cache_type::size_type
-
385  size() const
-
386  {
-
387  return m_cache.size();
-
388  }
-
389 
-
391  void
-
392  expire();
+
384  void
+
385  insert(Endpoint const& ep);
+
386 
+
388  void
+
389  onWrite(beast::PropertyStream::Map& map);
+
390 };
+
391 
+
392 //------------------------------------------------------------------------------
393 
-
395  void
-
396  insert(Endpoint const& ep);
-
397 
-
399  void
-
400  onWrite(beast::PropertyStream::Map& map);
-
401 };
+
394 template <class Allocator>
+
395 Livecache<Allocator>::Livecache(
+
396  clock_type& clock,
+
397  beast::Journal journal,
+
398  Allocator alloc)
+
399  : m_journal(journal), m_cache(clock, alloc), hops(alloc)
+
400 {
+
401 }
402 
-
403 //------------------------------------------------------------------------------
-
404 
-
405 template <class Allocator>
-
406 Livecache<Allocator>::Livecache(
-
407  clock_type& clock,
-
408  beast::Journal journal,
-
409  Allocator alloc)
-
410  : m_journal(journal), m_cache(clock, alloc), hops(alloc)
-
411 {
-
412 }
-
413 
-
414 template <class Allocator>
-
415 void
-
416 Livecache<Allocator>::expire()
-
417 {
-
418  std::size_t n(0);
-
419  typename cache_type::time_point const expired(
-
420  m_cache.clock().now() - Tuning::liveCacheSecondsToLive);
-
421  for (auto iter(m_cache.chronological.begin());
-
422  iter != m_cache.chronological.end() && iter.when() <= expired;)
-
423  {
-
424  Element& e(iter->second);
-
425  hops.remove(e);
-
426  iter = m_cache.erase(iter);
-
427  ++n;
-
428  }
-
429  if (n > 0)
-
430  {
-
431  JLOG(m_journal.debug()) << beast::leftw(18) << "Livecache expired " << n
-
432  << ((n > 1) ? " entries" : " entry");
-
433  }
-
434 }
-
435 
-
436 template <class Allocator>
-
437 void
-
438 Livecache<Allocator>::insert(Endpoint const& ep)
-
439 {
-
440  // The caller already incremented hop, so if we got a
-
441  // message at maxHops we will store it at maxHops + 1.
-
442  // This means we won't give out the address to other peers
-
443  // but we will use it to make connections and hand it out
-
444  // when redirecting.
-
445  //
-
446  assert(ep.hops <= (Tuning::maxHops + 1));
-
447  auto result = m_cache.emplace(ep.address, ep);
-
448  Element& e(result.first->second);
-
449  if (result.second)
-
450  {
-
451  hops.insert(e);
-
452  JLOG(m_journal.debug()) << beast::leftw(18) << "Livecache insert "
-
453  << ep.address << " at hops " << ep.hops;
-
454  return;
-
455  }
-
456  else if (!result.second && (ep.hops > e.endpoint.hops))
-
457  {
-
458  // Drop duplicates at higher hops
-
459  std::size_t const excess(ep.hops - e.endpoint.hops);
-
460  JLOG(m_journal.trace()) << beast::leftw(18) << "Livecache drop "
-
461  << ep.address << " at hops +" << excess;
-
462  return;
-
463  }
-
464 
-
465  m_cache.touch(result.first);
-
466 
-
467  // Address already in the cache so update metadata
-
468  if (ep.hops < e.endpoint.hops)
-
469  {
-
470  hops.reinsert(e, ep.hops);
-
471  JLOG(m_journal.debug()) << beast::leftw(18) << "Livecache update "
-
472  << ep.address << " at hops " << ep.hops;
-
473  }
-
474  else
-
475  {
-
476  JLOG(m_journal.trace()) << beast::leftw(18) << "Livecache refresh "
-
477  << ep.address << " at hops " << ep.hops;
-
478  }
-
479 }
-
480 
-
481 template <class Allocator>
-
482 void
-
483 Livecache<Allocator>::onWrite(beast::PropertyStream::Map& map)
-
484 {
-
485  typename cache_type::time_point const expired(
-
486  m_cache.clock().now() - Tuning::liveCacheSecondsToLive);
-
487  map["size"] = size();
-
488  map["hist"] = hops.histogram();
-
489  beast::PropertyStream::Set set("entries", map);
-
490  for (auto iter(m_cache.cbegin()); iter != m_cache.cend(); ++iter)
-
491  {
-
492  auto const& e(iter->second);
-
493  beast::PropertyStream::Map item(set);
-
494  item["hops"] = e.endpoint.hops;
-
495  item["address"] = e.endpoint.address.to_string();
-
496  std::stringstream ss;
-
497  ss << (iter.when() - expired).count();
-
498  item["expires"] = ss.str();
-
499  }
-
500 }
-
501 
-
502 //------------------------------------------------------------------------------
-
503 
-
504 template <class Allocator>
-
505 void
-
506 Livecache<Allocator>::hops_t::shuffle()
-
507 {
-
508  for (auto& list : m_lists)
-
509  {
-
510  std::vector<std::reference_wrapper<Element>> v;
-
511  v.reserve(list.size());
-
512  std::copy(list.begin(), list.end(), std::back_inserter(v));
-
513  std::shuffle(v.begin(), v.end(), default_prng());
-
514  list.clear();
-
515  for (auto& e : v)
-
516  list.push_back(e);
-
517  }
-
518 }
-
519 
-
520 template <class Allocator>
-
521 std::string
-
522 Livecache<Allocator>::hops_t::histogram() const
-
523 {
-
524  std::string s;
-
525  for (auto const& h : m_hist)
-
526  {
-
527  if (!s.empty())
-
528  s += ", ";
-
529  s += std::to_string(h);
-
530  }
-
531  return s;
-
532 }
-
533 
-
534 template <class Allocator>
-
535 Livecache<Allocator>::hops_t::hops_t(Allocator const& alloc)
-
536 {
-
537  std::fill(m_hist.begin(), m_hist.end(), 0);
-
538 }
-
539 
-
540 template <class Allocator>
-
541 void
-
542 Livecache<Allocator>::hops_t::insert(Element& e)
-
543 {
-
544  assert(e.endpoint.hops <= Tuning::maxHops + 1);
-
545  // This has security implications without a shuffle
-
546  m_lists[e.endpoint.hops].push_front(e);
-
547  ++m_hist[e.endpoint.hops];
-
548 }
+
403 template <class Allocator>
+
404 void
+
405 Livecache<Allocator>::expire()
+
406 {
+
407  std::size_t n(0);
+
408  typename cache_type::time_point const expired(
+
409  m_cache.clock().now() - Tuning::liveCacheSecondsToLive);
+
410  for (auto iter(m_cache.chronological.begin());
+
411  iter != m_cache.chronological.end() && iter.when() <= expired;)
+
412  {
+
413  Element& e(iter->second);
+
414  hops.remove(e);
+
415  iter = m_cache.erase(iter);
+
416  ++n;
+
417  }
+
418  if (n > 0)
+
419  {
+
420  JLOG(m_journal.debug()) << beast::leftw(18) << "Livecache expired " << n
+
421  << ((n > 1) ? " entries" : " entry");
+
422  }
+
423 }
+
424 
+
425 template <class Allocator>
+
426 void
+
427 Livecache<Allocator>::insert(Endpoint const& ep)
+
428 {
+
429  // The caller already incremented hop, so if we got a
+
430  // message at maxHops we will store it at maxHops + 1.
+
431  // This means we won't give out the address to other peers
+
432  // but we will use it to make connections and hand it out
+
433  // when redirecting.
+
434  //
+
435  assert(ep.hops <= (Tuning::maxHops + 1));
+
436  auto result = m_cache.emplace(ep.address, ep);
+
437  Element& e(result.first->second);
+
438  if (result.second)
+
439  {
+
440  hops.insert(e);
+
441  JLOG(m_journal.debug()) << beast::leftw(18) << "Livecache insert "
+
442  << ep.address << " at hops " << ep.hops;
+
443  return;
+
444  }
+
445  else if (!result.second && (ep.hops > e.endpoint.hops))
+
446  {
+
447  // Drop duplicates at higher hops
+
448  std::size_t const excess(ep.hops - e.endpoint.hops);
+
449  JLOG(m_journal.trace()) << beast::leftw(18) << "Livecache drop "
+
450  << ep.address << " at hops +" << excess;
+
451  return;
+
452  }
+
453 
+
454  m_cache.touch(result.first);
+
455 
+
456  // Address already in the cache so update metadata
+
457  if (ep.hops < e.endpoint.hops)
+
458  {
+
459  hops.reinsert(e, ep.hops);
+
460  JLOG(m_journal.debug()) << beast::leftw(18) << "Livecache update "
+
461  << ep.address << " at hops " << ep.hops;
+
462  }
+
463  else
+
464  {
+
465  JLOG(m_journal.trace()) << beast::leftw(18) << "Livecache refresh "
+
466  << ep.address << " at hops " << ep.hops;
+
467  }
+
468 }
+
469 
+
470 template <class Allocator>
+
471 void
+
472 Livecache<Allocator>::onWrite(beast::PropertyStream::Map& map)
+
473 {
+
474  typename cache_type::time_point const expired(
+
475  m_cache.clock().now() - Tuning::liveCacheSecondsToLive);
+
476  map["size"] = size();
+
477  map["hist"] = hops.histogram();
+
478  beast::PropertyStream::Set set("entries", map);
+
479  for (auto iter(m_cache.cbegin()); iter != m_cache.cend(); ++iter)
+
480  {
+
481  auto const& e(iter->second);
+
482  beast::PropertyStream::Map item(set);
+
483  item["hops"] = e.endpoint.hops;
+
484  item["address"] = e.endpoint.address.to_string();
+
485  std::stringstream ss;
+
486  ss << (iter.when() - expired).count();
+
487  item["expires"] = ss.str();
+
488  }
+
489 }
+
490 
+
491 //------------------------------------------------------------------------------
+
492 
+
493 template <class Allocator>
+
494 void
+
495 Livecache<Allocator>::hops_t::shuffle()
+
496 {
+
497  for (auto& list : m_lists)
+
498  {
+
499  std::vector<std::reference_wrapper<Element>> v;
+
500  v.reserve(list.size());
+
501  std::copy(list.begin(), list.end(), std::back_inserter(v));
+
502  std::shuffle(v.begin(), v.end(), default_prng());
+
503  list.clear();
+
504  for (auto& e : v)
+
505  list.push_back(e);
+
506  }
+
507 }
+
508 
+
509 template <class Allocator>
+
510 std::string
+
511 Livecache<Allocator>::hops_t::histogram() const
+
512 {
+
513  std::string s;
+
514  for (auto const& h : m_hist)
+
515  {
+
516  if (!s.empty())
+
517  s += ", ";
+
518  s += std::to_string(h);
+
519  }
+
520  return s;
+
521 }
+
522 
+
523 template <class Allocator>
+
524 Livecache<Allocator>::hops_t::hops_t(Allocator const& alloc)
+
525 {
+
526  std::fill(m_hist.begin(), m_hist.end(), 0);
+
527 }
+
528 
+
529 template <class Allocator>
+
530 void
+
531 Livecache<Allocator>::hops_t::insert(Element& e)
+
532 {
+
533  assert(e.endpoint.hops <= Tuning::maxHops + 1);
+
534  // This has security implications without a shuffle
+
535  m_lists[e.endpoint.hops].push_front(e);
+
536  ++m_hist[e.endpoint.hops];
+
537 }
+
538 
+
539 template <class Allocator>
+
540 void
+
541 Livecache<Allocator>::hops_t::reinsert(Element& e, std::uint32_t numHops)
+
542 {
+
543  assert(numHops <= Tuning::maxHops + 1);
+
544 
+
545  auto& list = m_lists[e.endpoint.hops];
+
546  list.erase(list.iterator_to(e));
+
547 
+
548  --m_hist[e.endpoint.hops];
549 
-
550 template <class Allocator>
-
551 void
-
552 Livecache<Allocator>::hops_t::reinsert(Element& e, std::uint32_t numHops)
-
553 {
-
554  assert(numHops <= Tuning::maxHops + 1);
-
555 
-
556  auto& list = m_lists[e.endpoint.hops];
-
557  list.erase(list.iterator_to(e));
-
558 
-
559  --m_hist[e.endpoint.hops];
-
560 
-
561  e.endpoint.hops = numHops;
-
562  insert(e);
-
563 }
-
564 
-
565 template <class Allocator>
-
566 void
-
567 Livecache<Allocator>::hops_t::remove(Element& e)
-
568 {
-
569  --m_hist[e.endpoint.hops];
-
570 
-
571  auto& list = m_lists[e.endpoint.hops];
-
572  list.erase(list.iterator_to(e));
-
573 }
-
574 
-
575 } // namespace PeerFinder
-
576 } // namespace ripple
-
577 
-
578 #endif
+
550  e.endpoint.hops = numHops;
+
551  insert(e);
+
552 }
+
553 
+
554 template <class Allocator>
+
555 void
+
556 Livecache<Allocator>::hops_t::remove(Element& e)
+
557 {
+
558  --m_hist[e.endpoint.hops];
+
559 
+
560  auto& list = m_lists[e.endpoint.hops];
+
561  list.erase(list.iterator_to(e));
+
562 }
+
563 
+
564 } // namespace PeerFinder
+
565 } // namespace ripple
+
566 
+
567 #endif
-
ripple::PeerFinder::Livecache::m_journal
beast::Journal m_journal
Definition: Livecache.h:210
-
ripple::PeerFinder::detail::LivecacheBase::Hop::reverse_iterator
boost::transform_iterator< Transform, typename list_type::const_reverse_iterator > reverse_iterator
Definition: Livecache.h:98
-
beast::detail::aged_ordered_container::empty
bool empty() const noexcept
Definition: aged_ordered_container.h:841
-
ripple::PeerFinder::Livecache::hops_t::histogram
std::string histogram() const
Definition: Livecache.h:522
-
ripple::PeerFinder::Livecache::hops_t::rbegin
const_reverse_iterator rbegin() const
Definition: Livecache.h:322
+
ripple::PeerFinder::Livecache::m_journal
beast::Journal m_journal
Definition: Livecache.h:205
+
ripple::PeerFinder::detail::LivecacheBase::Hop::reverse_iterator
boost::transform_iterator< Transform, typename list_type::const_reverse_iterator > reverse_iterator
Definition: Livecache.h:93
+
beast::detail::aged_ordered_container::empty
bool empty() const noexcept
Definition: aged_ordered_container.h:808
+
ripple::PeerFinder::Livecache::hops_t::histogram
std::string histogram() const
Definition: Livecache.h:511
+
ripple::PeerFinder::Livecache::hops_t::rbegin
const_reverse_iterator rbegin() const
Definition: Livecache.h:311
std::chrono::steady_clock
-
ripple::PeerFinder::Livecache::hops_t::Transform
Definition: Livecache.h:241
-
ripple::PeerFinder::Livecache::hops_t::Transform::operator()
Hop< IsConst > operator()(typename beast::maybe_const< IsConst, typename lists_type::value_type >::type &list) const
Definition: Livecache.h:255
+
ripple::PeerFinder::Livecache::hops_t::Transform
Definition: Livecache.h:236
+
ripple::PeerFinder::Livecache::hops_t::Transform::operator()
Hop< IsConst > operator()(typename beast::maybe_const< IsConst, typename lists_type::value_type >::type &list) const
Definition: Livecache.h:244
ripple::Dir::const_iterator
Definition: Directory.h:49
std::string
STL class.
ripple::PeerFinder::detail::LivecacheBase::Element
Definition: Livecache.h:49
ripple::PeerFinder::detail::LivecacheBase
Definition: Livecache.h:43
-
ripple::PeerFinder::Livecache::hops_t::m_lists
lists_type m_lists
Definition: Livecache.h:372
+
ripple::PeerFinder::Livecache::hops_t::m_lists
lists_type m_lists
Definition: Livecache.h:361
beast::Journal::trace
Stream trace() const
Severity stream access functions.
Definition: Journal.h:309
beast::PropertyStream::Map
Definition: PropertyStream.h:224
-
ripple::PeerFinder::Livecache::hops_t::insert
void insert(Element &e)
Definition: Livecache.h:542
+
ripple::PeerFinder::Livecache::hops_t::insert
void insert(Element &e)
Definition: Livecache.h:531
beast::detail::aged_container_iterator::when
time_point const & when() const
Definition: aged_container_iterator.h:149
-
ripple::PeerFinder::Livecache::hops_t::reverse_iterator
boost::transform_iterator< Transform< false >, typename lists_type::reverse_iterator > reverse_iterator
Definition: Livecache.h:273
+
ripple::PeerFinder::Livecache::hops_t::reverse_iterator
boost::transform_iterator< Transform< false >, typename lists_type::reverse_iterator > reverse_iterator
Definition: Livecache.h:262
std::vector::reserve
T reserve(T... args)
std::vector
STL class.
-
ripple::PeerFinder::detail::LivecacheBase::Hop::begin
iterator begin() const
Definition: Livecache.h:103
+
ripple::PeerFinder::detail::LivecacheBase::Hop::begin
iterator begin() const
Definition: Livecache.h:98
std::back_inserter
T back_inserter(T... args)
-
ripple::PeerFinder::Livecache::onWrite
void onWrite(beast::PropertyStream::Map &map)
Output statistics.
Definition: Livecache.h:483
-
ripple::PeerFinder::Livecache::hops_t::Transform::result_type
Hop< IsConst > result_type
Definition: Livecache.h:249
-
ripple::PeerFinder::Livecache::m_cache
cache_type m_cache
Definition: Livecache.h:211
-
ripple::PeerFinder::Livecache::hops_t::iterator
boost::transform_iterator< Transform< false >, typename lists_type::iterator > iterator
Definition: Livecache.h:265
+
ripple::PeerFinder::Livecache::onWrite
void onWrite(beast::PropertyStream::Map &map)
Output statistics.
Definition: Livecache.h:472
+
ripple::PeerFinder::Livecache::hops_t::Transform::result_type
Hop< IsConst > result_type
Definition: Livecache.h:239
+
ripple::PeerFinder::Livecache::m_cache
cache_type m_cache
Definition: Livecache.h:206
+
ripple::PeerFinder::Livecache::hops_t::iterator
boost::transform_iterator< Transform< false >, typename lists_type::iterator > iterator
Definition: Livecache.h:254
std::stringstream
STL class.
ripple::PeerFinder::detail::LivecacheBase::Hop
A list of Endpoint at the same hops This is a lightweight wrapper around a reference to the underlyin...
Definition: Livecache.h:67
std::reference_wrapper::get
T get(T... args)
-
ripple::PeerFinder::Livecache::hops_t::remove
void remove(Element &e)
Definition: Livecache.h:567
+
ripple::PeerFinder::Livecache::hops_t::remove
void remove(Element &e)
Definition: Livecache.h:556
ripple::PeerFinder::detail::LivecacheBase::list_type
boost::intrusive::make_list< Element, boost::intrusive::constant_time_size< false > >::type list_type
Definition: Livecache.h:59
ripple::PeerFinder::Tuning::liveCacheSecondsToLive
constexpr std::chrono::seconds liveCacheSecondsToLive(30)
ripple::PeerFinder::detail::LivecacheBase::LivecacheBase
LivecacheBase()=default
@@ -663,97 +652,95 @@ $(function() {
ripple::ListDisposition::expired
@ expired
List is expired, but has the largest non-pending sequence seen so far.
algorithm
beast::detail::aged_ordered_container::time_point
typename clock_type::time_point time_point
Definition: aged_ordered_container.h:86
-
ripple::PeerFinder::Livecache::size
cache_type::size_type size() const
Returns the number of entries in the cache.
Definition: Livecache.h:385
+
ripple::PeerFinder::Livecache::size
cache_type::size_type size() const
Returns the number of entries in the cache.
Definition: Livecache.h:374
ripple::PeerFinder::Livecache::hops_t::Transform::Transform
Transform()=default
-
ripple::PeerFinder::detail::LivecacheBase::Hop::const_iterator
iterator const_iterator
Definition: Livecache.h:94
+
ripple::PeerFinder::detail::LivecacheBase::Hop::const_iterator
iterator const_iterator
Definition: Livecache.h:89
std::fill
T fill(T... args)
beast::abstract_clock::now
virtual time_point now() const =0
Returns the current time.
ripple::PeerFinder::detail::LivecacheBase::Element::Element
Element(Endpoint const &endpoint_)
Definition: Livecache.h:51
-
ripple::PeerFinder::Livecache::insert
void insert(Endpoint const &ep)
Creates or updates an existing Element based on a new message.
Definition: Livecache.h:438
-
ripple::PeerFinder::Livecache::hops_t::m_hist
Histogram m_hist
Definition: Livecache.h:373
+
ripple::PeerFinder::Livecache::insert
void insert(Endpoint const &ep)
Creates or updates an existing Element based on a new message.
Definition: Livecache.h:427
+
ripple::PeerFinder::Livecache::hops_t::m_hist
Histogram m_hist
Definition: Livecache.h:362
ripple::PeerFinder::detail::LivecacheBase::Hop::Transform
Definition: Livecache.h:71
std::reference_wrapper
-
ripple::PeerFinder::detail::LivecacheBase::Hop::iterator
boost::transform_iterator< Transform, typename list_type::const_iterator > iterator
Definition: Livecache.h:92
-
ripple::PeerFinder::detail::LivecacheBase::Hop::cbegin
iterator cbegin() const
Definition: Livecache.h:109
-
beast::detail::aged_ordered_container::chronological_t::end
iterator end()
Definition: aged_ordered_container.h:508
-
ripple::PeerFinder::detail::LivecacheBase::Hop::cend
iterator cend() const
Definition: Livecache.h:121
-
beast::detail::aged_ordered_container::cend
const_iterator cend() const
Definition: aged_ordered_container.h:773
-
beast::detail::aged_ordered_container::clock
clock_type & clock()
Definition: aged_ordered_container.h:689
-
beast::detail::aged_ordered_container::chronological_t::begin
iterator begin()
Definition: aged_ordered_container.h:490
-
ripple::PeerFinder::detail::LivecacheBase::Hop::rend
reverse_iterator rend() const
Definition: Livecache.h:139
-
ripple::PeerFinder::Livecache::hops_t::crend
const_reverse_iterator crend() const
Definition: Livecache.h:346
-
ripple::PeerFinder::detail::LivecacheBase::Hop::rbegin
reverse_iterator rbegin() const
Definition: Livecache.h:127
-
ripple::PeerFinder::Livecache::hops_t
Definition: Livecache.h:229
-
ripple::PeerFinder::Livecache::hops_t::rend
const_reverse_iterator rend() const
Definition: Livecache.h:340
-
ripple::PeerFinder::detail::LivecacheBase::Hop::end
iterator end() const
Definition: Livecache.h:115
-
ripple::PeerFinder::Livecache::hops_t::crbegin
const_reverse_iterator crbegin() const
Definition: Livecache.h:328
-
beast::detail::aged_ordered_container::emplace
auto emplace(Args &&... args) -> typename std::enable_if<!maybe_multi, std::pair< iterator, bool >>::type
Definition: aged_ordered_container.h:1940
-
ripple::PeerFinder::Livecache::Livecache
Livecache(clock_type &clock, beast::Journal journal, Allocator alloc=Allocator())
Create the cache.
Definition: Livecache.h:406
-
ripple::PeerFinder::Livecache::hops_t::shuffle
void shuffle()
Shuffle each hop list.
Definition: Livecache.h:506
-
ripple::PeerFinder::Livecache::hops_t::rbegin
reverse_iterator rbegin()
Definition: Livecache.h:316
+
ripple::PeerFinder::detail::LivecacheBase::Hop::iterator
boost::transform_iterator< Transform, typename list_type::const_iterator > iterator
Definition: Livecache.h:87
+
ripple::PeerFinder::detail::LivecacheBase::Hop::cbegin
iterator cbegin() const
Definition: Livecache.h:104
+
beast::detail::aged_ordered_container::chronological_t::end
iterator end()
Definition: aged_ordered_container.h:475
+
ripple::PeerFinder::detail::LivecacheBase::Hop::cend
iterator cend() const
Definition: Livecache.h:116
+
beast::detail::aged_ordered_container::cend
const_iterator cend() const
Definition: aged_ordered_container.h:740
+
beast::detail::aged_ordered_container::clock
clock_type & clock()
Definition: aged_ordered_container.h:656
+
beast::detail::aged_ordered_container::chronological_t::begin
iterator begin()
Definition: aged_ordered_container.h:457
+
ripple::PeerFinder::detail::LivecacheBase::Hop::rend
reverse_iterator rend() const
Definition: Livecache.h:134
+
ripple::PeerFinder::Livecache::hops_t::crend
const_reverse_iterator crend() const
Definition: Livecache.h:335
+
ripple::PeerFinder::detail::LivecacheBase::Hop::rbegin
reverse_iterator rbegin() const
Definition: Livecache.h:122
+
ripple::PeerFinder::Livecache::hops_t
Definition: Livecache.h:224
+
ripple::PeerFinder::Livecache::hops_t::rend
const_reverse_iterator rend() const
Definition: Livecache.h:329
+
ripple::PeerFinder::detail::LivecacheBase::Hop::end
iterator end() const
Definition: Livecache.h:110
+
ripple::PeerFinder::Livecache::hops_t::crbegin
const_reverse_iterator crbegin() const
Definition: Livecache.h:317
+
beast::detail::aged_ordered_container::emplace
auto emplace(Args &&... args) -> typename std::enable_if<!maybe_multi, std::pair< iterator, bool >>::type
Definition: aged_ordered_container.h:1907
+
ripple::PeerFinder::Livecache::Livecache
Livecache(clock_type &clock, beast::Journal journal, Allocator alloc=Allocator())
Create the cache.
Definition: Livecache.h:395
+
ripple::PeerFinder::Livecache::hops_t::shuffle
void shuffle()
Shuffle each hop list.
Definition: Livecache.h:495
+
ripple::PeerFinder::Livecache::hops_t::rbegin
reverse_iterator rbegin()
Definition: Livecache.h:305
std::to_string
T to_string(T... args)
-
ripple::PeerFinder::detail::LivecacheBase::Hop::move_back
void move_back(const_iterator pos)
Definition: Livecache.h:152
+
ripple::PeerFinder::detail::LivecacheBase::Hop::move_back
void move_back(const_iterator pos)
Definition: Livecache.h:147
ripple::set
bool set(T &target, std::string const &name, Section const &section)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
Definition: BasicConfig.h:313
std::array< int, 1+Tuning::maxHops+1 >
-
ripple::PeerFinder::Livecache::hops_t::const_iterator
boost::transform_iterator< Transform< true >, typename lists_type::const_iterator > const_iterator
Definition: Livecache.h:269
-
ripple::PeerFinder::detail::LivecacheBase::Hop::m_list
std::reference_wrapper< typename beast::maybe_const< IsConst, list_type >::type > m_list
Definition: Livecache.h:170
+
ripple::PeerFinder::Livecache::hops_t::const_iterator
boost::transform_iterator< Transform< true >, typename lists_type::const_iterator > const_iterator
Definition: Livecache.h:258
+
ripple::PeerFinder::detail::LivecacheBase::Hop::m_list
std::reference_wrapper< typename beast::maybe_const< IsConst, list_type >::type > m_list
Definition: Livecache.h:165
ripple::default_prng
beast::xor_shift_engine & default_prng()
Return the default random engine.
Definition: ripple/basics/random.h:65
ripple::PeerFinder::Endpoint::hops
std::uint32_t hops
Definition: PeerfinderManager.h:119
ripple::PeerFinder::Livecache
The Livecache holds the short-lived relayed Endpoint messages.
Definition: Livecache.h:39
std::copy
T copy(T... args)
-
beast::detail::aged_ordered_container::erase
beast::detail::aged_container_iterator< false, Iterator > erase(beast::detail::aged_container_iterator< is_const, Iterator > pos)
Definition: aged_ordered_container.h:2027
+
beast::detail::aged_ordered_container::erase
beast::detail::aged_container_iterator< false, Iterator > erase(beast::detail::aged_container_iterator< is_const, Iterator > pos)
Definition: aged_ordered_container.h:1994
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
std::uint32_t
-
ripple::PeerFinder::Livecache::hops_t::end
const_iterator end() const
Definition: Livecache.h:304
-
ripple::PeerFinder::Livecache::allocator_type
Allocator allocator_type
Definition: Livecache.h:214
+
ripple::PeerFinder::Livecache::hops_t::end
const_iterator end() const
Definition: Livecache.h:293
+
ripple::PeerFinder::Livecache::allocator_type
Allocator allocator_type
Definition: Livecache.h:209
beast::abstract_clock< std::chrono::steady_clock >
-
std::unary_function
-
ripple::PeerFinder::detail::LivecacheBase::Hop::crend
reverse_iterator crend() const
Definition: Livecache.h:145
+
ripple::PeerFinder::detail::LivecacheBase::Hop::crend
reverse_iterator crend() const
Definition: Livecache.h:140
std::array::rend
T rend(T... args)
ripple::PeerFinder::Livecache::hops
class ripple::PeerFinder::Livecache::hops_t hops
beast::maybe_const
Makes T const or non const depending on a bool.
Definition: maybe_const.h:29
ripple::PeerFinder::detail::LivecacheBase::Hop::Transform::Transform
Transform()=default
beast::leftw
Left justifies a field at the specified width.
Definition: iosformat.h:33
-
ripple::PeerFinder::Livecache::hops_t::begin
const_iterator begin() const
Definition: Livecache.h:286
+
ripple::PeerFinder::Livecache::hops_t::begin
const_iterator begin() const
Definition: Livecache.h:275
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
-
beast::detail::aged_ordered_container::size
size_type size() const noexcept
Definition: aged_ordered_container.h:847
-
ripple::PeerFinder::Livecache::hops_t::end
iterator end()
Definition: Livecache.h:298
-
ripple::PeerFinder::Livecache::hops_t::hops_t
hops_t(Allocator const &alloc)
Definition: Livecache.h:535
-
ripple::PeerFinder::Livecache::hops_t::cbegin
const_iterator cbegin() const
Definition: Livecache.h:292
+
beast::detail::aged_ordered_container::size
size_type size() const noexcept
Definition: aged_ordered_container.h:814
+
ripple::PeerFinder::Livecache::hops_t::end
iterator end()
Definition: Livecache.h:287
+
ripple::PeerFinder::Livecache::hops_t::hops_t
hops_t(Allocator const &alloc)
Definition: Livecache.h:524
+
ripple::PeerFinder::Livecache::hops_t::cbegin
const_iterator cbegin() const
Definition: Livecache.h:281
ripple::PeerFinder::detail::LivecacheBase::Element::endpoint
Endpoint endpoint
Definition: Livecache.h:55
beast::detail::aged_ordered_container
Associative container where each element is also indexed by time.
Definition: aged_ordered_container.h:82
beast::maybe_const::type
typename std::conditional< IsConst, typename std::remove_const< T >::type const, typename std::remove_const< T >::type >::type type
Definition: maybe_const.h:35
beast::detail::aged_ordered_container::chronological
class beast::detail::aged_ordered_container::chronological_t chronological
-
ripple::PeerFinder::detail::LivecacheBase::Hop::Hop
Hop(typename beast::maybe_const< IsConst, list_type >::type &list)
Definition: Livecache.h:160
+
ripple::PeerFinder::detail::LivecacheBase::Hop::Hop
Hop(typename beast::maybe_const< IsConst, list_type >::type &list)
Definition: Livecache.h:155
std::array::begin
T begin(T... args)
-
ripple::PeerFinder::Livecache::cache_type
beast::aged_map< beast::IP::Endpoint, Element, std::chrono::steady_clock, std::less< beast::IP::Endpoint >, Allocator > cache_type
Definition: Livecache.h:208
-
std
STL namespace.
-
ripple::PeerFinder::Livecache::expire
void expire()
Erase entries whose time has expired.
Definition: Livecache.h:416
-
ripple::PeerFinder::detail::LivecacheBase::Hop::Transform::operator()
Endpoint const & operator()(Element const &e) const
Definition: Livecache.h:84
-
ripple::PeerFinder::Livecache::hops_t::cend
const_iterator cend() const
Definition: Livecache.h:310
-
beast::detail::aged_ordered_container::touch
void touch(beast::detail::aged_container_iterator< is_const, Iterator > pos)
Definition: aged_ordered_container.h:1022
-
ripple::PeerFinder::Livecache::empty
bool empty() const
Returns true if the cache is empty.
Definition: Livecache.h:378
+
ripple::PeerFinder::Livecache::cache_type
beast::aged_map< beast::IP::Endpoint, Element, std::chrono::steady_clock, std::less< beast::IP::Endpoint >, Allocator > cache_type
Definition: Livecache.h:203
+
ripple::PeerFinder::Livecache::expire
void expire()
Erase entries whose time has expired.
Definition: Livecache.h:405
+
ripple::PeerFinder::detail::LivecacheBase::Hop::Transform::operator()
Endpoint const & operator()(Element const &e) const
Definition: Livecache.h:79
+
ripple::PeerFinder::Livecache::hops_t::cend
const_iterator cend() const
Definition: Livecache.h:299
+
beast::detail::aged_ordered_container::touch
void touch(beast::detail::aged_container_iterator< is_const, Iterator > pos)
Definition: aged_ordered_container.h:989
+
ripple::PeerFinder::Livecache::empty
bool empty() const
Returns true if the cache is empty.
Definition: Livecache.h:367
std::string::empty
T empty(T... args)
std::stringstream::str
T str(T... args)
beast::Journal::debug
Stream debug() const
Definition: Journal.h:315
std::size_t
beast::IP::Endpoint
A version-independent IP address and port combination.
Definition: IPEndpoint.h:38
-
ripple::PeerFinder::Livecache::hops_t::reinsert
void reinsert(Element &e, std::uint32_t hops)
Definition: Livecache.h:552
+
ripple::PeerFinder::Livecache::hops_t::reinsert
void reinsert(Element &e, std::uint32_t hops)
Definition: Livecache.h:541
std::array::end
T end(T... args)
ripple::PeerFinder::Tuning::maxHops
constexpr std::uint32_t maxHops
Definition: peerfinder/impl/Tuning.h:110
-
ripple::PeerFinder::Livecache::hops_t::const_reverse_iterator
boost::transform_iterator< Transform< true >, typename lists_type::const_reverse_iterator > const_reverse_iterator
Definition: Livecache.h:277
-
beast::detail::aged_ordered_container::cbegin
const_iterator cbegin() const
Definition: aged_ordered_container.h:755
+
ripple::PeerFinder::Livecache::hops_t::const_reverse_iterator
boost::transform_iterator< Transform< true >, typename lists_type::const_reverse_iterator > const_reverse_iterator
Definition: Livecache.h:266
+
beast::detail::aged_ordered_container::cbegin
const_iterator cbegin() const
Definition: aged_ordered_container.h:722
ripple::PeerFinder::Endpoint
Describes a connectible peer address along with some metadata.
Definition: PeerfinderManager.h:113
-
ripple::PeerFinder::detail::LivecacheBase::Hop::const_reverse_iterator
reverse_iterator const_reverse_iterator
Definition: Livecache.h:100
+
ripple::PeerFinder::detail::LivecacheBase::Hop::const_reverse_iterator
reverse_iterator const_reverse_iterator
Definition: Livecache.h:95
std::shuffle
T shuffle(T... args)
-
ripple::PeerFinder::Livecache::hops_t::rend
reverse_iterator rend()
Definition: Livecache.h:334
+
ripple::PeerFinder::Livecache::hops_t::rend
reverse_iterator rend()
Definition: Livecache.h:323
ripple::PeerFinder::Endpoint::address
beast::IP::Endpoint address
Definition: PeerfinderManager.h:120
-
ripple::PeerFinder::detail::LivecacheBase::make_hop
static Hop< IsConst > make_hop(typename beast::maybe_const< IsConst, list_type >::type &list)
Definition: Livecache.h:177
-
ripple::PeerFinder::detail::LivecacheBase::Hop::crbegin
reverse_iterator crbegin() const
Definition: Livecache.h:133
+
ripple::PeerFinder::detail::LivecacheBase::make_hop
static Hop< IsConst > make_hop(typename beast::maybe_const< IsConst, list_type >::type &list)
Definition: Livecache.h:172
+
ripple::PeerFinder::detail::LivecacheBase::Hop::crbegin
reverse_iterator crbegin() const
Definition: Livecache.h:128
std::array::rbegin
T rbegin(T... args)
beast::detail::aged_ordered_container::size_type
std::size_t size_type
Definition: aged_ordered_container.h:92
-
ripple::PeerFinder::Livecache::hops_t::Transform::first_argument
typename lists_type::value_type first_argument
Definition: Livecache.h:248
-
ripple::PeerFinder::Livecache::hops_t::begin
iterator begin()
Definition: Livecache.h:280
+
ripple::PeerFinder::Livecache::hops_t::Transform::first_argument
typename lists_type::value_type first_argument
Definition: Livecache.h:238
+
ripple::PeerFinder::Livecache::hops_t::begin
iterator begin()
Definition: Livecache.h:269