github.com/Synthesix/Sia@v1.3.3-0.20180413141344-f863baeed3ca/modules/renter/consts.go (about) 1 package renter 2 3 import ( 4 "time" 5 6 "github.com/Synthesix/Sia/build" 7 "github.com/Synthesix/Sia/crypto" 8 "github.com/Synthesix/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 // defaultFilePerm defines the default permissions used for a new file if no 57 // permissions are supplied. 58 defaultFilePerm = 0666 59 60 // downloadFailureCooldown defines how long to wait for a worker after a 61 // worker has experienced a download failure. 62 downloadFailureCooldown = time.Second * 3 63 64 // memoryPriorityLow is used to request low priority memory 65 memoryPriorityLow = false 66 67 // memoryPriorityHigh is used to request high priority memory 68 memoryPriorityHigh = true 69 70 // destinationTypeSeekStream is the destination type used for downloads 71 // from the /renter/stream endpoint. 72 destinationTypeSeekStream = "httpseekstream" 73 74 // downloadCacheSize is the cache size of the /renter/stream cache in 75 // chunks. 76 downloadCacheSize = 2 77 ) 78 79 var ( 80 // chunkDownloadTimeout defines the maximum amount of time to wait for a 81 // chunk download to finish before returning in the download-to-upload repair 82 // loop 83 chunkDownloadTimeout = build.Select(build.Var{ 84 Dev: 15 * time.Minute, 85 Standard: 15 * time.Minute, 86 Testing: 1 * time.Minute, 87 }).(time.Duration) 88 89 // maxConsecutivePenalty determines how many times the timeout/cooldown for 90 // being a bad host can be doubled before a maximum cooldown is reached. 91 maxConsecutivePenalty = build.Select(build.Var{ 92 Dev: 4, 93 Standard: 10, 94 Testing: 3, 95 }).(int) 96 97 // maxScheduledDownloads specifies the number of chunks that can be downloaded 98 // for auto repair at once. If the limit is reached new ones will only be scheduled 99 // once old ones are scheduled for upload 100 maxScheduledDownloads = build.Select(build.Var{ 101 Dev: 5, 102 Standard: 10, 103 Testing: 5, 104 }).(int) 105 106 // offlineCheckFrequency is how long the renter will wait to check the 107 // online status if it is offline. 108 offlineCheckFrequency = build.Select(build.Var{ 109 Dev: 3 * time.Second, 110 Standard: 10 * time.Second, 111 Testing: 250 * time.Millisecond, 112 }).(time.Duration) 113 114 // rebuildChunkHeapInterval defines how long the renter sleeps between 115 // checking on the filesystem health. 116 rebuildChunkHeapInterval = build.Select(build.Var{ 117 Dev: 90 * time.Second, 118 Standard: 15 * time.Minute, 119 Testing: 3 * time.Second, 120 }).(time.Duration) 121 122 // RemoteRepairDownloadThreshold defines the threshold in percent under 123 // which the renter starts repairing a file that is not available on disk. 124 RemoteRepairDownloadThreshold = build.Select(build.Var{ 125 Dev: 0.25, 126 Standard: 0.25, 127 Testing: 0.25, 128 }).(float64) 129 130 // Prime to avoid intersecting with regular events. 131 uploadFailureCooldown = build.Select(build.Var{ 132 Dev: time.Second * 7, 133 Standard: time.Second * 61, 134 Testing: time.Second, 135 }).(time.Duration) 136 137 // workerPoolUpdateTimeout is the amount of time that can pass before the 138 // worker pool should be updated. 139 workerPoolUpdateTimeout = build.Select(build.Var{ 140 Dev: 30 * time.Second, 141 Standard: 5 * time.Minute, 142 Testing: 3 * time.Second, 143 }).(time.Duration) 144 )