FedP2P/request-strategy/piece.go

25 lines
455 B
Go
Raw Normal View History

package request_strategy
type ChunksIterFunc func(func(ChunkIndex))
type ChunksIter interface {
Iter(func(ci ChunkIndex))
}
2021-05-14 11:06:12 +08:00
type Piece struct {
Request bool
Priority piecePriority
Partial bool
Availability int64
Length int64
NumPendingChunks int
2021-05-14 11:06:12 +08:00
IterPendingChunks ChunksIter
}
2021-09-19 13:16:37 +08:00
func (p Piece) iterPendingChunksWrapper(f func(ChunkIndex)) {
i := p.IterPendingChunks
if i != nil {
i.Iter(f)
}
}