]> 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 1ae0984ff15704372dcc8f92ccca7c0e4b88018a..73407f3f235e0b6d32ec4aa8db6c6d0ff6198bfd 100644 (file)
@@ -1,4 +1,8 @@
+// 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
 
 package storage
 
@@ -7,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