6 "github.com/anacrolix/torrent/metainfo"
9 // Represents data storage for a Torrent.
11 Piece(metainfo.Piece) Piece
14 type Piece interface {
15 // Should return io.EOF only at end of torrent. Short reads due to missing
16 // data should return io.ErrUnexpectedEOF.
19 // Called when the client believes the piece data will pass a hash check.
20 // The storage can move or mark the piece data as read-only as it sees
23 // Returns true if the piece is complete.
27 // type PieceStorage interface {
28 // ReadAt(metainfo.Piece, []byte, int64) (int, error)
29 // WriteAt(metainfo.Piece, []byte, int64) (int, error)
30 // MarkComplete(metainfo.Piece) error
31 // GetIsComplete(metainfo.Piece) bool
34 // type wrappedPieceStorage struct {
38 // func WrapPieceStorage(ps PieceStorage) I {
39 // return wrappedPieceStorage{ps}
42 // func (me wrappedPieceStorage) Piece(metainfo.Piece)