Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/superfly/ltx"
"modernc.org/sqlite"

"github.com/benbjohnson/litestream/internal"
)
Expand Down Expand Up @@ -334,8 +333,13 @@ func (db *DB) setPersistWAL(ctx context.Context) error {
}
defer conn.Close()

return conn.Raw(func(driverConn interface{}) error {
fc, ok := driverConn.(sqlite.FileControl)
return conn.Raw(func(driverConn any) error {
// Using an anonymous interface here avoids unnecessarily importing our
// chosen driver. This is important for library users (e.g. the VFS)
// that don't need to depend on the driver.
fc, ok := driverConn.(interface {
FileControlPersistWAL(string, int) (int, error)
})
if !ok {
return fmt.Errorf("driver does not implement FileControl")
}
Expand Down
1 change: 1 addition & 0 deletions internal/testingutil/testingutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (

sftpserver "github.com/pkg/sftp"
"golang.org/x/crypto/ssh"
_ "modernc.org/sqlite"

"github.com/benbjohnson/litestream"
"github.com/benbjohnson/litestream/abs"
Expand Down
1 change: 0 additions & 1 deletion litestream.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"strings"

"github.com/superfly/ltx"
_ "modernc.org/sqlite"
)

// Naming constants.
Expand Down