github.com/nebulouslabs/sia@v1.3.7/modules/renter/hostdb/consts.go (about) 1 package hostdb 2 3 import ( 4 "time" 5 6 "github.com/NebulousLabs/Sia/build" 7 ) 8 9 const ( 10 // historicInteractionDecay defines the decay of the HistoricSuccessfulInteractions 11 // and HistoricFailedInteractions after every block for a host entry. 12 historicInteractionDecay = 0.9995 13 14 // historicInteractionDecalLimit defines the number of historic 15 // interactions required before decay is applied. 16 historicInteractionDecayLimit = 500 17 18 // hostRequestTimeout indicates how long a host has to respond to a dial. 19 hostRequestTimeout = 2 * time.Minute 20 21 // hostScanDeadline indicates how long a host has to complete an entire 22 // scan. 23 hostScanDeadline = 4 * time.Minute 24 25 // maxHostDowntime specifies the maximum amount of time that a host is 26 // allowed to be offline while still being in the hostdb. 27 maxHostDowntime = 10 * 24 * time.Hour 28 29 // maxSettingsLen indicates how long in bytes the host settings field is 30 // allowed to be before being ignored as a DoS attempt. 31 maxSettingsLen = 10e3 32 33 // minScans specifies the number of scans that a host should have before the 34 // scans start getting compressed. 35 minScans = 12 36 37 // minScansForSpeedup is the number of successful scan that needs to be 38 // completed before the dial up timeout for scans is reduced. This ensures 39 // that we have a sufficient sample size of scans for estimating the worst 40 // case timeout. 41 minScansForSpeedup = 25 42 43 // scanSpeedupMedianMultiplier is the number with which the median of the 44 // initial scans is multiplied to speedup the intial scan after 45 // minScansForSpeedup successful scans. 46 scanSpeedupMedianMultiplier = 5 47 48 // recentInteractionWeightLimit caps the number of recent interactions as a 49 // percentage of the historic interactions, to be certain that a large 50 // amount of activity in a short period of time does not overwhelm the 51 // score for a host. 52 // 53 // Non-stop heavy interactions for half a day can result in gaining more 54 // than half the total weight at this limit. 55 recentInteractionWeightLimit = 0.01 56 57 // saveFrequency defines how frequently the hostdb will save to disk. Hostdb 58 // will also save immediately prior to shutdown. 59 saveFrequency = 2 * time.Minute 60 61 // scanCheckInterval is the interval used when waiting for the scanList to 62 // empty itself and for waiting on the consensus set to be synced. 63 scanCheckInterval = time.Second 64 ) 65 66 var ( 67 // hostCheckupQuantity specifies the number of hosts that get scanned every 68 // time there is a regular scanning operation. 69 hostCheckupQuantity = build.Select(build.Var{ 70 Standard: int(2500), 71 Dev: int(6), 72 Testing: int(5), 73 }).(int) 74 75 // scanningThreads is the number of threads that will be probing hosts for 76 // their settings and checking for reliability. 77 maxScanningThreads = build.Select(build.Var{ 78 Standard: int(80), 79 Dev: int(4), 80 Testing: int(3), 81 }).(int) 82 ) 83 84 var ( 85 // maxScanSleep is the maximum amount of time that the hostdb will sleep 86 // between performing scans of the hosts. 87 maxScanSleep = build.Select(build.Var{ 88 Standard: time.Hour * 8, 89 Dev: time.Minute * 10, 90 Testing: time.Second * 5, 91 }).(time.Duration) 92 93 // minScanSleep is the minimum amount of time that the hostdb will sleep 94 // between performing scans of the hosts. 95 minScanSleep = build.Select(build.Var{ 96 Standard: time.Hour + time.Minute*20, 97 Dev: time.Minute * 3, 98 Testing: time.Second * 1, 99 }).(time.Duration) 100 )