client.go | 4 ++-- client_test.go | 14 +++++++------- config.go | 2 +- storage/file.go | 2 +- storage/interface.go | 2 +- storage/mmap.go | 2 +- storage/piece_file.go | 2 +- storage/piece_resource.go | 2 +- torrent.go | 2 +- diff --git a/client.go b/client.go index a791c568c0e10da5ca38eb245cad72f99bf48445..c92f7c2c82c9bc732b03bed91e50da6f1c31ce2b 100644 --- a/client.go +++ b/client.go @@ -73,7 +73,7 @@ // include ourselves if we end up trying to connect to our own address // through legitimate channels. dopplegangerAddrs map[string]struct{} - defaultStorage storage.I + defaultStorage storage.Client mu sync.RWMutex event sync.Cond @@ -1486,7 +1486,7 @@ DisplayName string // The chunk size to use for outbound requests. Defaults to 16KiB if not // set. ChunkSize int - Storage storage.I + Storage storage.Client } func TorrentSpecFromMagnetURI(uri string) (spec *TorrentSpec, err error) { diff --git a/client_test.go b/client_test.go index e2b5ac730c81c598b88cf5403c502c6e353942e1..644a8a6915c7dc8b02ad50f84922ebd6ad84f39f 100644 --- a/client_test.go +++ b/client_test.go @@ -243,11 +243,11 @@ LeecherFileCachePieceStorageFactory: fileCachePieceResourceStorage, }) } -func fileCachePieceResourceStorage(fc *filecache.Cache) storage.I { +func fileCachePieceResourceStorage(fc *filecache.Cache) storage.Client { return storage.NewPiecePerResource(fc.AsResourceProvider()) } -func fileCachePieceFileStorage(fc *filecache.Cache) storage.I { +func fileCachePieceFileStorage(fc *filecache.Cache) storage.Client { return storage.NewPieceFileStorage(fc.AsFileStore()) } @@ -267,11 +267,11 @@ }) } func TestClientTransferVarious(t *testing.T) { - for _, lsf := range []func(*filecache.Cache) storage.I{ + for _, lsf := range []func(*filecache.Cache) storage.Client{ fileCachePieceFileStorage, fileCachePieceResourceStorage, } { - for _, ss := range []func(string) storage.I{ + for _, ss := range []func(string) storage.Client{ storage.NewFile, storage.NewMMap, } { @@ -302,8 +302,8 @@ SetReadahead bool ExportClientStatus bool SetLeecherStorageCapacity bool LeecherStorageCapacity int64 - LeecherFileCachePieceStorageFactory func(*filecache.Cache) storage.I - SeederStorage func(string) storage.I + LeecherFileCachePieceStorageFactory func(*filecache.Cache) storage.Client + SeederStorage func(string) storage.Client } func testClientTransfer(t *testing.T, ps testClientTransferParams) { @@ -696,7 +696,7 @@ b = b[n:] } } -func testAddTorrentPriorPieceCompletion(t *testing.T, alreadyCompleted bool, csf func(*filecache.Cache) storage.I) { +func testAddTorrentPriorPieceCompletion(t *testing.T, alreadyCompleted bool, csf func(*filecache.Cache) storage.Client) { fileCacheDir, err := ioutil.TempDir("", "") require.NoError(t, err) defer os.RemoveAll(fileCacheDir) diff --git a/config.go b/config.go index 1a9ab8be665fb13b2fae0a68259fd7e59939cd74..9f645b0ae6f331c8ee6bf5b38a440b13c72ed7aa 100644 --- a/config.go +++ b/config.go @@ -35,7 +35,7 @@ // For the bittorrent protocol. DisableTCP bool `long:"disable-tcp"` // Called to instantiate storage for each added torrent. Provided backends // are in $REPO/data. If not set, the "file" implementation is used. - DefaultStorage storage.I + DefaultStorage storage.Client DisableEncryption bool `long:"disable-encryption"` IPBlocklist iplist.Ranger diff --git a/storage/file.go b/storage/file.go index 1b7ed749726787bc64d59fc44a40f4b23ef642ef..f781575382e1a200147b17907e46069ad5f48edf 100644 --- a/storage/file.go +++ b/storage/file.go @@ -17,7 +17,7 @@ baseDir string completed map[[20]byte]bool } -func NewFile(baseDir string) I { +func NewFile(baseDir string) Client { return &fileStorage{ baseDir: baseDir, } diff --git a/storage/interface.go b/storage/interface.go index 71b34abd0f076ed5da6237baa0b6ddc95da57d13..b2c3724e2d8428fa853f956dd5a141cf8c78dc1b 100644 --- a/storage/interface.go +++ b/storage/interface.go @@ -7,7 +7,7 @@ "github.com/anacrolix/torrent/metainfo" ) // Represents data storage for an unspecified torrent. -type I interface { +type Client interface { OpenTorrent(info *metainfo.InfoEx) (Torrent, error) } diff --git a/storage/mmap.go b/storage/mmap.go index 0a05bf731223d461d8f50ed95a17381b3b4ea335..76b6d79c85918a2771675b6a79c56cfaa0f6925d 100644 --- a/storage/mmap.go +++ b/storage/mmap.go @@ -17,7 +17,7 @@ type mmapStorage struct { baseDir string } -func NewMMap(baseDir string) I { +func NewMMap(baseDir string) Client { return &mmapStorage{ baseDir: baseDir, } diff --git a/storage/piece_file.go b/storage/piece_file.go index ee7608c19de9e2ae569cf9dd64ade603d43cf175..8a644d6813fb2f4f37be674bc245dac69269ca2e 100644 --- a/storage/piece_file.go +++ b/storage/piece_file.go @@ -15,7 +15,7 @@ type pieceFileStorage struct { fs missinggo.FileStore } -func NewPieceFileStorage(fs missinggo.FileStore) I { +func NewPieceFileStorage(fs missinggo.FileStore) Client { return &pieceFileStorage{ fs: fs, } diff --git a/storage/piece_resource.go b/storage/piece_resource.go index 2f6d6eefe0571822a5c4f8f59062a874abfd7dc3..f87d3f0d15d283394e388419e1c5255cd08925a0 100644 --- a/storage/piece_resource.go +++ b/storage/piece_resource.go @@ -14,7 +14,7 @@ type piecePerResource struct { p uniform.Provider } -func NewPiecePerResource(p uniform.Provider) I { +func NewPiecePerResource(p uniform.Provider) Client { return &piecePerResource{ p: p, } diff --git a/torrent.go b/torrent.go index 296db4be4e2376ba9ad86d26e8204de219e6e338..b89ce948dbe0a049edbc813980ac8ce6df8ff146 100644 --- a/torrent.go +++ b/torrent.go @@ -51,7 +51,7 @@ // get this from the info dict. length int64 // The storage to open when the info dict becomes available. - storageOpener storage.I + storageOpener storage.Client // Storage for torrent data. storage storage.Torrent