25 lines
452 B
Go
25 lines
452 B
Go
package request_strategy
|
|
|
|
type ChunksIterFunc func(func(ChunkIndex))
|
|
|
|
type ChunksIter interface {
|
|
Iter(func(ChunkIndex))
|
|
}
|
|
|
|
type Piece struct {
|
|
Request bool
|
|
Priority piecePriority
|
|
Partial bool
|
|
Availability int64
|
|
Length int64
|
|
NumPendingChunks int
|
|
IterPendingChunks ChunksIter
|
|
}
|
|
|
|
func (p Piece) iterPendingChunksWrapper(f func(ChunkIndex)) {
|
|
i := p.IterPendingChunks
|
|
if i != nil {
|
|
i.Iter(f)
|
|
}
|
|
}
|