Fix wasm build

This was broken in the move to zombiezen sqlite, which still doesn't work on WASM/JS.
This commit is contained in:
Matt Joiner 2021-12-07 13:07:58 +11:00
parent 22053c9238
commit 7197c5f493
4 changed files with 23 additions and 12 deletions

View File

@ -0,0 +1,11 @@
// Bolt piece completion is available, and sqlite is not.
//go:build !noboltdb && !wasm && (js || nosqlite)
// +build !noboltdb
// +build !wasm
// +build js nosqlite
package storage
func NewDefaultPieceCompletionForDir(dir string) (PieceCompletion, error) {
return NewBoltPieceCompletion(dir)
}

View File

@ -1,5 +1,6 @@
//go:build wasm // Bolt piece completion is not available, and neither is sqlite.
// +build wasm //go:build wasm || noboltdb
// +build wasm noboltdb
package storage package storage

View File

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

View File

@ -1,5 +1,7 @@
//go:build !nosqlite // modernc.org/sqlite depends on modernc.org/libc which doesn't work for JS (and probably wasm but I
// +build !nosqlite // think JS is the stronger signal).
//go:build !js && !nosqlite
// +build !js,!nosqlite
package storage package storage
@ -13,6 +15,11 @@ import (
"zombiezen.com/go/sqlite/sqlitex" "zombiezen.com/go/sqlite/sqlitex"
) )
// sqlite is always the default when available.
func NewDefaultPieceCompletionForDir(dir string) (PieceCompletion, error) {
return NewSqlitePieceCompletion(dir)
}
type sqlitePieceCompletion struct { type sqlitePieceCompletion struct {
mu sync.Mutex mu sync.Mutex
closed bool closed bool