@@ -224,17 +224,18 @@ type HostOption struct {
224224}
225225
226226type DownloadOption struct {
227- DefaultPattern string `mapstructure:"defaultPattern" yaml:"defaultPattern"`
228- TotalRateLimit util.RateLimit `mapstructure:"totalRateLimit" yaml:"totalRateLimit"`
229- PerPeerRateLimit util.RateLimit `mapstructure:"perPeerRateLimit" yaml:"perPeerRateLimit"`
230- PieceDownloadTimeout time.Duration `mapstructure:"pieceDownloadTimeout" yaml:"pieceDownloadTimeout"`
231- DownloadGRPC ListenOption `mapstructure:"downloadGRPC" yaml:"downloadGRPC"`
232- PeerGRPC ListenOption `mapstructure:"peerGRPC" yaml:"peerGRPC"`
233- CalculateDigest bool `mapstructure:"calculateDigest" yaml:"calculateDigest"`
234- TransportOption * TransportOption `mapstructure:"transportOption" yaml:"transportOption"`
235- GetPiecesMaxRetry int `mapstructure:"getPiecesMaxRetry" yaml:"getPiecesMaxRetry"`
236- Prefetch bool `mapstructure:"prefetch" yaml:"prefetch"`
237- WatchdogTimeout time.Duration `mapstructure:"watchdogTimeout" yaml:"watchdogTimeout"`
227+ DefaultPattern string `mapstructure:"defaultPattern" yaml:"defaultPattern"`
228+ TotalRateLimit util.RateLimit `mapstructure:"totalRateLimit" yaml:"totalRateLimit"`
229+ PerPeerRateLimit util.RateLimit `mapstructure:"perPeerRateLimit" yaml:"perPeerRateLimit"`
230+ PieceDownloadTimeout time.Duration `mapstructure:"pieceDownloadTimeout" yaml:"pieceDownloadTimeout"`
231+ DownloadGRPC ListenOption `mapstructure:"downloadGRPC" yaml:"downloadGRPC"`
232+ PeerGRPC ListenOption `mapstructure:"peerGRPC" yaml:"peerGRPC"`
233+ CalculateDigest bool `mapstructure:"calculateDigest" yaml:"calculateDigest"`
234+ Transport * TransportOption `mapstructure:"transportOption" yaml:"transportOption"`
235+ GetPiecesMaxRetry int `mapstructure:"getPiecesMaxRetry" yaml:"getPiecesMaxRetry"`
236+ Prefetch bool `mapstructure:"prefetch" yaml:"prefetch"`
237+ WatchdogTimeout time.Duration `mapstructure:"watchdogTimeout" yaml:"watchdogTimeout"`
238+ Concurrent * ConcurrentOption `mapstructure:"concurrent" yaml:"concurrent"`
238239}
239240
240241type TransportOption struct {
@@ -247,6 +248,19 @@ type TransportOption struct {
247248 ExpectContinueTimeout time.Duration `mapstructure:"expectContinueTimeout" yaml:"expectContinueTimeout"`
248249}
249250
251+ type ConcurrentOption struct {
252+ // ThresholdSize indicates the threshold to download pieces concurrently
253+ ThresholdSize util.Size `mapstructure:"thresholdSize" yaml:"thresholdSize"`
254+ // GoroutineCount indicates the concurrent goroutine count for every task
255+ GoroutineCount int `mapstructure:"goroutineCount" yaml:"goroutineCount"`
256+ // InitBackoff second for every piece failed, default: 0.5
257+ InitBackoff float64 `mapstructure:"initBackoff" yaml:"initBackoff"`
258+ // MaxBackoff second for every piece failed, default: 3
259+ MaxBackoff float64 `mapstructure:"maxBackoff" yaml:"maxBackoff"`
260+ // MaxAttempts for every piece failed,default: 3
261+ MaxAttempts int `mapstructure:"maxAttempts" yaml:"MaxAttempts"`
262+ }
263+
250264type ProxyOption struct {
251265 // WARNING: when add more option, please update ProxyOption.unmarshal function
252266 ListenOption `mapstructure:",squash" yaml:",inline"`
0 commit comments