torrent/storage/completion.go

23 lines
425 B
Go
Raw Normal View History

package storage
import (
"log"
"github.com/anacrolix/torrent/metainfo"
)
type pieceCompletion interface {
2016-07-12 06:45:22 +00:00
Get(metainfo.Piece) (bool, error)
Set(metainfo.Piece, bool) error
Close()
}
func pieceCompletionForDir(dir string) (ret pieceCompletion) {
ret, err := newDBPieceCompletion(dir)
if err != nil {
log.Printf("couldn't open piece completion db in %q: %s", dir, err)
ret = new(mapPieceCompletion)
}
return
}