fix api docs and cosmetics

This commit is contained in:
nikk gitanes
2024-02-03 01:12:40 +03:00
parent cd830f67c9
commit 9d03b777f5
7 changed files with 41 additions and 54 deletions

View File

@@ -25,20 +25,20 @@ func NewStorage(capacity int64) *Storage {
}
func (s *Storage) OpenTorrent(info *metainfo.Info, infoHash metainfo.Hash) (ts.TorrentImpl, error) {
// capFunc := func() (int64, bool) {
// return s.capacity, true
// }
// capFunc := func() (int64, bool) { // NE
// return s.capacity, true // NE
// } // NE
s.mu.Lock()
defer s.mu.Unlock()
ch := NewCache(s.capacity, s)
ch.Init(info, infoHash)
s.caches[infoHash] = ch
return ch, nil
// return ts.TorrentImpl{
// Piece: ch.Piece,
// Close: ch.Close,
// Capacity: &capFunc,
// }, nil
return ch, nil // OE
// return ts.TorrentImpl{ // NE
// Piece: ch.Piece, // NE
// Close: ch.Close, // NE
// Capacity: &capFunc, // NE
// }, nil // NE
}
func (s *Storage) CloseHash(hash metainfo.Hash) {