rippled
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Public Attributes | Protected Types | Static Protected Member Functions | Private Types | Private Attributes | List of all members
ripple::PeerFinder::Livecache< Allocator > Class Template Reference

The Livecache holds the short-lived relayed Endpoint messages. More...

#include <Livecache.h>

Inheritance diagram for ripple::PeerFinder::Livecache< Allocator >:
Inheritance graph
[legend]
Collaboration diagram for ripple::PeerFinder::Livecache< Allocator >:
Collaboration graph
[legend]

Classes

class  hops_t
 

Public Types

using allocator_type = Allocator
 

Public Member Functions

 Livecache (clock_type &clock, beast::Journal journal, Allocator alloc=Allocator())
 Create the cache. More...
 
bool empty () const
 Returns true if the cache is empty. More...
 
cache_type::size_type size () const
 Returns the number of entries in the cache. More...
 
void expire ()
 Erase entries whose time has expired. More...
 
void insert (Endpoint const &ep)
 Creates or updates an existing Element based on a new message. More...
 
void onWrite (beast::PropertyStream::Map &map)
 Output statistics. More...
 

Public Attributes

class ripple::PeerFinder::Livecache::hops_t hops
 

Protected Types

using list_type = boost::intrusive::make_list< Element, boost::intrusive::constant_time_size< false > >::type
 

Static Protected Member Functions

template<bool IsConst>
static Hop< IsConst > make_hop (typename beast::maybe_const< IsConst, list_type >::type &list)
 

Private Types

using cache_type = beast::aged_map< beast::IP::Endpoint, Element, std::chrono::steady_clock, std::less< beast::IP::Endpoint >, Allocator >
 

Private Attributes

beast::Journal m_journal
 
cache_type m_cache
 

Detailed Description

template<class Allocator = std::allocator<char>>
class ripple::PeerFinder::Livecache< Allocator >

The Livecache holds the short-lived relayed Endpoint messages.

Since peers only advertise themselves when they have open slots, we want these messags to expire rather quickly after the peer becomes full.

Addresses added to the cache are not connection-tested to see if they are connectible (with one small exception regarding neighbors). Therefore, these addresses are not suitable for persisting across launches or for bootstrapping, because they do not have verifiable and locally observed uptime and connectibility information.

Definition at line 197 of file Livecache.h.

Member Typedef Documentation

◆ cache_type

template<class Allocator = std::allocator<char>>
using ripple::PeerFinder::Livecache< Allocator >::cache_type = beast::aged_map< beast::IP::Endpoint, Element, std::chrono::steady_clock, std::less<beast::IP::Endpoint>, Allocator>
private

Definition at line 200 of file Livecache.h.

◆ allocator_type

template<class Allocator = std::allocator<char>>
using ripple::PeerFinder::Livecache< Allocator >::allocator_type = Allocator

Definition at line 211 of file Livecache.h.

◆ list_type

using ripple::PeerFinder::detail::LivecacheBase::list_type = boost::intrusive:: make_list<Element, boost::intrusive::constant_time_size<false> >::type
protectedinherited

Definition at line 60 of file Livecache.h.

Constructor & Destructor Documentation

◆ Livecache()

template<class Allocator >
ripple::PeerFinder::Livecache< Allocator >::Livecache ( clock_type clock,
beast::Journal  journal,
Allocator  alloc = Allocator() 
)

Create the cache.

Definition at line 397 of file Livecache.h.

Member Function Documentation

◆ empty()

template<class Allocator = std::allocator<char>>
bool ripple::PeerFinder::Livecache< Allocator >::empty ( ) const

Returns true if the cache is empty.

Definition at line 369 of file Livecache.h.

◆ size()

template<class Allocator = std::allocator<char>>
cache_type::size_type ripple::PeerFinder::Livecache< Allocator >::size ( ) const

Returns the number of entries in the cache.

Definition at line 376 of file Livecache.h.

◆ expire()

template<class Allocator >
void ripple::PeerFinder::Livecache< Allocator >::expire

Erase entries whose time has expired.

Definition at line 407 of file Livecache.h.

◆ insert()

template<class Allocator >
void ripple::PeerFinder::Livecache< Allocator >::insert ( Endpoint const &  ep)

Creates or updates an existing Element based on a new message.

Definition at line 429 of file Livecache.h.

◆ onWrite()

template<class Allocator >
void ripple::PeerFinder::Livecache< Allocator >::onWrite ( beast::PropertyStream::Map map)

Output statistics.

Definition at line 476 of file Livecache.h.

◆ make_hop()

template<bool IsConst>
static Hop< IsConst > ripple::PeerFinder::detail::LivecacheBase::make_hop ( typename beast::maybe_const< IsConst, list_type >::type &  list)
staticprotectedinherited

Definition at line 174 of file Livecache.h.

Member Data Documentation

◆ m_journal

template<class Allocator = std::allocator<char>>
beast::Journal ripple::PeerFinder::Livecache< Allocator >::m_journal
private

Definition at line 207 of file Livecache.h.

◆ m_cache

template<class Allocator = std::allocator<char>>
cache_type ripple::PeerFinder::Livecache< Allocator >::m_cache
private

Definition at line 208 of file Livecache.h.

◆ hops

template<class Allocator = std::allocator<char>>
class ripple::PeerFinder::Livecache::hops_t ripple::PeerFinder::Livecache< Allocator >::hops