request_strategy

package
v1.41.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2022 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRequestablePieces

func GetRequestablePieces(input Input, pro *PieceRequestOrder, f func(ih metainfo.Hash, pieceIndex int))

Calls f with requestable pieces in order.

func NewAjwernerBtree

func NewAjwernerBtree() *ajwernerBtree

func NewTidwallBtree

func NewTidwallBtree() *tidwallBtree

Types

type Btree

type Btree interface {
	Delete(pieceRequestOrderItem)
	Add(pieceRequestOrderItem)
	Scan(func(pieceRequestOrderItem) bool)
}

type ChunkIndex

type ChunkIndex = uint32

type ChunkSpec

type ChunkSpec = types.ChunkSpec

This can be made into a type-param later, will be great for testing.

type ChunksIter

type ChunksIter interface {
	Iter(func(ci ChunkIndex))
}

type ChunksIterFunc

type ChunksIterFunc func(func(ChunkIndex))

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

type PeerRequestState struct {
	Interested bool
	// Expecting. TODO: This should be ordered so webseed requesters initiate in the same order they
	// were assigned.
	Requests roaring.Bitmap
	// Cancelled and waiting response
	Cancelled roaring.Bitmap
}

type Piece

type Piece interface {
	Request() bool
	NumPendingChunks() int
}

type PieceRequestOrder

type PieceRequestOrder struct {
	// contains filtered or unexported fields
}

func NewPieceOrder

func NewPieceOrder(btree Btree, cap int) *PieceRequestOrder

func (*PieceRequestOrder) Add

func (*PieceRequestOrder) Delete

func (me *PieceRequestOrder) Delete(key PieceRequestOrderKey)

func (*PieceRequestOrder) Len

func (me *PieceRequestOrder) Len() int

func (*PieceRequestOrder) Update

type PieceRequestOrderKey

type PieceRequestOrderKey struct {
	InfoHash metainfo.Hash
	Index    int
}

type PieceRequestOrderPathHint

type PieceRequestOrderPathHint = btree.PathHint

type PieceRequestOrderState

type PieceRequestOrderState struct {
	Priority     piecePriority
	Partial      bool
	Availability int
}

type Request

type Request = types.Request

type RequestIndex

type RequestIndex = uint32

type Torrent

type Torrent interface {
	Piece(int) Piece
	ChunksPerPiece() uint32
	PieceLength() int64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL