gitlab.com/jokerrs1/Sia@v1.3.2/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 // recentInteractionWeightLimit caps the number of recent interactions as a 38 // percentage of the historic interactions, to be certain that a large 39 // amount of activity in a short period of time does not overwhelm the 40 // score for a host. 41 // 42 // Non-stop heavy interactions for half a day can result in gaining more 43 // than half the total weight at this limit. 44 recentInteractionWeightLimit = 0.01 45 46 // saveFrequency defines how frequently the hostdb will save to disk. Hostdb 47 // will also save immediately prior to shutdown. 48 saveFrequency = 2 * time.Minute 49 ) 50 51 var ( 52 // hostCheckupQuantity specifies the number of hosts that get scanned every 53 // time there is a regular scanning operation. 54 hostCheckupQuantity = build.Select(build.Var{ 55 Standard: int(2500), 56 Dev: int(6), 57 Testing: int(5), 58 }).(int) 59 60 // scanningThreads is the number of threads that will be probing hosts for 61 // their settings and checking for reliability. 62 maxScanningThreads = build.Select(build.Var{ 63 Standard: int(80), 64 Dev: int(4), 65 Testing: int(3), 66 }).(int) 67 ) 68 69 var ( 70 // maxScanSleep is the maximum amount of time that the hostdb will sleep 71 // between performing scans of the hosts. 72 maxScanSleep = build.Select(build.Var{ 73 Standard: time.Hour * 8, 74 Dev: time.Minute * 10, 75 Testing: time.Second * 5, 76 }).(time.Duration) 77 78 // minScanSleep is the minimum amount of time that the hostdb will sleep 79 // between performing scans of the hosts. 80 minScanSleep = build.Select(build.Var{ 81 Standard: time.Hour + time.Minute*20, 82 Dev: time.Minute * 3, 83 Testing: time.Second * 1, 84 }).(time.Duration) 85 )