3 import "github.com/anacrolix/libtorgo/metainfo"
5 // Provides access to regions of torrent data that correspond to its files.
14 // Data for this file begins this far into the torrent.
15 func (f *File) Offset() int64 {
19 func (f File) FileInfo() metainfo.FileInfo {
23 func (f File) Path() string {
27 func (f *File) Length() int64 {
31 type FilePieceState struct {
36 func (f *File) Progress() (ret []FilePieceState) {
37 pieceSize := int64(f.t.usualPieceSize())
38 off := f.offset % pieceSize
40 for i := int(f.offset / pieceSize); ; i++ {
44 len1 := pieceSize - off
48 ret = append(ret, FilePieceState{len1, f.t.pieceStatusChar(i)})
55 func (f *File) PrioritizeRegion(off, len int64) {
56 if off < 0 || off >= f.length {
59 if off+len > f.length {
63 f.t.SetRegionPriority(off, len)