2
0
mirror of synced 2025-02-24 06:38:14 +00:00
torrent/data.go
Matt Joiner b0b5794890 Create a pieceStore interface, and merge in my httpfile backend, and replace data/blob
data/blob was aging, and had severe performance problems. It's now possible to use missinggo/filecache as a data backend to pieceStore which is better tested and performs excellently.
2015-10-04 00:22:46 +10:00

18 lines
462 B
Go

package torrent
import "io"
// Represents data storage for a Torrent.
type Data interface {
io.ReaderAt
io.WriterAt
// Bro, do you even io.Closer?
Close()
// If the data isn't available, err should be io.ErrUnexpectedEOF.
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
}