1 package requestStrategy
4 typedRoaring "github.com/anacrolix/torrent/typed-roaring"
7 type PeerRequestState struct {
10 // Cancelled and waiting response
11 Cancelled typedRoaring.Bitmap[RequestIndex]
14 // A set of request indices iterable by order added.
15 type PeerRequests interface {
16 // Can be more efficient than GetCardinality.
18 // See roaring.Bitmap.GetCardinality.
19 GetCardinality() uint64
20 Contains(RequestIndex) bool
21 // Should not adjust iteration order if item already exists, although I don't think that usage
24 // See roaring.Bitmap.Rank.
25 Rank(RequestIndex) uint64
26 // Must yield in order items were added.
27 Iterate(func(RequestIndex) bool)
28 // See roaring.Bitmap.CheckedRemove.
29 CheckedRemove(RequestIndex) bool
30 // Iterate a snapshot of the values. It is safe to mutate the underlying data structure.
31 IterateSnapshot(func(RequestIndex) bool)