aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2021-07-20 11:18:14 +0100
committerGitHub <noreply@github.com>2021-07-20 11:18:14 +0100
commitf63068df3b9efb11f2677dd527994477b806ed19 (patch)
tree69c55298d104a9615ed50eb592a75297b0a416dc
parent0ff078ebd706600f69a6491538e97abec6e0606f (diff)
Only include go-sqlite3 on the relevant binaries (#1900)
* Only include go-sqlite3 on the relevant binaries * The driver name is always sqlite3 now * Update to matrix-org/go-sqlite3-js@e537baa
-rw-r--r--appservice/storage/sqlite3/storage.go1
-rw-r--r--cmd/dendrite-demo-libp2p/main.go2
-rw-r--r--cmd/dendrite-demo-pinecone/main.go2
-rw-r--r--cmd/dendrite-demo-yggdrasil/main.go2
-rw-r--r--cmd/dendrite-monolith-server/main.go2
-rw-r--r--cmd/dendrite-polylith-multi/main.go2
-rw-r--r--federationsender/storage/sqlite3/storage.go2
-rw-r--r--go.mod2
-rw-r--r--go.sum4
-rw-r--r--internal/sqlutil/sql.go8
-rw-r--r--internal/sqlutil/trace.go4
-rw-r--r--mediaapi/storage/sqlite3/storage.go1
-rw-r--r--roomserver/storage/sqlite3/storage.go2
-rw-r--r--signingkeyserver/storage/sqlite3/keydb.go2
-rw-r--r--syncapi/storage/sqlite3/syncserver.go3
-rw-r--r--userapi/storage/devices/sqlite3/storage.go2
16 files changed, 15 insertions, 26 deletions
diff --git a/appservice/storage/sqlite3/storage.go b/appservice/storage/sqlite3/storage.go
index 6ba5a6f6..51bfe710 100644
--- a/appservice/storage/sqlite3/storage.go
+++ b/appservice/storage/sqlite3/storage.go
@@ -23,7 +23,6 @@ import (
"github.com/matrix-org/dendrite/internal/sqlutil"
"github.com/matrix-org/dendrite/setup/config"
"github.com/matrix-org/gomatrixserverlib"
- _ "github.com/mattn/go-sqlite3"
)
// Database stores events intended to be later sent to application services
diff --git a/cmd/dendrite-demo-libp2p/main.go b/cmd/dendrite-demo-libp2p/main.go
index 6b0e57d8..1c511ce7 100644
--- a/cmd/dendrite-demo-libp2p/main.go
+++ b/cmd/dendrite-demo-libp2p/main.go
@@ -44,6 +44,8 @@ import (
"github.com/matrix-org/dendrite/eduserver/cache"
"github.com/sirupsen/logrus"
+
+ _ "github.com/mattn/go-sqlite3"
)
func createKeyDB(
diff --git a/cmd/dendrite-demo-pinecone/main.go b/cmd/dendrite-demo-pinecone/main.go
index 2712ed4a..d763f080 100644
--- a/cmd/dendrite-demo-pinecone/main.go
+++ b/cmd/dendrite-demo-pinecone/main.go
@@ -54,6 +54,8 @@ import (
pineconeSessions "github.com/matrix-org/pinecone/sessions"
"github.com/sirupsen/logrus"
+
+ _ "github.com/mattn/go-sqlite3"
)
var (
diff --git a/cmd/dendrite-demo-yggdrasil/main.go b/cmd/dendrite-demo-yggdrasil/main.go
index 95207a60..fc33a41f 100644
--- a/cmd/dendrite-demo-yggdrasil/main.go
+++ b/cmd/dendrite-demo-yggdrasil/main.go
@@ -44,6 +44,8 @@ import (
"github.com/matrix-org/gomatrixserverlib"
"github.com/sirupsen/logrus"
+
+ _ "github.com/mattn/go-sqlite3"
)
var (
diff --git a/cmd/dendrite-monolith-server/main.go b/cmd/dendrite-monolith-server/main.go
index 5efbe856..3785371a 100644
--- a/cmd/dendrite-monolith-server/main.go
+++ b/cmd/dendrite-monolith-server/main.go
@@ -31,6 +31,8 @@ import (
"github.com/matrix-org/dendrite/signingkeyserver"
"github.com/matrix-org/dendrite/userapi"
"github.com/sirupsen/logrus"
+
+ _ "github.com/mattn/go-sqlite3"
)
var (
diff --git a/cmd/dendrite-polylith-multi/main.go b/cmd/dendrite-polylith-multi/main.go
index d3c52967..c2208ca2 100644
--- a/cmd/dendrite-polylith-multi/main.go
+++ b/cmd/dendrite-polylith-multi/main.go
@@ -23,6 +23,8 @@ import (
"github.com/matrix-org/dendrite/setup"
"github.com/matrix-org/dendrite/setup/config"
"github.com/sirupsen/logrus"
+
+ _ "github.com/mattn/go-sqlite3"
)
type entrypoint func(base *setup.BaseDendrite, cfg *config.Dendrite)
diff --git a/federationsender/storage/sqlite3/storage.go b/federationsender/storage/sqlite3/storage.go
index c5d1d1ac..18fa418f 100644
--- a/federationsender/storage/sqlite3/storage.go
+++ b/federationsender/storage/sqlite3/storage.go
@@ -18,8 +18,6 @@ package sqlite3
import (
"database/sql"
- _ "github.com/mattn/go-sqlite3"
-
"github.com/matrix-org/dendrite/federationsender/storage/shared"
"github.com/matrix-org/dendrite/federationsender/storage/sqlite3/deltas"
"github.com/matrix-org/dendrite/internal/caching"
diff --git a/go.mod b/go.mod
index fc60814a..708639d3 100644
--- a/go.mod
+++ b/go.mod
@@ -29,7 +29,7 @@ require (
github.com/lucas-clemente/quic-go v0.19.3
github.com/matrix-org/dugong v0.0.0-20180820122854-51a565b5666b
github.com/matrix-org/go-http-js-libp2p v0.0.0-20200518170932-783164aeeda4
- github.com/matrix-org/go-sqlite3-js v0.0.0-20210625141222-bd2b7124cee8
+ github.com/matrix-org/go-sqlite3-js v0.0.0-20210709140738-b0d1ba599a6d
github.com/matrix-org/gomatrix v0.0.0-20210324163249-be2af5ef2e16
github.com/matrix-org/gomatrixserverlib v0.0.0-20210719140634-f44a103bb12e
github.com/matrix-org/naffka v0.0.0-20210623111924-14ff508b58e0
diff --git a/go.sum b/go.sum
index e1ea9d00..90f1ccfc 100644
--- a/go.sum
+++ b/go.sum
@@ -1024,8 +1024,8 @@ github.com/matrix-org/dugong v0.0.0-20180820122854-51a565b5666b h1:xpcmnpfUImRC4
github.com/matrix-org/dugong v0.0.0-20180820122854-51a565b5666b/go.mod h1:NgPCr+UavRGH6n5jmdX8DuqFZ4JiCWIJoZiuhTRLSUg=
github.com/matrix-org/go-http-js-libp2p v0.0.0-20200518170932-783164aeeda4 h1:eqE5OnGx9ZMWmrRbD3KF/3KtTunw0iQulI7YxOIdxo4=
github.com/matrix-org/go-http-js-libp2p v0.0.0-20200518170932-783164aeeda4/go.mod h1:3WluEZ9QXSwU30tWYqktnpC1x9mwZKx1r8uAv8Iq+a4=
-github.com/matrix-org/go-sqlite3-js v0.0.0-20210625141222-bd2b7124cee8 h1:/FKUeUlCATr1gXxYqlaJgH8FW/sw0Jz8t7s8BIlECfg=
-github.com/matrix-org/go-sqlite3-js v0.0.0-20210625141222-bd2b7124cee8/go.mod h1:e+cg2q7C7yE5QnAXgzo512tgFh1RbQLC0+jozuegKgo=
+github.com/matrix-org/go-sqlite3-js v0.0.0-20210709140738-b0d1ba599a6d h1:mGhPVaTht5NViFN/UpdrIlRApmH2FWcVaKUH5MdBKiY=
+github.com/matrix-org/go-sqlite3-js v0.0.0-20210709140738-b0d1ba599a6d/go.mod h1:e+cg2q7C7yE5QnAXgzo512tgFh1RbQLC0+jozuegKgo=
github.com/matrix-org/gomatrix v0.0.0-20190528120928-7df988a63f26/go.mod h1:3fxX6gUjWyI/2Bt7J1OLhpCzOfO/bB3AiX0cJtEKud0=
github.com/matrix-org/gomatrix v0.0.0-20210324163249-be2af5ef2e16 h1:ZtO5uywdd5dLDCud4r0r55eP4j9FuUNpl60Gmntcop4=
github.com/matrix-org/gomatrix v0.0.0-20210324163249-be2af5ef2e16/go.mod h1:/gBX06Kw0exX1HrwmoBibFA98yBk/jxKpGVeyQbff+s=
diff --git a/internal/sqlutil/sql.go b/internal/sqlutil/sql.go
index a3885d66..6cf17bea 100644
--- a/internal/sqlutil/sql.go
+++ b/internal/sqlutil/sql.go
@@ -19,7 +19,6 @@ import (
"database/sql"
"errors"
"fmt"
- "runtime"
"strings"
"github.com/matrix-org/util"
@@ -113,13 +112,6 @@ func QueryVariadicOffset(count, offset int) string {
return str
}
-func SQLiteDriverName() string {
- if runtime.GOOS == "js" {
- return "sqlite3_js"
- }
- return "sqlite3"
-}
-
func minOfInts(a, b int) int {
if a <= b {
return a
diff --git a/internal/sqlutil/trace.go b/internal/sqlutil/trace.go
index 5138aa59..51eaa1b4 100644
--- a/internal/sqlutil/trace.go
+++ b/internal/sqlutil/trace.go
@@ -104,7 +104,7 @@ func Open(dbProperties *config.DatabaseOptions) (*sql.DB, error) {
var driverName, dsn string
switch {
case dbProperties.ConnectionString.IsSQLite():
- driverName = SQLiteDriverName()
+ driverName = "sqlite3"
dsn, err = ParseFileURI(dbProperties.ConnectionString)
if err != nil {
return nil, fmt.Errorf("ParseFileURI: %w", err)
@@ -123,7 +123,7 @@ func Open(dbProperties *config.DatabaseOptions) (*sql.DB, error) {
if err != nil {
return nil, err
}
- if driverName != SQLiteDriverName() {
+ if driverName != "sqlite3" {
logrus.WithFields(logrus.Fields{
"MaxOpenConns": dbProperties.MaxOpenConns(),
"MaxIdleConns": dbProperties.MaxIdleConns(),
diff --git a/mediaapi/storage/sqlite3/storage.go b/mediaapi/storage/sqlite3/storage.go
index 0edfc08e..fa442173 100644
--- a/mediaapi/storage/sqlite3/storage.go
+++ b/mediaapi/storage/sqlite3/storage.go
@@ -24,7 +24,6 @@ import (
"github.com/matrix-org/dendrite/mediaapi/types"
"github.com/matrix-org/dendrite/setup/config"
"github.com/matrix-org/gomatrixserverlib"
- _ "github.com/mattn/go-sqlite3"
)
// Database is used to store metadata about a repository of media files.
diff --git a/roomserver/storage/sqlite3/storage.go b/roomserver/storage/sqlite3/storage.go
index c07ab507..e081acdb 100644
--- a/roomserver/storage/sqlite3/storage.go
+++ b/roomserver/storage/sqlite3/storage.go
@@ -19,8 +19,6 @@ import (
"context"
"database/sql"
- _ "github.com/mattn/go-sqlite3"
-
"github.com/matrix-org/dendrite/internal/caching"
"github.com/matrix-org/dendrite/internal/sqlutil"
"github.com/matrix-org/dendrite/roomserver/storage/shared"
diff --git a/signingkeyserver/storage/sqlite3/keydb.go b/signingkeyserver/storage/sqlite3/keydb.go
index 8825d697..1f85a09c 100644
--- a/signingkeyserver/storage/sqlite3/keydb.go
+++ b/signingkeyserver/storage/sqlite3/keydb.go
@@ -23,8 +23,6 @@ import (
"github.com/matrix-org/dendrite/internal/sqlutil"
"github.com/matrix-org/dendrite/setup/config"
"github.com/matrix-org/gomatrixserverlib"
-
- _ "github.com/mattn/go-sqlite3"
)
// A Database implements gomatrixserverlib.KeyDatabase and is used to store
diff --git a/syncapi/storage/sqlite3/syncserver.go b/syncapi/storage/sqlite3/syncserver.go
index ae0647fc..706d43f8 100644
--- a/syncapi/storage/sqlite3/syncserver.go
+++ b/syncapi/storage/sqlite3/syncserver.go
@@ -18,9 +18,6 @@ package sqlite3
import (
"database/sql"
- // Import the sqlite3 package
- _ "github.com/mattn/go-sqlite3"
-
"github.com/matrix-org/dendrite/internal/sqlutil"
"github.com/matrix-org/dendrite/setup/config"
"github.com/matrix-org/dendrite/syncapi/storage/shared"
diff --git a/userapi/storage/devices/sqlite3/storage.go b/userapi/storage/devices/sqlite3/storage.go
index 8afa9fb4..53864483 100644
--- a/userapi/storage/devices/sqlite3/storage.go
+++ b/userapi/storage/devices/sqlite3/storage.go
@@ -25,8 +25,6 @@ import (
"github.com/matrix-org/dendrite/userapi/api"
"github.com/matrix-org/dendrite/userapi/storage/devices/sqlite3/deltas"
"github.com/matrix-org/gomatrixserverlib"
-
- _ "github.com/mattn/go-sqlite3"
)
// The length of generated device IDs