2015-10-01 14:09:04 +00:00
|
|
|
package torrent
|
|
|
|
|
|
|
|
import "io"
|
|
|
|
|
|
|
|
// Represents data storage for a Torrent.
|
|
|
|
type Data interface {
|
2015-10-03 14:22:46 +00:00
|
|
|
io.ReaderAt
|
|
|
|
io.WriterAt
|
|
|
|
// Bro, do you even io.Closer?
|
2015-10-01 14:09:04 +00:00
|
|
|
Close()
|
2015-10-03 14:22:46 +00:00
|
|
|
// If the data isn't available, err should be io.ErrUnexpectedEOF.
|
2015-10-01 14:09:04 +00:00
|
|
|
WriteSectionTo(w io.Writer, off, n int64) (written int64, err error)
|
|
|
|
// We believe the piece data will pass a hash check.
|
|
|
|
PieceCompleted(index int) error
|
|
|
|
// Returns true if the piece is complete.
|
|
|
|
PieceComplete(index int) bool
|
|
|
|
}
|