aboutsummaryrefslogtreecommitdiff
path: root/meta/torrent.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-06-13 00:49:40 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-06-13 00:49:40 +0200
commit9ed8ead2e1fa30ac46581e05d54b71afe007fe58 (patch)
tree4d8423d96c7bb05a3dedcae728a17f40664061d7 /meta/torrent.go
parente9a469f72dfddd92284ebe9b5c50ff1607206c5c (diff)
wip
Diffstat (limited to 'meta/torrent.go')
-rw-r--r--meta/torrent.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/meta/torrent.go b/meta/torrent.go
index d30dc48..9b1b124 100644
--- a/meta/torrent.go
+++ b/meta/torrent.go
@@ -3,6 +3,7 @@ package meta
import (
"errors"
"fmt"
+ "os"
"path"
"time"
)
@@ -36,6 +37,15 @@ func (i Info) FullPath(n int) (string, error) {
return path.Join(p...), nil
}
+// piece-to-file mapping:
+// piece # -> [ { file #, off, len }, ... ]
+
+type pieceToFile map[int][]struct {
+ fd os.File
+ offset int
+ length int
+}
+
func (i Info) FindFile(chunk, offset int) int {
if i.isSingleFile() {
return 0