Move request strategy doc comments onto their public functions
This commit is contained in:
parent
ddd03362f8
commit
8c059ae158
|
@ -55,14 +55,10 @@ type requestStrategyCallbacks interface {
|
||||||
requestTimedOut(request)
|
requestTimedOut(request)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Favour higher priority pieces with some fuzzing to reduce overlaps and wastage across
|
|
||||||
// connections.
|
|
||||||
type requestStrategyFuzzing struct {
|
type requestStrategyFuzzing struct {
|
||||||
requestStrategyDefaults
|
requestStrategyDefaults
|
||||||
}
|
}
|
||||||
|
|
||||||
// The fastest connection downloads strictly in order of priority, while all others adhere to their
|
|
||||||
// piece inclinations.
|
|
||||||
type requestStrategyFastest struct {
|
type requestStrategyFastest struct {
|
||||||
requestStrategyDefaults
|
requestStrategyDefaults
|
||||||
}
|
}
|
||||||
|
@ -73,10 +69,14 @@ func newRequestStrategyMaker(rs requestStrategy) requestStrategyMaker {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The fastest connection downloads strictly in order of priority, while all others adhere to their
|
||||||
|
// piece inclinations.
|
||||||
func RequestStrategyFastest() requestStrategyMaker {
|
func RequestStrategyFastest() requestStrategyMaker {
|
||||||
return newRequestStrategyMaker(requestStrategyFastest{})
|
return newRequestStrategyMaker(requestStrategyFastest{})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Favour higher priority pieces with some fuzzing to reduce overlaps and wastage across
|
||||||
|
// connections.
|
||||||
func RequestStrategyFuzzing() requestStrategyMaker {
|
func RequestStrategyFuzzing() requestStrategyMaker {
|
||||||
return newRequestStrategyMaker(requestStrategyFuzzing{})
|
return newRequestStrategyMaker(requestStrategyFuzzing{})
|
||||||
}
|
}
|
||||||
|
@ -94,8 +94,6 @@ func (requestStrategyFastest) shouldRequestWithoutBias(cn requestStrategyConnect
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Requests are strictly by piece priority, and not duplicated until duplicateRequestTimeout is
|
|
||||||
// reached.
|
|
||||||
type requestStrategyDuplicateRequestTimeout struct {
|
type requestStrategyDuplicateRequestTimeout struct {
|
||||||
requestStrategyDefaults
|
requestStrategyDefaults
|
||||||
// How long to avoid duplicating a pending request.
|
// How long to avoid duplicating a pending request.
|
||||||
|
@ -113,6 +111,8 @@ type requestStrategyDuplicateRequestTimeout struct {
|
||||||
// Generates a request strategy instance for a given torrent. callbacks are probably specific to the torrent.
|
// Generates a request strategy instance for a given torrent. callbacks are probably specific to the torrent.
|
||||||
type requestStrategyMaker func(callbacks requestStrategyCallbacks, clientLocker sync.Locker) requestStrategy
|
type requestStrategyMaker func(callbacks requestStrategyCallbacks, clientLocker sync.Locker) requestStrategy
|
||||||
|
|
||||||
|
// Requests are strictly by piece priority, and not duplicated until duplicateRequestTimeout is
|
||||||
|
// reached.
|
||||||
func RequestStrategyDuplicateRequestTimeout(duplicateRequestTimeout time.Duration) requestStrategyMaker {
|
func RequestStrategyDuplicateRequestTimeout(duplicateRequestTimeout time.Duration) requestStrategyMaker {
|
||||||
return func(callbacks requestStrategyCallbacks, clientLocker sync.Locker) requestStrategy {
|
return func(callbacks requestStrategyCallbacks, clientLocker sync.Locker) requestStrategy {
|
||||||
return requestStrategyDuplicateRequestTimeout{
|
return requestStrategyDuplicateRequestTimeout{
|
||||||
|
|
Loading…
Reference in New Issue