aboutsummaryrefslogtreecommitdiff
path: root/federationsender/storage
diff options
context:
space:
mode:
Diffstat (limited to 'federationsender/storage')
-rw-r--r--federationsender/storage/interface.go4
-rw-r--r--federationsender/storage/postgres/joined_hosts_table.go10
-rw-r--r--federationsender/storage/postgres/room_table.go8
-rw-r--r--federationsender/storage/postgres/storage.go8
-rw-r--r--federationsender/storage/sqlite3/joined_hosts_table.go10
-rw-r--r--federationsender/storage/sqlite3/room_table.go8
-rw-r--r--federationsender/storage/sqlite3/storage.go8
-rw-r--r--federationsender/storage/storage.go4
-rw-r--r--federationsender/storage/storage_wasm.go4
9 files changed, 32 insertions, 32 deletions
diff --git a/federationsender/storage/interface.go b/federationsender/storage/interface.go
index ae295647..be195382 100644
--- a/federationsender/storage/interface.go
+++ b/federationsender/storage/interface.go
@@ -17,12 +17,12 @@ package storage
import (
"context"
- "github.com/matrix-org/dendrite/common"
"github.com/matrix-org/dendrite/federationsender/types"
+ "github.com/matrix-org/dendrite/internal"
)
type Database interface {
- common.PartitionStorer
+ internal.PartitionStorer
UpdateRoom(ctx context.Context, roomID, oldEventID, newEventID string, addHosts []types.JoinedHost, removeHosts []string) (joinedHosts []types.JoinedHost, err error)
GetJoinedHosts(ctx context.Context, roomID string) ([]types.JoinedHost, error)
}
diff --git a/federationsender/storage/postgres/joined_hosts_table.go b/federationsender/storage/postgres/joined_hosts_table.go
index b3c45abd..1b898f48 100644
--- a/federationsender/storage/postgres/joined_hosts_table.go
+++ b/federationsender/storage/postgres/joined_hosts_table.go
@@ -20,8 +20,8 @@ import (
"database/sql"
"github.com/lib/pq"
- "github.com/matrix-org/dendrite/common"
"github.com/matrix-org/dendrite/federationsender/types"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/gomatrixserverlib"
)
@@ -85,7 +85,7 @@ func (s *joinedHostsStatements) insertJoinedHosts(
roomID, eventID string,
serverName gomatrixserverlib.ServerName,
) error {
- stmt := common.TxStmt(txn, s.insertJoinedHostsStmt)
+ stmt := internal.TxStmt(txn, s.insertJoinedHostsStmt)
_, err := stmt.ExecContext(ctx, roomID, eventID, serverName)
return err
}
@@ -93,7 +93,7 @@ func (s *joinedHostsStatements) insertJoinedHosts(
func (s *joinedHostsStatements) deleteJoinedHosts(
ctx context.Context, txn *sql.Tx, eventIDs []string,
) error {
- stmt := common.TxStmt(txn, s.deleteJoinedHostsStmt)
+ stmt := internal.TxStmt(txn, s.deleteJoinedHostsStmt)
_, err := stmt.ExecContext(ctx, pq.StringArray(eventIDs))
return err
}
@@ -101,7 +101,7 @@ func (s *joinedHostsStatements) deleteJoinedHosts(
func (s *joinedHostsStatements) selectJoinedHostsWithTx(
ctx context.Context, txn *sql.Tx, roomID string,
) ([]types.JoinedHost, error) {
- stmt := common.TxStmt(txn, s.selectJoinedHostsStmt)
+ stmt := internal.TxStmt(txn, s.selectJoinedHostsStmt)
return joinedHostsFromStmt(ctx, stmt, roomID)
}
@@ -118,7 +118,7 @@ func joinedHostsFromStmt(
if err != nil {
return nil, err
}
- defer common.CloseAndLogIfError(ctx, rows, "joinedHostsFromStmt: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "joinedHostsFromStmt: rows.close() failed")
var result []types.JoinedHost
for rows.Next() {
diff --git a/federationsender/storage/postgres/room_table.go b/federationsender/storage/postgres/room_table.go
index a64424b4..c945475b 100644
--- a/federationsender/storage/postgres/room_table.go
+++ b/federationsender/storage/postgres/room_table.go
@@ -19,7 +19,7 @@ import (
"context"
"database/sql"
- "github.com/matrix-org/dendrite/common"
+ "github.com/matrix-org/dendrite/internal"
)
const roomSchema = `
@@ -71,7 +71,7 @@ func (s *roomStatements) prepare(db *sql.DB) (err error) {
func (s *roomStatements) insertRoom(
ctx context.Context, txn *sql.Tx, roomID string,
) error {
- _, err := common.TxStmt(txn, s.insertRoomStmt).ExecContext(ctx, roomID)
+ _, err := internal.TxStmt(txn, s.insertRoomStmt).ExecContext(ctx, roomID)
return err
}
@@ -82,7 +82,7 @@ func (s *roomStatements) selectRoomForUpdate(
ctx context.Context, txn *sql.Tx, roomID string,
) (string, error) {
var lastEventID string
- stmt := common.TxStmt(txn, s.selectRoomForUpdateStmt)
+ stmt := internal.TxStmt(txn, s.selectRoomForUpdateStmt)
err := stmt.QueryRowContext(ctx, roomID).Scan(&lastEventID)
if err != nil {
return "", err
@@ -95,7 +95,7 @@ func (s *roomStatements) selectRoomForUpdate(
func (s *roomStatements) updateRoom(
ctx context.Context, txn *sql.Tx, roomID, lastEventID string,
) error {
- stmt := common.TxStmt(txn, s.updateRoomStmt)
+ stmt := internal.TxStmt(txn, s.updateRoomStmt)
_, err := stmt.ExecContext(ctx, roomID, lastEventID)
return err
}
diff --git a/federationsender/storage/postgres/storage.go b/federationsender/storage/postgres/storage.go
index c3892ac1..a4733a20 100644
--- a/federationsender/storage/postgres/storage.go
+++ b/federationsender/storage/postgres/storage.go
@@ -19,8 +19,8 @@ import (
"context"
"database/sql"
- "github.com/matrix-org/dendrite/common"
"github.com/matrix-org/dendrite/federationsender/types"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/internal/sqlutil"
)
@@ -28,12 +28,12 @@ import (
type Database struct {
joinedHostsStatements
roomStatements
- common.PartitionOffsetStatements
+ internal.PartitionOffsetStatements
db *sql.DB
}
// NewDatabase opens a new database
-func NewDatabase(dataSourceName string, dbProperties common.DbProperties) (*Database, error) {
+func NewDatabase(dataSourceName string, dbProperties internal.DbProperties) (*Database, error) {
var result Database
var err error
if result.db, err = sqlutil.Open("postgres", dataSourceName, dbProperties); err != nil {
@@ -70,7 +70,7 @@ func (d *Database) UpdateRoom(
addHosts []types.JoinedHost,
removeHosts []string,
) (joinedHosts []types.JoinedHost, err error) {
- err = common.WithTransaction(d.db, func(txn *sql.Tx) error {
+ err = internal.WithTransaction(d.db, func(txn *sql.Tx) error {
err = d.insertRoom(ctx, txn, roomID)
if err != nil {
return err
diff --git a/federationsender/storage/sqlite3/joined_hosts_table.go b/federationsender/storage/sqlite3/joined_hosts_table.go
index 466ae499..795d3320 100644
--- a/federationsender/storage/sqlite3/joined_hosts_table.go
+++ b/federationsender/storage/sqlite3/joined_hosts_table.go
@@ -19,8 +19,8 @@ import (
"context"
"database/sql"
- "github.com/matrix-org/dendrite/common"
"github.com/matrix-org/dendrite/federationsender/types"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/gomatrixserverlib"
)
@@ -84,7 +84,7 @@ func (s *joinedHostsStatements) insertJoinedHosts(
roomID, eventID string,
serverName gomatrixserverlib.ServerName,
) error {
- stmt := common.TxStmt(txn, s.insertJoinedHostsStmt)
+ stmt := internal.TxStmt(txn, s.insertJoinedHostsStmt)
_, err := stmt.ExecContext(ctx, roomID, eventID, serverName)
return err
}
@@ -93,7 +93,7 @@ func (s *joinedHostsStatements) deleteJoinedHosts(
ctx context.Context, txn *sql.Tx, eventIDs []string,
) error {
for _, eventID := range eventIDs {
- stmt := common.TxStmt(txn, s.deleteJoinedHostsStmt)
+ stmt := internal.TxStmt(txn, s.deleteJoinedHostsStmt)
if _, err := stmt.ExecContext(ctx, eventID); err != nil {
return err
}
@@ -104,7 +104,7 @@ func (s *joinedHostsStatements) deleteJoinedHosts(
func (s *joinedHostsStatements) selectJoinedHostsWithTx(
ctx context.Context, txn *sql.Tx, roomID string,
) ([]types.JoinedHost, error) {
- stmt := common.TxStmt(txn, s.selectJoinedHostsStmt)
+ stmt := internal.TxStmt(txn, s.selectJoinedHostsStmt)
return joinedHostsFromStmt(ctx, stmt, roomID)
}
@@ -121,7 +121,7 @@ func joinedHostsFromStmt(
if err != nil {
return nil, err
}
- defer common.CloseAndLogIfError(ctx, rows, "joinedHostsFromStmt: rows.close() failed")
+ defer internal.CloseAndLogIfError(ctx, rows, "joinedHostsFromStmt: rows.close() failed")
var result []types.JoinedHost
for rows.Next() {
diff --git a/federationsender/storage/sqlite3/room_table.go b/federationsender/storage/sqlite3/room_table.go
index 6361400d..4bf9ab81 100644
--- a/federationsender/storage/sqlite3/room_table.go
+++ b/federationsender/storage/sqlite3/room_table.go
@@ -19,7 +19,7 @@ import (
"context"
"database/sql"
- "github.com/matrix-org/dendrite/common"
+ "github.com/matrix-org/dendrite/internal"
)
const roomSchema = `
@@ -71,7 +71,7 @@ func (s *roomStatements) prepare(db *sql.DB) (err error) {
func (s *roomStatements) insertRoom(
ctx context.Context, txn *sql.Tx, roomID string,
) error {
- _, err := common.TxStmt(txn, s.insertRoomStmt).ExecContext(ctx, roomID)
+ _, err := internal.TxStmt(txn, s.insertRoomStmt).ExecContext(ctx, roomID)
return err
}
@@ -82,7 +82,7 @@ func (s *roomStatements) selectRoomForUpdate(
ctx context.Context, txn *sql.Tx, roomID string,
) (string, error) {
var lastEventID string
- stmt := common.TxStmt(txn, s.selectRoomForUpdateStmt)
+ stmt := internal.TxStmt(txn, s.selectRoomForUpdateStmt)
err := stmt.QueryRowContext(ctx, roomID).Scan(&lastEventID)
if err != nil {
return "", err
@@ -95,7 +95,7 @@ func (s *roomStatements) selectRoomForUpdate(
func (s *roomStatements) updateRoom(
ctx context.Context, txn *sql.Tx, roomID, lastEventID string,
) error {
- stmt := common.TxStmt(txn, s.updateRoomStmt)
+ stmt := internal.TxStmt(txn, s.updateRoomStmt)
_, err := stmt.ExecContext(ctx, roomID, lastEventID)
return err
}
diff --git a/federationsender/storage/sqlite3/storage.go b/federationsender/storage/sqlite3/storage.go
index 77274447..dc60ebb0 100644
--- a/federationsender/storage/sqlite3/storage.go
+++ b/federationsender/storage/sqlite3/storage.go
@@ -21,8 +21,8 @@ import (
_ "github.com/mattn/go-sqlite3"
- "github.com/matrix-org/dendrite/common"
"github.com/matrix-org/dendrite/federationsender/types"
+ "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/internal/sqlutil"
)
@@ -30,7 +30,7 @@ import (
type Database struct {
joinedHostsStatements
roomStatements
- common.PartitionOffsetStatements
+ internal.PartitionOffsetStatements
db *sql.DB
}
@@ -38,7 +38,7 @@ type Database struct {
func NewDatabase(dataSourceName string) (*Database, error) {
var result Database
var err error
- if result.db, err = sqlutil.Open(common.SQLiteDriverName(), dataSourceName, nil); err != nil {
+ if result.db, err = sqlutil.Open(internal.SQLiteDriverName(), dataSourceName, nil); err != nil {
return nil, err
}
if err = result.prepare(); err != nil {
@@ -72,7 +72,7 @@ func (d *Database) UpdateRoom(
addHosts []types.JoinedHost,
removeHosts []string,
) (joinedHosts []types.JoinedHost, err error) {
- err = common.WithTransaction(d.db, func(txn *sql.Tx) error {
+ err = internal.WithTransaction(d.db, func(txn *sql.Tx) error {
err = d.insertRoom(ctx, txn, roomID)
if err != nil {
return err
diff --git a/federationsender/storage/storage.go b/federationsender/storage/storage.go
index d481e58a..df8433eb 100644
--- a/federationsender/storage/storage.go
+++ b/federationsender/storage/storage.go
@@ -19,13 +19,13 @@ package storage
import (
"net/url"
- "github.com/matrix-org/dendrite/common"
"github.com/matrix-org/dendrite/federationsender/storage/postgres"
"github.com/matrix-org/dendrite/federationsender/storage/sqlite3"
+ "github.com/matrix-org/dendrite/internal"
)
// NewDatabase opens a new database
-func NewDatabase(dataSourceName string, dbProperties common.DbProperties) (Database, error) {
+func NewDatabase(dataSourceName string, dbProperties internal.DbProperties) (Database, error) {
uri, err := url.Parse(dataSourceName)
if err != nil {
return postgres.NewDatabase(dataSourceName, dbProperties)
diff --git a/federationsender/storage/storage_wasm.go b/federationsender/storage/storage_wasm.go
index 44d4c806..f593fd44 100644
--- a/federationsender/storage/storage_wasm.go
+++ b/federationsender/storage/storage_wasm.go
@@ -18,14 +18,14 @@ import (
"fmt"
"net/url"
- "github.com/matrix-org/dendrite/common"
"github.com/matrix-org/dendrite/federationsender/storage/sqlite3"
+ "github.com/matrix-org/dendrite/internal"
)
// NewDatabase opens a new database
func NewDatabase(
dataSourceName string,
- dbProperties common.DbProperties, // nolint:unparam
+ dbProperties internal.DbProperties, // nolint:unparam
) (Database, error) {
uri, err := url.Parse(dataSourceName)
if err != nil {