It's used in some public methods already anyway, so it was a mistake.
length int64
fi metainfo.FileInfo
displayPath string
- prio piecePriority
+ prio PiecePriority
piecesRoot g.Option[[sha256.Size]byte]
}
}
// Sets the minimum priority for pieces in the File.
-func (f *File) SetPriority(prio piecePriority) {
+func (f *File) SetPriority(prio PiecePriority) {
f.t.cl.lock()
if prio != f.prio {
f.prio = prio
}
// Returns the priority per File.SetPriority.
-func (f *File) Priority() (prio piecePriority) {
+func (f *File) Priority() (prio PiecePriority) {
f.t.cl.rLock()
prio = f.prio
f.t.cl.rUnlock()
type (
Request = types.Request
ChunkSpec = types.ChunkSpec
- piecePriority = types.PiecePriority
+ PiecePriority = types.PiecePriority
)
const (
storageCompletionOk bool
publicPieceState PieceState
- priority piecePriority
+ priority PiecePriority
// Availability adjustment for this piece relative to len(Torrent.connsWithAllPieces). This is
// incremented for any piece a peer has when a peer has a piece, Torrent.haveInfo is true, and
// the Peer isn't recorded in Torrent.connsWithAllPieces.
return p.torrentBeginOffset() + int64(p.t.usualPieceSize())
}
-func (p *Piece) SetPriority(prio piecePriority) {
+func (p *Piece) SetPriority(prio PiecePriority) {
p.t.cl.lock()
defer p.t.cl.unlock()
p.priority = prio
p.t.updatePiecePriority(p.index, "Piece.SetPriority")
}
-func (p *Piece) purePriority() (ret piecePriority) {
+func (p *Piece) purePriority() (ret PiecePriority) {
for _, f := range p.files {
ret.Raise(f.prio)
}
// The current state of a piece.
type PieceState struct {
- Priority piecePriority
+ Priority PiecePriority
storage.Completion
// The piece is being hashed, or is queued for hash. Deprecated: Use those fields instead.
Checking bool
rightPiece := &p.pieceStates[rightPieceIndex]
// Putting this first means we can steal requests from lesser-performing peers for our first few
// new requests.
- priority := func() piecePriority {
+ priority := func() PiecePriority {
// Technically we would be happy with the cached priority here, except we don't actually
- // cache it anymore, and Torrent.piecePriority just does another lookup of *Piece to resolve
+ // cache it anymore, and Torrent.PiecePriority just does another lookup of *Piece to resolve
// the priority through Piece.purePriority, which is probably slower.
leftPriority := leftPiece.Priority
rightPriority := rightPiece.Priority