]> Sergey Matveev's repositories - btrtrc.git/blob - request-strategy/piece.go
Merge branch 'peer-requesting'
[btrtrc.git] / request-strategy / piece.go
1 package request_strategy
2
3 type ChunksIterFunc func(func(ChunkIndex))
4
5 type ChunksIter interface {
6         Iter(func(ci ChunkIndex))
7 }
8
9 type Piece struct {
10         Request           bool
11         Priority          piecePriority
12         Partial           bool
13         Availability      int64
14         Length            int64
15         NumPendingChunks  int
16         IterPendingChunks ChunksIter
17 }
18
19 func (p Piece) iterPendingChunksWrapper(f func(ChunkIndex)) {
20         i := p.IterPendingChunks
21         if i != nil {
22                 i.Iter(f)
23         }
24 }