From 9a077b044098dab74adad47e4e37b63a8b66c6b1 Mon Sep 17 00:00:00 2001 From: Brendan Abolivier Date: Fri, 11 Aug 2017 17:41:17 +0100 Subject: [PATCH] Use NIDs instead of IDs for alias and room retrieval --- .../dendrite/roomserver/alias/alias.go | 53 +++++++++---- .../roomserver/publicroom/public_room.go | 39 ++++++---- .../roomserver/storage/room_aliases_table.go | 75 +++++++++++-------- .../roomserver/storage/rooms_table.go | 59 +++++++++++++-- .../dendrite/roomserver/storage/storage.go | 38 ++++++---- 5 files changed, 179 insertions(+), 85 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/roomserver/alias/alias.go b/src/github.com/matrix-org/dendrite/roomserver/alias/alias.go index faf91bc47..1a35d6770 100644 --- a/src/github.com/matrix-org/dendrite/roomserver/alias/alias.go +++ b/src/github.com/matrix-org/dendrite/roomserver/alias/alias.go @@ -23,21 +23,30 @@ import ( "github.com/matrix-org/dendrite/common" "github.com/matrix-org/dendrite/common/config" "github.com/matrix-org/dendrite/roomserver/api" + "github.com/matrix-org/dendrite/roomserver/types" "github.com/matrix-org/gomatrixserverlib" "github.com/matrix-org/util" ) // RoomserverAliasAPIDatabase has the storage APIs needed to implement the alias API. type RoomserverAliasAPIDatabase interface { - // Save a given room alias with the room ID it refers to. + // Lookup the numeric ID for the room. + // Returns 0 if the room doesn't exists. // Returns an error if there was a problem talking to the database. - SetRoomAlias(alias string, roomID string) error - // Lookup the room ID a given alias refers to. + RoomNID(roomID string) (types.RoomNID, error) + // Lookup the ID of a room identified by a given numeric ID. + // Returns an error if there was a problem talking to the database or if no + // room matches the given numeric ID. + RoomID(roomNID types.RoomNID) (string, error) + // Save a given room alias with the room numeric ID it refers to. // Returns an error if there was a problem talking to the database. - GetRoomIDFromAlias(alias string) (string, error) - // Lookup all aliases referring to a given room ID. + SetRoomAlias(alias string, roomNID types.RoomNID) error + // Lookup the room numeric ID a given alias refers to. // Returns an error if there was a problem talking to the database. - GetAliasesFromRoomID(roomID string) ([]string, error) + GetRoomNIDFromAlias(alias string) (types.RoomNID, error) + // Lookup all aliases referring to a given room numeric ID. + // Returns an error if there was a problem talking to the database. + GetAliasesFromRoomNID(roomNID types.RoomNID) ([]string, error) // Remove a given room alias. // Returns an error if there was a problem talking to the database. RemoveRoomAlias(alias string) error @@ -57,24 +66,28 @@ func (r *RoomserverAliasAPI) SetRoomAlias( response *api.SetRoomAliasResponse, ) error { // Check if the alias isn't already referring to a room - roomID, err := r.DB.GetRoomIDFromAlias(request.Alias) + roomNID, err := r.DB.GetRoomNIDFromAlias(request.Alias) if err != nil { return err } - if len(roomID) > 0 { + if roomNID != 0 { // If the alias already exists, stop the process response.AliasExists = true return nil } response.AliasExists = false + roomNID, err = r.DB.RoomNID(request.RoomID) + if err != nil { + return err + } // Save the new alias - if err := r.DB.SetRoomAlias(request.Alias, request.RoomID); err != nil { + if err := r.DB.SetRoomAlias(request.Alias, roomNID); err != nil { return err } // Send a m.room.aliases event with the updated list of aliases for this room - if err := r.sendUpdatedAliasesEvent(request.UserID, request.RoomID); err != nil { + if err := r.sendUpdatedAliasesEvent(request.UserID, request.RoomID, roomNID); err != nil { return err } @@ -87,7 +100,12 @@ func (r *RoomserverAliasAPI) GetAliasRoomID( response *api.GetAliasRoomIDResponse, ) error { // Lookup the room ID in the database - roomID, err := r.DB.GetRoomIDFromAlias(request.Alias) + roomNID, err := r.DB.GetRoomNIDFromAlias(request.Alias) + if err != nil { + return err + } + + roomID, err := r.DB.RoomID(roomNID) if err != nil { return err } @@ -102,7 +120,12 @@ func (r *RoomserverAliasAPI) RemoveRoomAlias( response *api.RemoveRoomAliasResponse, ) error { // Lookup the room ID in the database - roomID, err := r.DB.GetRoomIDFromAlias(request.Alias) + roomNID, err := r.DB.GetRoomNIDFromAlias(request.Alias) + if err != nil { + return err + } + + roomID, err := r.DB.RoomID(roomNID) if err != nil { return err } @@ -113,7 +136,7 @@ func (r *RoomserverAliasAPI) RemoveRoomAlias( } // Send an updated m.room.aliases event - if err := r.sendUpdatedAliasesEvent(request.UserID, roomID); err != nil { + if err := r.sendUpdatedAliasesEvent(request.UserID, roomID, roomNID); err != nil { return err } @@ -126,7 +149,7 @@ type roomAliasesContent struct { // Build the updated m.room.aliases event to send to the room after addition or // removal of an alias -func (r *RoomserverAliasAPI) sendUpdatedAliasesEvent(userID string, roomID string) error { +func (r *RoomserverAliasAPI) sendUpdatedAliasesEvent(userID string, roomID string, roomNID types.RoomNID) error { serverName := string(r.Cfg.Matrix.ServerName) builder := gomatrixserverlib.EventBuilder{ @@ -138,7 +161,7 @@ func (r *RoomserverAliasAPI) sendUpdatedAliasesEvent(userID string, roomID strin // Retrieve the updated list of aliases, marhal it and set it as the // event's content - aliases, err := r.DB.GetAliasesFromRoomID(roomID) + aliases, err := r.DB.GetAliasesFromRoomNID(roomNID) if err != nil { return err } diff --git a/src/github.com/matrix-org/dendrite/roomserver/publicroom/public_room.go b/src/github.com/matrix-org/dendrite/roomserver/publicroom/public_room.go index 7045c367b..6fa68cd8a 100644 --- a/src/github.com/matrix-org/dendrite/roomserver/publicroom/public_room.go +++ b/src/github.com/matrix-org/dendrite/roomserver/publicroom/public_room.go @@ -33,23 +33,27 @@ type RoomserverPublicRoomAPIDatabase interface { // Returns 0 if the room doesn't exists. // Returns an error if there was a problem talking to the database. RoomNID(roomID string) (types.RoomNID, error) + // Lookup the room IDs matching a batch of room numeric IDs, ordered by + // numeric ID (ie map[roomNID] = roomID). + // Returns an error if the retrieval failed. + RoomIDs([]types.RoomNID) (map[types.RoomNID]string, error) // Checks the visibility of the room identified by the given numeric ID. // Returns true if the room is publicly visible, returns false if not. // If there's no room matching this numeric ID, or if the retrieval failed, // returns an error. IsRoomPublic(roomNID types.RoomNID) (bool, error) - // Returns an array of string containing the room IDs of the rooms that are - // publicly visible. + // Returns an array of string containing the room numeric IDs of the rooms + // that are publicly visible. // Returns an error if the retrieval failed. - GetPublicRoomIDs() ([]string, error) + GetPublicRoomNIDs() ([]types.RoomNID, error) // Updates the visibility for a room to the given value: true means that the // room is publicly visible, false means that the room isn't publicly visible. // Returns an error if the update failed. UpdateRoomVisibility(roomNID types.RoomNID, visibility bool) error - // Returns a map of the aliases bound to a given set of room IDs, ordered - // by room ID (ie map[roomID] = []alias) + // Returns a map of the aliases bound to a given set of room numeric IDs, + // ordered by room NID (ie map[roomNID] = []alias) // Returns an error if the retrieval failed - GetAliasesFromRoomIDs(roomIDs []string) (map[string][]string, error) + GetAliasesFromRoomNIDs(roomNIDs []types.RoomNID) (map[types.RoomNID][]string, error) } // RoomserverPublicRoomAPI is an implementation of api.RoomserverPublicRoomAPI @@ -120,12 +124,16 @@ func (r *RoomserverPublicRoomAPI) GetPublicRooms( return err } - roomIDs, err := r.DB.GetPublicRoomIDs() + roomNIDs, err := r.DB.GetPublicRoomNIDs() if err != nil { return err } - aliases, err := r.DB.GetAliasesFromRoomIDs(roomIDs) + aliases, err := r.DB.GetAliasesFromRoomNIDs(roomNIDs) + if err != nil { + return err + } + roomIDs, err := r.DB.RoomIDs(roomNIDs) if err != nil { return err } @@ -133,9 +141,9 @@ func (r *RoomserverPublicRoomAPI) GetPublicRooms( chunks := []api.PublicRoomsChunk{} // Iterate over the array of aliases instead of the array of rooms, because // a room must have at least one alias to be listed - for room, as := range aliases { + for roomNID, as := range aliases { chunk := api.PublicRoomsChunk{ - RoomID: room, + RoomID: roomIDs[roomNID], Aliases: as, NumJoinedMembers: 0, WorldReadable: true, @@ -144,13 +152,14 @@ func (r *RoomserverPublicRoomAPI) GetPublicRooms( chunks = append(chunks, chunk) } - if limit == 0 { - // If limit is 0, don't limit the results - response.Chunks = chunks[offset:] - } else { - response.Chunks = chunks[offset:limit] + chunks = chunks[offset:] + + if len(chunks) >= int(limit) { + chunks = chunks[offset:limit] } + response.Chunks = chunks + return nil } diff --git a/src/github.com/matrix-org/dendrite/roomserver/storage/room_aliases_table.go b/src/github.com/matrix-org/dendrite/roomserver/storage/room_aliases_table.go index 2c47a35d5..00f35a0f4 100644 --- a/src/github.com/matrix-org/dendrite/roomserver/storage/room_aliases_table.go +++ b/src/github.com/matrix-org/dendrite/roomserver/storage/room_aliases_table.go @@ -18,6 +18,7 @@ import ( "database/sql" "github.com/lib/pq" + "github.com/matrix-org/dendrite/roomserver/types" ) const roomAliasesSchema = ` @@ -25,34 +26,34 @@ const roomAliasesSchema = ` CREATE TABLE IF NOT EXISTS roomserver_room_aliases ( -- Alias of the room alias TEXT NOT NULL PRIMARY KEY, - -- Room ID the alias refers to - room_id TEXT NOT NULL + -- Room numeric ID the alias refers to + room_nid TEXT NOT NULL ); -CREATE UNIQUE INDEX IF NOT EXISTS roomserver_room_id_idx ON roomserver_room_aliases(room_id); +CREATE UNIQUE INDEX IF NOT EXISTS roomserver_room_nid_idx ON roomserver_room_aliases(room_nid); ` const insertRoomAliasSQL = "" + - "INSERT INTO roomserver_room_aliases (alias, room_id) VALUES ($1, $2)" + "INSERT INTO roomserver_room_aliases (alias, room_nid) VALUES ($1, $2)" -const selectRoomIDFromAliasSQL = "" + - "SELECT room_id FROM roomserver_room_aliases WHERE alias = $1" +const selectRoomNIDFromAliasSQL = "" + + "SELECT room_nid FROM roomserver_room_aliases WHERE alias = $1" -const selectAliasesFromRoomIDSQL = "" + - "SELECT alias FROM roomserver_room_aliases WHERE room_id = $1" +const selectAliasesFromRoomNIDSQL = "" + + "SELECT alias FROM roomserver_room_aliases WHERE room_nid = $1" -const selectAliasesFromRoomIDsSQL = "" + - "SELECT alias, room_id FROM roomserver_room_aliases WHERE room_id = ANY($1)" +const selectAliasesFromRoomNIDsSQL = "" + + "SELECT alias, room_nid FROM roomserver_room_aliases WHERE room_nid = ANY($1)" const deleteRoomAliasSQL = "" + "DELETE FROM roomserver_room_aliases WHERE alias = $1" type roomAliasesStatements struct { - insertRoomAliasStmt *sql.Stmt - selectRoomIDFromAliasStmt *sql.Stmt - selectAliasesFromRoomIDStmt *sql.Stmt - selectAliasesFromRoomIDsStmt *sql.Stmt - deleteRoomAliasStmt *sql.Stmt + insertRoomAliasStmt *sql.Stmt + selectRoomNIDFromAliasStmt *sql.Stmt + selectAliasesFromRoomNIDStmt *sql.Stmt + selectAliasesFromRoomNIDsStmt *sql.Stmt + deleteRoomAliasStmt *sql.Stmt } func (s *roomAliasesStatements) prepare(db *sql.DB) (err error) { @@ -62,29 +63,29 @@ func (s *roomAliasesStatements) prepare(db *sql.DB) (err error) { } return statementList{ {&s.insertRoomAliasStmt, insertRoomAliasSQL}, - {&s.selectRoomIDFromAliasStmt, selectRoomIDFromAliasSQL}, - {&s.selectAliasesFromRoomIDStmt, selectAliasesFromRoomIDSQL}, - {&s.selectAliasesFromRoomIDsStmt, selectAliasesFromRoomIDsSQL}, + {&s.selectRoomNIDFromAliasStmt, selectRoomNIDFromAliasSQL}, + {&s.selectAliasesFromRoomNIDStmt, selectAliasesFromRoomNIDSQL}, + {&s.selectAliasesFromRoomNIDsStmt, selectAliasesFromRoomNIDsSQL}, {&s.deleteRoomAliasStmt, deleteRoomAliasSQL}, }.prepare(db) } -func (s *roomAliasesStatements) insertRoomAlias(alias string, roomID string) (err error) { - _, err = s.insertRoomAliasStmt.Exec(alias, roomID) +func (s *roomAliasesStatements) insertRoomAlias(alias string, roomNID types.RoomNID) (err error) { + _, err = s.insertRoomAliasStmt.Exec(alias, roomNID) return } -func (s *roomAliasesStatements) selectRoomIDFromAlias(alias string) (roomID string, err error) { - err = s.selectRoomIDFromAliasStmt.QueryRow(alias).Scan(&roomID) +func (s *roomAliasesStatements) selectRoomNIDFromAlias(alias string) (roomNID types.RoomNID, err error) { + err = s.selectRoomNIDFromAliasStmt.QueryRow(alias).Scan(&roomNID) if err == sql.ErrNoRows { - return "", nil + return 0, nil } return } -func (s *roomAliasesStatements) selectAliasesFromRoomID(roomID string) (aliases []string, err error) { +func (s *roomAliasesStatements) selectAliasesFromRoomNID(roomNID types.RoomNID) (aliases []string, err error) { aliases = []string{} - rows, err := s.selectAliasesFromRoomIDStmt.Query(roomID) + rows, err := s.selectAliasesFromRoomNIDStmt.Query(roomNID) if err != nil { return } @@ -101,23 +102,31 @@ func (s *roomAliasesStatements) selectAliasesFromRoomID(roomID string) (aliases return } -func (s *roomAliasesStatements) selectAliasesFromRoomIDs(roomIDs []string) (aliases map[string][]string, err error) { - aliases = make(map[string][]string) - rows, err := s.selectAliasesFromRoomIDsStmt.Query(pq.StringArray(roomIDs)) +func (s *roomAliasesStatements) selectAliasesFromRoomNIDs(roomNIDs []types.RoomNID) (aliases map[types.RoomNID][]string, err error) { + aliases = make(map[types.RoomNID][]string) + // Convert the array of numeric IDs into one that can be used in the query + nIDs := []int64{} + for _, roomNID := range roomNIDs { + nIDs = append(nIDs, int64(roomNID)) + } + rows, err := s.selectAliasesFromRoomNIDsStmt.Query(pq.Int64Array(nIDs)) + if err != nil { return } for rows.Next() { - var alias, roomID string - if err = rows.Scan(&alias, &roomID); err != nil { + var alias string + var roomNID types.RoomNID + + if err = rows.Scan(&alias, &roomNID); err != nil { return } - if len(aliases[roomID]) > 0 { - aliases[roomID] = append(aliases[roomID], alias) + if len(aliases[roomNID]) > 0 { + aliases[roomNID] = append(aliases[roomNID], alias) } else { - aliases[roomID] = []string{alias} + aliases[roomNID] = []string{alias} } } diff --git a/src/github.com/matrix-org/dendrite/roomserver/storage/rooms_table.go b/src/github.com/matrix-org/dendrite/roomserver/storage/rooms_table.go index 76b3f67f6..6966ef88a 100644 --- a/src/github.com/matrix-org/dendrite/roomserver/storage/rooms_table.go +++ b/src/github.com/matrix-org/dendrite/roomserver/storage/rooms_table.go @@ -53,6 +53,12 @@ const insertRoomNIDSQL = "" + const selectRoomNIDSQL = "" + "SELECT room_nid FROM roomserver_rooms WHERE room_id = $1" +const selectRoomIDSQL = "" + + "SELECT room_id FROM roomserver_rooms WHERE room_nid = $1" + +const selectRoomIDsSQL = "" + + "SELECT room_nid, room_id FROM roomserver_rooms WHERE room_nid = ANY($1)" + const selectLatestEventNIDsSQL = "" + "SELECT latest_event_nids, state_snapshot_nid FROM roomserver_rooms WHERE room_nid = $1" @@ -63,7 +69,7 @@ const selectVisibilityForRoomNIDSQL = "" + "SELECT visibility FROM roomserver_rooms WHERE room_nid = $1" const selectPublicRoomIDsSQL = "" + - "SELECT room_id FROM roomserver_rooms WHERE visibility = true" + "SELECT room_nid FROM roomserver_rooms WHERE visibility = true" const updateLatestEventNIDsSQL = "" + "UPDATE roomserver_rooms SET latest_event_nids = $2, last_event_sent_nid = $3, state_snapshot_nid = $4 WHERE room_nid = $1" @@ -74,6 +80,8 @@ const updateVisibilityForRoomNIDSQL = "" + type roomStatements struct { insertRoomNIDStmt *sql.Stmt selectRoomNIDStmt *sql.Stmt + selectRoomIDStmt *sql.Stmt + selectRoomIDsStmt *sql.Stmt selectLatestEventNIDsStmt *sql.Stmt selectLatestEventNIDsForUpdateStmt *sql.Stmt selectVisibilityForRoomNIDStmt *sql.Stmt @@ -90,6 +98,8 @@ func (s *roomStatements) prepare(db *sql.DB) (err error) { return statementList{ {&s.insertRoomNIDStmt, insertRoomNIDSQL}, {&s.selectRoomNIDStmt, selectRoomNIDSQL}, + {&s.selectRoomIDStmt, selectRoomIDSQL}, + {&s.selectRoomIDsStmt, selectRoomIDsSQL}, {&s.selectLatestEventNIDsStmt, selectLatestEventNIDsSQL}, {&s.selectLatestEventNIDsForUpdateStmt, selectLatestEventNIDsForUpdateSQL}, {&s.selectVisibilityForRoomNIDStmt, selectVisibilityForRoomNIDSQL}, @@ -111,6 +121,39 @@ func (s *roomStatements) selectRoomNID(roomID string) (types.RoomNID, error) { return types.RoomNID(roomNID), err } +func (s *roomStatements) selectRoomID(roomNID types.RoomNID) (string, error) { + var roomID string + err := s.selectRoomIDStmt.QueryRow(roomNID).Scan(&roomID) + return roomID, err +} + +func (s *roomStatements) selectRoomIDs(roomNIDs []types.RoomNID) (map[types.RoomNID]string, error) { + roomIDs := make(map[types.RoomNID]string) + + nIDs := []int64{} + for _, roomNID := range roomNIDs { + nIDs = append(nIDs, int64(roomNID)) + } + + rows, err := s.selectRoomIDsStmt.Query(pq.Int64Array(nIDs)) + if err != nil { + return roomIDs, err + } + + for rows.Next() { + var roomNID types.RoomNID + var roomID string + + if err := rows.Scan(&roomNID, &roomID); err != nil { + return roomIDs, err + } + + roomIDs[roomNID] = roomID + } + + return roomIDs, nil +} + func (s *roomStatements) selectLatestEventNIDs(roomNID types.RoomNID) ([]types.EventNID, types.StateSnapshotNID, error) { var nids pq.Int64Array var stateSnapshotNID int64 @@ -148,22 +191,22 @@ func (s *roomStatements) selectVisibilityForRoomNID(roomNID types.RoomNID) (bool return visibility, err } -func (s *roomStatements) selectPublicRoomIDs() ([]string, error) { - roomIDs := []string{} +func (s *roomStatements) selectPublicRoomNIDs() ([]types.RoomNID, error) { + roomNIDs := []types.RoomNID{} rows, err := s.selectPublicRoomIDsStmt.Query() if err != nil { - return roomIDs, err + return roomNIDs, err } for rows.Next() { - var roomID string + var roomID types.RoomNID if err = rows.Scan(&roomID); err != nil { - return roomIDs, err + return roomNIDs, err } - roomIDs = append(roomIDs, roomID) + roomNIDs = append(roomNIDs, roomID) } - return roomIDs, nil + return roomNIDs, nil } func (s *roomStatements) updateVisibilityForRoomNID(roomNID types.RoomNID, visibility bool) error { diff --git a/src/github.com/matrix-org/dendrite/roomserver/storage/storage.go b/src/github.com/matrix-org/dendrite/roomserver/storage/storage.go index abb5d75f0..7704183b5 100644 --- a/src/github.com/matrix-org/dendrite/roomserver/storage/storage.go +++ b/src/github.com/matrix-org/dendrite/roomserver/storage/storage.go @@ -353,24 +353,29 @@ func (d *Database) LatestEventIDs(roomNID types.RoomNID) ([]gomatrixserverlib.Ev return references, currentStateSnapshotNID, depth, nil } +// RoomID implements alias.RoomserverAliasAPIDB +func (d *Database) RoomID(roomNID types.RoomNID) (string, error) { + return d.statements.selectRoomID(roomNID) +} + // SetRoomAlias implements alias.RoomserverAliasAPIDB -func (d *Database) SetRoomAlias(alias string, roomID string) error { - return d.statements.insertRoomAlias(alias, roomID) +func (d *Database) SetRoomAlias(alias string, roomNID types.RoomNID) error { + return d.statements.insertRoomAlias(alias, roomNID) } -// GetRoomIDFromAlias implements alias.RoomserverAliasAPIDB -func (d *Database) GetRoomIDFromAlias(alias string) (string, error) { - return d.statements.selectRoomIDFromAlias(alias) +// GetRoomNIDFromAlias implements alias.RoomserverAliasAPIDB +func (d *Database) GetRoomNIDFromAlias(alias string) (types.RoomNID, error) { + return d.statements.selectRoomNIDFromAlias(alias) } -// GetAliasesFromRoomID implements alias.RoomserverAliasAPIDB -func (d *Database) GetAliasesFromRoomID(roomID string) ([]string, error) { - return d.statements.selectAliasesFromRoomID(roomID) +// GetAliasesFromRoomNID implements alias.RoomserverAliasAPIDB +func (d *Database) GetAliasesFromRoomNID(roomNID types.RoomNID) ([]string, error) { + return d.statements.selectAliasesFromRoomNID(roomNID) } -// GetAliasesFromRoomIDs implements publicroom.RoomserverPublicRoomAPIDB -func (d *Database) GetAliasesFromRoomIDs(roomIDs []string) (map[string][]string, error) { - return d.statements.selectAliasesFromRoomIDs(roomIDs) +// GetAliasesFromRoomNIDs implements publicroom.RoomserverPublicRoomAPIDB +func (d *Database) GetAliasesFromRoomNIDs(roomNIDs []types.RoomNID) (map[types.RoomNID][]string, error) { + return d.statements.selectAliasesFromRoomNIDs(roomNIDs) } // RemoveRoomAlias implements alias.RoomserverAliasAPIDB @@ -385,14 +390,19 @@ func (d *Database) StateEntriesForTuples( return d.statements.bulkSelectFilteredStateBlockEntries(stateBlockNIDs, stateKeyTuples) } +// RoomIDs implements publicroom.RoomserverPublicRoomAPIDB +func (d *Database) RoomIDs(roomNIDs []types.RoomNID) (map[types.RoomNID]string, error) { + return d.statements.selectRoomIDs(roomNIDs) +} + // IsRoomPublic implements publicroom.RoomserverPublicRoomAPIDB func (d *Database) IsRoomPublic(roomNID types.RoomNID) (bool, error) { return d.statements.selectVisibilityForRoomNID(roomNID) } -// GetPublicRoomIDs implements publicroom.RoomserverPublicRoomAPIDB -func (d *Database) GetPublicRoomIDs() ([]string, error) { - return d.statements.selectPublicRoomIDs() +// GetPublicRoomNIDs implements publicroom.RoomserverPublicRoomAPIDB +func (d *Database) GetPublicRoomNIDs() ([]types.RoomNID, error) { + return d.statements.selectPublicRoomNIDs() } // UpdateRoomVisibility implements publicroom.RoomserverPublicRoomAPIDB