diff --git a/federationapi/storage/postgres/joined_hosts_table.go b/federationapi/storage/postgres/joined_hosts_table.go index d28aae1d0..9a3977560 100644 --- a/federationapi/storage/postgres/joined_hosts_table.go +++ b/federationapi/storage/postgres/joined_hosts_table.go @@ -71,9 +71,6 @@ const selectJoinedHostsForRoomsExcludingBlacklistedSQL = "" + " SELECT server_name FROM federationsender_blacklist WHERE j.server_name = server_name" + ");" -const purgeJoinedHostsSQL = "" + - "DELETE FROM federationsender_joined_hosts WHERE room_id = $1" - type joinedHostsStatements struct { db *sql.DB insertJoinedHostsStmt *sql.Stmt @@ -83,7 +80,6 @@ type joinedHostsStatements struct { selectAllJoinedHostsStmt *sql.Stmt selectJoinedHostsForRoomsStmt *sql.Stmt selectJoinedHostsForRoomsExcludingBlacklistedStmt *sql.Stmt - purgeJoinedHostsStmt *sql.Stmt } func NewPostgresJoinedHostsTable(db *sql.DB) (s *joinedHostsStatements, err error) { @@ -115,9 +111,6 @@ func NewPostgresJoinedHostsTable(db *sql.DB) (s *joinedHostsStatements, err erro if s.selectJoinedHostsForRoomsExcludingBlacklistedStmt, err = s.db.Prepare(selectJoinedHostsForRoomsExcludingBlacklistedSQL); err != nil { return } - if s.purgeJoinedHostsStmt, err = s.db.Prepare(purgeJoinedHostsSQL); err != nil { - return - } return } @@ -230,10 +223,3 @@ func joinedHostsFromStmt( return result, rows.Err() } - -func (s *joinedHostsStatements) PurgeJoinedHosts( - ctx context.Context, txn *sql.Tx, roomID string, -) error { - _, err := sqlutil.TxStmt(txn, s.purgeJoinedHostsStmt).ExecContext(ctx, roomID) - return err -} diff --git a/federationapi/storage/shared/storage.go b/federationapi/storage/shared/storage.go index c4e6a6883..6cda55725 100644 --- a/federationapi/storage/shared/storage.go +++ b/federationapi/storage/shared/storage.go @@ -262,7 +262,7 @@ func (d *Database) GetNotaryKeys( func (d *Database) PurgeRoom(ctx context.Context, roomID string) error { return d.Writer.Do(d.DB, nil, func(txn *sql.Tx) error { - if err := d.FederationJoinedHosts.PurgeJoinedHosts(ctx, txn, roomID); err != nil { + if err := d.FederationJoinedHosts.DeleteJoinedHostsForRoom(ctx, txn, roomID); err != nil { return fmt.Errorf("failed to purge joined hosts: %w", err) } if err := d.FederationInboundPeeks.DeleteInboundPeeks(ctx, txn, roomID); err != nil { diff --git a/federationapi/storage/sqlite3/joined_hosts_table.go b/federationapi/storage/sqlite3/joined_hosts_table.go index 15150bd7a..83112c150 100644 --- a/federationapi/storage/sqlite3/joined_hosts_table.go +++ b/federationapi/storage/sqlite3/joined_hosts_table.go @@ -18,7 +18,6 @@ package sqlite3 import ( "context" "database/sql" - "fmt" "strings" "github.com/matrix-org/dendrite/federationapi/types" @@ -227,9 +226,3 @@ func joinedHostsFromStmt( return result, nil } - -func (s *joinedHostsStatements) PurgeJoinedHosts( - ctx context.Context, txn *sql.Tx, roomID string, -) error { - return fmt.Errorf("not implemented on SQLite") -} diff --git a/federationapi/storage/tables/interface.go b/federationapi/storage/tables/interface.go index 4af7db957..2b36edb46 100644 --- a/federationapi/storage/tables/interface.go +++ b/federationapi/storage/tables/interface.go @@ -57,7 +57,6 @@ type FederationJoinedHosts interface { SelectJoinedHosts(ctx context.Context, roomID string) ([]types.JoinedHost, error) SelectAllJoinedHosts(ctx context.Context) ([]gomatrixserverlib.ServerName, error) SelectJoinedHostsForRooms(ctx context.Context, roomIDs []string, excludingBlacklisted bool) ([]gomatrixserverlib.ServerName, error) - PurgeJoinedHosts(ctx context.Context, txn *sql.Tx, roomID string) error } type FederationBlacklist interface {