Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileSection ¶
type FileSection struct { File ReadWriterAt Offset int64 Length int64 Name string // Padding indicates that the file is used as padding so it should not be requested from peers. // The contents of padding files are always zero. Padding bool }
FileSection of a file.
type Piece ¶
type Piece []FileSection
Piece is contiguous sections of files. When piece hashes in torrent file is being calculated all files are concatenated and splitted into pieces in length specified in the torrent file.
func (Piece) ReadAt ¶
ReadAt implements io.ReaderAt interface. It reads bytes from s at given offset into p. Used when uploading blocks of a piece.
func (Piece) Write ¶
Write implements io.Writer interface. It writes the bytes in p into files in s. Used when writing a downloaded piece (all blocks) after hash check is done. Calling write does not change the current position in s, so len(p) must be equal to total length of the all files in s in order to issue a full write.