aboutsummaryrefslogtreecommitdiff
path: root/syncapi/storage/tables/interface.go
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-03-11 12:48:45 +0000
committerGitHub <noreply@github.com>2022-03-11 12:48:45 +0000
commit507a8e67739c2cfd89f5be48fdf96bdb0d1698d5 (patch)
tree773105022c8510931403d118e8f4c843573d7079 /syncapi/storage/tables/interface.go
parente485f9c2bd15bca397229444399fa7e168eca43d (diff)
Don't range entire state for `/sync` (#2270)
* Don't range entire state for rooms the user has no reason to care about * Remove unnecessary db field in postgresql
Diffstat (limited to 'syncapi/storage/tables/interface.go')
-rw-r--r--syncapi/storage/tables/interface.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/syncapi/storage/tables/interface.go b/syncapi/storage/tables/interface.go
index 1ebb4265..9d1078f5 100644
--- a/syncapi/storage/tables/interface.go
+++ b/syncapi/storage/tables/interface.go
@@ -51,7 +51,7 @@ type Peeks interface {
}
type Events interface {
- SelectStateInRange(ctx context.Context, txn *sql.Tx, r types.Range, stateFilter *gomatrixserverlib.StateFilter) (map[string]map[string]bool, map[string]types.StreamEvent, error)
+ SelectStateInRange(ctx context.Context, txn *sql.Tx, r types.Range, stateFilter *gomatrixserverlib.StateFilter, roomIDs []string) (map[string]map[string]bool, map[string]types.StreamEvent, error)
SelectMaxEventID(ctx context.Context, txn *sql.Tx) (id int64, err error)
InsertEvent(ctx context.Context, txn *sql.Tx, event *gomatrixserverlib.HeaderedEvent, addState, removeState []string, transactionID *api.TransactionID, excludeFromSync bool) (streamPos types.StreamPosition, err error)
// SelectRecentEvents returns events between the two stream positions: exclusive of low and inclusive of high.
@@ -99,6 +99,8 @@ type CurrentRoomState interface {
SelectCurrentState(ctx context.Context, txn *sql.Tx, roomID string, stateFilter *gomatrixserverlib.StateFilter, excludeEventIDs []string) ([]*gomatrixserverlib.HeaderedEvent, error)
// SelectRoomIDsWithMembership returns the list of room IDs which have the given user in the given membership state.
SelectRoomIDsWithMembership(ctx context.Context, txn *sql.Tx, userID string, membership string) ([]string, error)
+ // SelectRoomIDsWithAnyMembership returns a map of all memberships for the given user.
+ SelectRoomIDsWithAnyMembership(ctx context.Context, txn *sql.Tx, userID string) (map[string]string, error)
// SelectJoinedUsers returns a map of room ID to a list of joined user IDs.
SelectJoinedUsers(ctx context.Context) (map[string][]string, error)
}