]> Sergey Matveev's repositories - btrtrc.git/blob - storage/interface.go
storage: Fix spelling mistake
[btrtrc.git] / storage / interface.go
1 package storage
2
3 import (
4         "io"
5
6         "github.com/anacrolix/torrent/metainfo"
7 )
8
9 // Represents data storage for an unspecified torrent.
10 type ClientImpl interface {
11         OpenTorrent(info *metainfo.Info, infoHash metainfo.Hash) (TorrentImpl, error)
12 }
13
14 // Data storage bound to a torrent.
15 type TorrentImpl interface {
16         Piece(metainfo.Piece) PieceImpl
17         Close() error
18 }
19
20 // Interacts with torrent piece data.
21 type PieceImpl interface {
22         // These interfaces are not as strict as normally required. They can
23         // assume that the parameters are appropriate for the dimensions of the
24         // piece.
25         io.ReaderAt
26         io.WriterAt
27         // Called when the client believes the piece data will pass a hash check.
28         // The storage can move or mark the piece data as read-only as it sees
29         // fit.
30         MarkComplete() error
31         MarkNotComplete() error
32         // Returns true if the piece is complete.
33         GetIsComplete() bool
34 }