Documentation ¶
Index ¶
- func GetRequestablePieces(input Input, pro *PieceRequestOrder, ...)
- func NewAjwernerBtree() *ajwernerBtree
- func NewTidwallBtree() *tidwallBtree
- type Btree
- type ChunkIndex
- type ChunkSpec
- type Input
- type PeerRequestState
- type PeerRequests
- type Piece
- type PieceRequestOrder
- func (me *PieceRequestOrder) Add(key PieceRequestOrderKey, state PieceRequestOrderState) (old g.Option[PieceRequestOrderState])
- func (me *PieceRequestOrder) Delete(key PieceRequestOrderKey) bool
- func (me *PieceRequestOrder) Len() int
- func (me *PieceRequestOrder) Update(key PieceRequestOrderKey, state PieceRequestOrderState)
- type PieceRequestOrderKey
- type PieceRequestOrderPathHint
- type PieceRequestOrderState
- type Request
- type RequestIndex
- type Torrent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRequestablePieces ¶ added in v1.32.0
func GetRequestablePieces( input Input, pro *PieceRequestOrder, f func(ih metainfo.Hash, pieceIndex int, orderState PieceRequestOrderState), )
Calls f with requestable pieces in order.
func NewAjwernerBtree ¶ added in v1.42.0
func NewAjwernerBtree() *ajwernerBtree
func NewTidwallBtree ¶ added in v1.42.0
func NewTidwallBtree() *tidwallBtree
Types ¶
type Btree ¶ added in v1.42.0
type Btree interface { Delete(pieceRequestOrderItem) Add(pieceRequestOrderItem) Scan(func(pieceRequestOrderItem) bool) }
type ChunkIndex ¶ added in v1.32.0
type ChunkIndex = RequestIndex
type Input ¶
type Input interface { Torrent(metainfo.Hash) Torrent // Storage capacity, shared among all Torrents with the same storage.TorrentCapacity pointer in // their storage.Torrent references. Capacity() (cap int64, capped bool) // Across all the Torrents. This might be partitioned by storage capacity key now. MaxUnverifiedBytes() int64 }
type PeerRequestState ¶ added in v1.39.0
type PeerRequestState struct { Interested bool Requests PeerRequests // Cancelled and waiting response Cancelled typedRoaring.Bitmap[RequestIndex] }
type PeerRequests ¶ added in v1.43.0
type PeerRequests interface { // Can be more efficient than GetCardinality. IsEmpty() bool // See roaring.Bitmap.GetCardinality. GetCardinality() uint64 Contains(RequestIndex) bool // Should not adjust iteration order if item already exists, although I don't think that usage // exists. Add(RequestIndex) // See roaring.Bitmap.Rank. Rank(RequestIndex) uint64 // Must yield in order items were added. Iterate(func(RequestIndex) bool) // See roaring.Bitmap.CheckedRemove. CheckedRemove(RequestIndex) bool // Iterate a snapshot of the values. It is safe to mutate the underlying data structure. IterateSnapshot(func(RequestIndex) bool) }
A set of request indices iterable by order added.
type PieceRequestOrder ¶ added in v1.39.0
type PieceRequestOrder struct {
// contains filtered or unexported fields
}
func NewPieceOrder ¶ added in v1.39.0
func NewPieceOrder(btree Btree, cap int) *PieceRequestOrder
func (*PieceRequestOrder) Add ¶ added in v1.39.0
func (me *PieceRequestOrder) Add( key PieceRequestOrderKey, state PieceRequestOrderState, ) (old g.Option[PieceRequestOrderState])
Returns the old state if the key was already present.
func (*PieceRequestOrder) Delete ¶ added in v1.39.0
func (me *PieceRequestOrder) Delete(key PieceRequestOrderKey) bool
func (*PieceRequestOrder) Len ¶ added in v1.39.0
func (me *PieceRequestOrder) Len() int
func (*PieceRequestOrder) Update ¶ added in v1.39.0
func (me *PieceRequestOrder) Update( key PieceRequestOrderKey, state PieceRequestOrderState, )
type PieceRequestOrderKey ¶ added in v1.39.0
type PieceRequestOrderPathHint ¶ added in v1.42.0
type PieceRequestOrderState ¶ added in v1.39.0
type RequestIndex ¶ added in v1.32.0
type RequestIndex uint32
Click to show internal directories.
Click to hide internal directories.