Default to sqlite piece completion for dir if cgo enabled

This commit is contained in:
Matt Joiner 2021-05-14 15:51:26 +10:00
parent a4e84688ae
commit ad421ea2d0
3 changed files with 17 additions and 1 deletions

View File

@ -0,0 +1,8 @@
//go:build !cgo
// +build !cgo
package storage
func NewDefaultPieceCompletionForDir(dir string) (PieceCompletion, error) {
return NewBoltPieceCompletion(dir)
}

View File

@ -0,0 +1,8 @@
//go:build cgo
// +build cgo
package storage
func NewDefaultPieceCompletionForDir(dir string) (PieceCompletion, error) {
return NewSqlitePieceCompletion(dir)
}

View File

@ -18,7 +18,7 @@ type PieceCompletion interface {
}
func pieceCompletionForDir(dir string) (ret PieceCompletion) {
ret, err := NewBoltPieceCompletion(dir)
ret, err := NewDefaultPieceCompletionForDir(dir)
if err != nil {
log.Printf("couldn't open piece completion db in %q: %s", dir, err)
ret = NewMapPieceCompletion()