aboutsummaryrefslogtreecommitdiff
path: root/federationsender/storage/shared
diff options
context:
space:
mode:
Diffstat (limited to 'federationsender/storage/shared')
-rw-r--r--federationsender/storage/shared/storage.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/federationsender/storage/shared/storage.go b/federationsender/storage/shared/storage.go
index 4c80c079..d5731f31 100644
--- a/federationsender/storage/shared/storage.go
+++ b/federationsender/storage/shared/storage.go
@@ -148,6 +148,20 @@ func (d *Database) StoreJSON(
}, nil
}
+func (d *Database) PurgeRoomState(
+ ctx context.Context, roomID string,
+) error {
+ return d.Writer.Do(d.DB, nil, func(txn *sql.Tx) error {
+ // If the event is a create event then we'll delete all of the existing
+ // data for the room. The only reason that a create event would be replayed
+ // to us in this way is if we're about to receive the entire room state.
+ if err := d.FederationSenderJoinedHosts.DeleteJoinedHostsForRoom(ctx, txn, roomID); err != nil {
+ return fmt.Errorf("d.FederationSenderJoinedHosts.DeleteJoinedHosts: %w", err)
+ }
+ return nil
+ })
+}
+
func (d *Database) AddServerToBlacklist(serverName gomatrixserverlib.ServerName) error {
return d.Writer.Do(d.DB, nil, func(txn *sql.Tx) error {
return d.FederationSenderBlacklist.InsertBlacklist(context.TODO(), txn, serverName)