rippled
peerfinder/impl/Tuning.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #ifndef RIPPLE_PEERFINDER_TUNING_H_INCLUDED
21 #define RIPPLE_PEERFINDER_TUNING_H_INCLUDED
22 
23 #include <array>
24 
25 namespace ripple {
26 namespace PeerFinder {
27 
30 namespace Tuning {
31 
32 enum {
33  //---------------------------------------------------------
34  //
35  // Automatic Connection Policy
36  //
37  //---------------------------------------------------------
38 
41 
43  ,
45 
51  ,
53 
58  ,
60 
62  ,
64 
69  ,
71 };
72 
73 //------------------------------------------------------------------------------
74 //
75 // Fixed
76 //
77 //------------------------------------------------------------------------------
78 
80  {1, 1, 2, 3, 5, 8, 13, 21, 34, 55}};
81 
82 //------------------------------------------------------------------------------
83 //
84 // Bootcache
85 //
86 //------------------------------------------------------------------------------
87 
88 enum {
89  // Threshold of cache entries above which we trim.
91 
92  // The percentage of addresses we prune when we trim the cache.
93  ,
95 };
96 
97 // The cool down wait between database updates
98 // Ideally this should be larger than the time it takes a full
99 // peer to send us a set of addresses and then disconnect.
100 //
102 
103 //------------------------------------------------------------------------------
104 //
105 // Livecache
106 //
107 //------------------------------------------------------------------------------
108 
109 // Drop incoming messages with hops greater than this number
110 std::uint32_t constexpr maxHops = 6;
111 
112 // How many Endpoint to send in each mtENDPOINTS
114 
115 // The most Endpoint we will accept in mtENDPOINTS
117  std::max<decltype(numberOfEndpoints)>(numberOfEndpoints * 2, 64);
118 
119 // Number of addresses we provide when redirecting.
121 
122 // How often we send or accept mtENDPOINTS messages per peer
123 // (we use a prime number of purpose)
125 
126 // How long an Endpoint will stay in the cache
127 // This should be a small multiple of the broadcast frequency
129 
130 // How much time to wait before trying an outgoing address again.
131 // Note that we ignore the port for purposes of comparison.
133 
134 } // namespace Tuning
137 } // namespace PeerFinder
138 } // namespace ripple
139 
140 #endif
ripple::PeerFinder::Tuning::redirectEndpointCount
constexpr std::uint32_t redirectEndpointCount
Definition: peerfinder/impl/Tuning.h:120
ripple::PeerFinder::Tuning::defaultMaxPeers
@ defaultMaxPeers
Definition: peerfinder/impl/Tuning.h:63
ripple::PeerFinder::Tuning::bootcacheCooldownTime
static const std::chrono::seconds bootcacheCooldownTime(60)
ripple::PeerFinder::Tuning::maxRedirects
@ maxRedirects
Definition: peerfinder/impl/Tuning.h:70
ripple::PeerFinder::Tuning::bootcacheSize
@ bootcacheSize
Definition: peerfinder/impl/Tuning.h:90
ripple::PeerFinder::Tuning::secondsPerMessage
constexpr std::chrono::seconds secondsPerMessage(151)
std::chrono::seconds
ripple::PeerFinder::Tuning::numberOfEndpointsMax
constexpr std::uint32_t numberOfEndpointsMax
Definition: peerfinder/impl/Tuning.h:116
ripple::PeerFinder::Tuning::liveCacheSecondsToLive
constexpr std::chrono::seconds liveCacheSecondsToLive(30)
ripple::PeerFinder::Tuning::maxConnectAttempts
@ maxConnectAttempts
Definition: peerfinder/impl/Tuning.h:44
ripple::PeerFinder::Tuning::connectionBackoff
static const std::array< int, 10 > connectionBackoff
Definition: peerfinder/impl/Tuning.h:79
array
ripple::PeerFinder::Tuning::outPercent
@ outPercent
Definition: peerfinder/impl/Tuning.h:52
std::uint32_t
ripple::PeerFinder::Tuning::recentAttemptDuration
constexpr std::chrono::seconds recentAttemptDuration(60)
ripple::PeerFinder::Tuning::minOutCount
@ minOutCount
Definition: peerfinder/impl/Tuning.h:59
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::PeerFinder::Tuning::bootcachePrunePercent
@ bootcachePrunePercent
Definition: peerfinder/impl/Tuning.h:94
ripple::PeerFinder::Tuning::secondsPerConnect
@ secondsPerConnect
Time to wait between making batches of connection attempts.
Definition: peerfinder/impl/Tuning.h:40
ripple::PeerFinder::Tuning::maxHops
constexpr std::uint32_t maxHops
Definition: peerfinder/impl/Tuning.h:110
ripple::PeerFinder::Tuning::numberOfEndpoints
constexpr std::uint32_t numberOfEndpoints
Definition: peerfinder/impl/Tuning.h:113