FedP2P/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 14:45:22 +08: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
}