]> Sergey Matveev's repositories - btrtrc.git/blobdiff - storage/sqlite-piece-completion.go
Switch to github.com/go-llsqlite/adapter
[btrtrc.git] / storage / sqlite-piece-completion.go
index 5f31e41377f0fcb79e2accc59cb9dc57ad99bdb0..73407f3f235e0b6d32ec4aa8db6c6d0ff6198bfd 100644 (file)
@@ -1,3 +1,6 @@
+// modernc.org/sqlite depends on modernc.org/libc which doesn't work for JS (and probably wasm but I
+// think JS is the stronger signal).
+
 //go:build cgo && !nosqlite
 // +build cgo,!nosqlite
 
@@ -8,11 +11,17 @@ import (
        "path/filepath"
        "sync"
 
-       "crawshaw.io/sqlite"
-       "crawshaw.io/sqlite/sqlitex"
+       "github.com/go-llsqlite/adapter"
+       "github.com/go-llsqlite/adapter/sqlitex"
+
        "github.com/anacrolix/torrent/metainfo"
 )
 
+// sqlite is always the default when available.
+func NewDefaultPieceCompletionForDir(dir string) (PieceCompletion, error) {
+       return NewSqlitePieceCompletion(dir)
+}
+
 type sqlitePieceCompletion struct {
        mu     sync.Mutex
        closed bool