import (
"io"
- "crawshaw.io/sqlite"
"github.com/anacrolix/squirrel"
"github.com/anacrolix/torrent/metainfo"
type client struct {
*squirrel.Cache
- capacity func() *int64
+ capacity func() (int64, bool)
}
-func (c *client) OpenTorrent(info *metainfo.Info, infoHash metainfo.Hash) (storage.TorrentImpl, error) {
+func (c *client) OpenTorrent(*metainfo.Info, metainfo.Hash) (storage.TorrentImpl, error) {
t := torrent{c.Cache}
return storage.TorrentImpl{Piece: t.Piece, Close: t.Close, Capacity: &c.capacity}, nil
}
}
func (p piece) Completion() (ret storage.Completion) {
- err := p.sb.GetTag("verified", func(stmt *sqlite.Stmt) {
+ err := p.sb.GetTag("verified", func(stmt squirrel.SqliteStmt) {
ret.Complete = stmt.ColumnInt(0) != 0
})
ret.Ok = err == nil
- if err != nil {
- panic(err)
- }
+ ret.Err = err
return
}