From: Matt Joiner Date: Fri, 14 May 2021 05:51:26 +0000 (+1000) Subject: Default to sqlite piece completion for dir if cgo enabled X-Git-Tag: v1.28.0 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=ad421ea2d0ff16f3be7e2401754d60337fd8e4dc;p=btrtrc.git Default to sqlite piece completion for dir if cgo enabled --- diff --git a/storage/default-dir-piece-completion-boltdb.go b/storage/default-dir-piece-completion-boltdb.go new file mode 100644 index 00000000..5ba587b7 --- /dev/null +++ b/storage/default-dir-piece-completion-boltdb.go @@ -0,0 +1,8 @@ +//go:build !cgo +// +build !cgo + +package storage + +func NewDefaultPieceCompletionForDir(dir string) (PieceCompletion, error) { + return NewBoltPieceCompletion(dir) +} diff --git a/storage/default-dir-piece-completion-sqlite.go b/storage/default-dir-piece-completion-sqlite.go new file mode 100644 index 00000000..7c347956 --- /dev/null +++ b/storage/default-dir-piece-completion-sqlite.go @@ -0,0 +1,8 @@ +//go:build cgo +// +build cgo + +package storage + +func NewDefaultPieceCompletionForDir(dir string) (PieceCompletion, error) { + return NewSqlitePieceCompletion(dir) +} diff --git a/storage/piece-completion.go b/storage/piece-completion.go index 791fce60..bc646bd7 100644 --- a/storage/piece-completion.go +++ b/storage/piece-completion.go @@ -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()