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 enum {
110  // Drop incoming messages with hops greater than this number
112 
113  // How many Endpoint to send in each mtENDPOINTS
114  ,
116 
117  // The most Endpoint we will accept in mtENDPOINTS
118  ,
120 
121  // The number of peers that we want by default, unless an
122  // explicit value is set in the config file.
123  ,
125 
127  ,
129 };
130 
131 // How often we send or accept mtENDPOINTS messages per peer
132 // (we use a prime number of purpose)
133 static std::chrono::seconds const secondsPerMessage(61);
134 
135 // How long an Endpoint will stay in the cache
136 // This should be a small multiple of the broadcast frequency
138 
139 //
140 //
141 //
142 
143 // How much time to wait before trying an outgoing address again.
144 // Note that we ignore the port for purposes of comparison.
146 
147 } // namespace Tuning
150 } // namespace PeerFinder
151 } // namespace ripple
152 
153 #endif
ripple::PeerFinder::Tuning::liveCacheSecondsToLive
static const std::chrono::seconds liveCacheSecondsToLive(30)
ripple::PeerFinder::Tuning::bootcacheCooldownTime
static const std::chrono::seconds bootcacheCooldownTime(60)
ripple::PeerFinder::Tuning::outPercent
@ outPercent
Definition: peerfinder/impl/Tuning.h:52
std::chrono::seconds
ripple::PeerFinder::Tuning::secondsPerConnect
@ secondsPerConnect
Time to wait between making batches of connection attempts.
Definition: peerfinder/impl/Tuning.h:40
ripple::PeerFinder::Tuning::minOutCount
@ minOutCount
Definition: peerfinder/impl/Tuning.h:59
ripple::PeerFinder::Tuning::connectionBackoff
static const std::array< int, 10 > connectionBackoff
Definition: peerfinder/impl/Tuning.h:79
ripple::PeerFinder::Tuning::bootcacheSize
@ bootcacheSize
Definition: peerfinder/impl/Tuning.h:90
ripple::PeerFinder::Tuning::maxRedirects
@ maxRedirects
Definition: peerfinder/impl/Tuning.h:70
ripple::PeerFinder::Tuning::recentAttemptDuration
static const std::chrono::seconds recentAttemptDuration(60)
ripple::PeerFinder::Tuning::maxConnectAttempts
@ maxConnectAttempts
Definition: peerfinder/impl/Tuning.h:44
array
ripple::PeerFinder::Tuning::defaultMaxPeerCount
@ defaultMaxPeerCount
Definition: peerfinder/impl/Tuning.h:124
ripple::PeerFinder::Tuning::redirectEndpointCount
@ redirectEndpointCount
Definition: peerfinder/impl/Tuning.h:128
ripple::PeerFinder::Tuning::numberOfEndpoints
@ numberOfEndpoints
Definition: peerfinder/impl/Tuning.h:115
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::secondsPerMessage
static const std::chrono::seconds secondsPerMessage(61)
ripple::PeerFinder::Tuning::defaultMaxPeers
@ defaultMaxPeers
Definition: peerfinder/impl/Tuning.h:63
ripple::PeerFinder::Tuning::numberOfEndpointsMax
@ numberOfEndpointsMax
Definition: peerfinder/impl/Tuning.h:119
ripple::PeerFinder::Tuning::maxHops
@ maxHops
Definition: peerfinder/impl/Tuning.h:111