Rename TorrentData->Data

This commit is contained in:
Matt Joiner 2015-02-27 01:43:37 +11:00
parent 22746dda23
commit 315c703456
3 changed files with 7 additions and 7 deletions

View File

@ -410,7 +410,7 @@ func NewClient(cfg *Config) (cl *Client, err error) {
disableTCP: cfg.DisableTCP,
_configDir: cfg.ConfigDir,
config: *cfg,
torrentDataOpener: func(md *metainfo.Info) (TorrentData, error) {
torrentDataOpener: func(md *metainfo.Info) (Data, error) {
return filePkg.TorrentData(md, cfg.DataDir), nil
},
@ -1544,7 +1544,7 @@ func (cl *Client) startTorrent(t *torrent) {
}
// Storage cannot be changed once it's set.
func (cl *Client) setStorage(t *torrent, td TorrentData) (err error) {
func (cl *Client) setStorage(t *torrent, td Data) (err error) {
err = t.setStorage(td)
cl.event.Broadcast()
if err != nil {
@ -1554,7 +1554,7 @@ func (cl *Client) setStorage(t *torrent, td TorrentData) (err error) {
return
}
type TorrentDataOpener func(*metainfo.Info) (TorrentData, error)
type TorrentDataOpener func(*metainfo.Info) (Data, error)
func (cl *Client) setMetaData(t *torrent, md metainfo.Info, bytes []byte) (err error) {
err = t.setMetadata(md, bytes, &cl.mu)

View File

@ -195,7 +195,7 @@ func TestDownloadOnDemand(t *testing.T) {
NoDefaultBlocklist: true,
TorrentDataOpener: func(info *metainfo.Info) (torrent.TorrentData, error) {
TorrentDataOpener: func(info *metainfo.Info) (torrent.Data, error) {
return mmap.TorrentData(info, filepath.Join(layout.BaseDir, "download"))
},

View File

@ -38,7 +38,7 @@ type peersKey struct {
Port int
}
type TorrentData interface {
type Data interface {
ReadAt(p []byte, off int64) (n int, err error)
Close()
WriteAt(p []byte, off int64) (n int, err error)
@ -58,7 +58,7 @@ type torrent struct {
Pieces []*piece
length int64
data TorrentData
data Data
Info *metainfo.Info
// Active peer connections.
@ -206,7 +206,7 @@ func (t *torrent) setMetadata(md metainfo.Info, infoBytes []byte, eventLocker sy
return
}
func (t *torrent) setStorage(td TorrentData) (err error) {
func (t *torrent) setStorage(td Data) (err error) {
if t.data != nil {
t.data.Close()
}