]> Sergey Matveev's repositories - btrtrc.git/blob - data.go
dec2e847ee4b3e7ba5505a070790b5c9fafad17b
[btrtrc.git] / data.go
1 package torrent
2
3 import "io"
4
5 // Represents data storage for a Torrent.
6 type Data interface {
7         // Should return io.EOF only at end of torrent. Short reads due to missing
8         // data should return io.ErrUnexpectedEOF.
9         io.ReaderAt
10         io.WriterAt
11         // Bro, do you even io.Closer?
12         Close()
13         // Called when the client believes the piece data will pass a hash check.
14         // The storage can move or mark the piece data as read-only as it sees
15         // fit.
16         PieceCompleted(index int) error
17         // Returns true if the piece is complete.
18         PieceComplete(index int) bool
19 }