2021-05-13 09:56:58 +10:00
|
|
|
package request_strategy
|
|
|
|
|
2021-09-19 15:16:37 +10:00
|
|
|
type ChunksIter func(func(ChunkIndex))
|
2021-05-14 13:06:12 +10:00
|
|
|
|
2021-05-13 09:56:58 +10:00
|
|
|
type Piece struct {
|
|
|
|
Request bool
|
|
|
|
Priority piecePriority
|
|
|
|
Partial bool
|
|
|
|
Availability int64
|
|
|
|
Length int64
|
|
|
|
NumPendingChunks int
|
2021-05-14 13:06:12 +10:00
|
|
|
IterPendingChunks ChunksIter
|
2021-05-13 09:56:58 +10:00
|
|
|
}
|
2021-05-13 20:56:12 +10:00
|
|
|
|
2021-09-19 15:16:37 +10:00
|
|
|
func (p Piece) iterPendingChunksWrapper(f func(ChunkIndex)) {
|
2021-05-13 20:56:12 +10:00
|
|
|
i := p.IterPendingChunks
|
|
|
|
if i != nil {
|
|
|
|
i(f)
|
|
|
|
}
|
|
|
|
}
|