github.com/NebulousLabs/Sia@v1.3.7/modules/renter/consts.go (about) 1 package renter 2 3 import ( 4 "time" 5 6 "github.com/NebulousLabs/Sia/build" 7 "github.com/NebulousLabs/Sia/crypto" 8 "github.com/NebulousLabs/Sia/modules" 9 ) 10 11 var ( 12 // defaultMemory establishes the default amount of memory that the renter 13 // will use when performing uploads and downloads. The mapping is currently 14 // not perfect due to GC overhead and other places where we don't count all 15 // of the memory usage accurately. 16 defaultMemory = build.Select(build.Var{ 17 Dev: uint64(1 << 28), // 256 MiB 18 Standard: uint64(3 * 1 << 28), // 768 MiB 19 Testing: uint64(1 << 17), // 128 KiB - 4 KiB sector size, need to test memory exhaustion 20 }).(uint64) 21 ) 22 23 var ( 24 // defaultDataPieces is the number of data pieces per erasure-coded chunk 25 defaultDataPieces = func() int { 26 switch build.Release { 27 case "dev": 28 return 1 29 case "standard": 30 return 10 31 case "testing": 32 return 1 33 } 34 panic("undefined defaultDataPieces") 35 }() 36 37 // defaultParityPieces is the number of parity pieces per erasure-coded 38 // chunk 39 defaultParityPieces = func() int { 40 switch build.Release { 41 case "dev": 42 return 1 43 case "standard": 44 return 20 45 case "testing": 46 return 8 47 } 48 panic("undefined defaultParityPieces") 49 }() 50 51 // Erasure-coded piece size 52 pieceSize = modules.SectorSize - crypto.TwofishOverhead 53 ) 54 55 const ( 56 // persistVersion defines the Sia version that the persistence was 57 // last updated 58 persistVersion = "1.3.3" 59 60 // defaultFilePerm defines the default permissions used for a new file if no 61 // permissions are supplied. 62 defaultFilePerm = 0666 63 64 // downloadFailureCooldown defines how long to wait for a worker after a 65 // worker has experienced a download failure. 66 downloadFailureCooldown = time.Second * 3 67 68 // memoryPriorityLow is used to request low priority memory 69 memoryPriorityLow = false 70 71 // memoryPriorityHigh is used to request high priority memory 72 memoryPriorityHigh = true 73 74 // destinationTypeSeekStream is the destination type used for downloads 75 // from the /renter/stream endpoint. 76 destinationTypeSeekStream = "httpseekstream" 77 78 // DefaultStreamCacheSize is the default cache size of the /renter/stream cache in 79 // chunks, the user can set a custom cache size through the API 80 DefaultStreamCacheSize = 2 81 82 // DefaultMaxDownloadSpeed is set to zero to indicate no limit, the user 83 // can set a custom MaxDownloadSpeed through the API 84 DefaultMaxDownloadSpeed = 0 85 86 // DefaultMaxUploadSpeed is set to zero to indicate no limit, the user 87 // can set a custom MaxUploadSpeed through the API 88 DefaultMaxUploadSpeed = 0 89 ) 90 91 var ( 92 // chunkDownloadTimeout defines the maximum amount of time to wait for a 93 // chunk download to finish before returning in the download-to-upload repair 94 // loop 95 chunkDownloadTimeout = build.Select(build.Var{ 96 Dev: 15 * time.Minute, 97 Standard: 15 * time.Minute, 98 Testing: 1 * time.Minute, 99 }).(time.Duration) 100 101 // maxConsecutivePenalty determines how many times the timeout/cooldown for 102 // being a bad host can be doubled before a maximum cooldown is reached. 103 maxConsecutivePenalty = build.Select(build.Var{ 104 Dev: 4, 105 Standard: 10, 106 Testing: 3, 107 }).(int) 108 109 // maxScheduledDownloads specifies the number of chunks that can be downloaded 110 // for auto repair at once. If the limit is reached new ones will only be scheduled 111 // once old ones are scheduled for upload 112 maxScheduledDownloads = build.Select(build.Var{ 113 Dev: 5, 114 Standard: 10, 115 Testing: 5, 116 }).(int) 117 118 // offlineCheckFrequency is how long the renter will wait to check the 119 // online status if it is offline. 120 offlineCheckFrequency = build.Select(build.Var{ 121 Dev: 3 * time.Second, 122 Standard: 10 * time.Second, 123 Testing: 250 * time.Millisecond, 124 }).(time.Duration) 125 126 // rebuildChunkHeapInterval defines how long the renter sleeps between 127 // checking on the filesystem health. 128 rebuildChunkHeapInterval = build.Select(build.Var{ 129 Dev: 90 * time.Second, 130 Standard: 15 * time.Minute, 131 Testing: 3 * time.Second, 132 }).(time.Duration) 133 134 // RemoteRepairDownloadThreshold defines the threshold in percent under 135 // which the renter starts repairing a file that is not available on disk. 136 RemoteRepairDownloadThreshold = build.Select(build.Var{ 137 Dev: 0.25, 138 Standard: 0.25, 139 Testing: 0.25, 140 }).(float64) 141 142 // Prime to avoid intersecting with regular events. 143 uploadFailureCooldown = build.Select(build.Var{ 144 Dev: time.Second * 7, 145 Standard: time.Second * 61, 146 Testing: time.Second, 147 }).(time.Duration) 148 149 // workerPoolUpdateTimeout is the amount of time that can pass before the 150 // worker pool should be updated. 151 workerPoolUpdateTimeout = build.Select(build.Var{ 152 Dev: 30 * time.Second, 153 Standard: 5 * time.Minute, 154 Testing: 3 * time.Second, 155 }).(time.Duration) 156 )