synapse/synapse
Eric Eastwood 4a7c58642c
Add Sliding Sync /sync endpoint (initial implementation) (#17187)
Based on [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575): Sliding Sync

This iteration only focuses on returning the list of room IDs in the sliding window API (without sorting/filtering).

Rooms appear in the Sliding sync response based on:

 - `invite`, `join`, `knock`, `ban` membership events
 - Kicks (`leave` membership events where `sender` is different from the `user_id`/`state_key`)
 - `newly_left` (rooms that were left during the given token range, > `from_token` and <= `to_token`)
 - In order for bans/kicks to not show up, you need to `/forget` those rooms. This doesn't modify the event itself though and only adds the `forgotten` flag to `room_memberships` in Synapse. There isn't a way to tell when a room was forgotten at the moment so we can't factor it into the from/to range.

### Example request

`POST http://localhost:8008/_matrix/client/unstable/org.matrix.msc3575/sync`

```json
{
  "lists": {
    "foo-list": {
      "ranges": [ [0, 99] ],
      "sort": [ "by_notification_level", "by_recency", "by_name" ],
      "required_state": [
        ["m.room.join_rules", ""],
        ["m.room.history_visibility", ""],
        ["m.space.child", "*"]
      ],
      "timeline_limit": 100
    }
  }
}
```

Response:
```json
{
  "next_pos": "s58_224_0_13_10_1_1_16_0_1",
  "lists": {
    "foo-list": {
      "count": 1,
      "ops": [
        {
          "op": "SYNC",
          "range": [0, 99],
          "room_ids": [
            "!MmgikIyFzsuvtnbvVG:my.synapse.linux.server"
          ]
        }
      ]
    }
  },
  "rooms": {},
  "extensions": {}
}
```
2024-06-06 14:44:32 -05:00
..
_scripts Replaces all usages of StreamIdGenerator with MultiWriterIdGenerator (#17229) 2024-05-30 11:07:32 +00:00
api Add Sliding Sync /sync endpoint (initial implementation) (#17187) 2024-06-06 14:44:32 -05:00
app Fix sentry default tags (#17251) 2024-05-31 11:27:47 +01:00
appservice Bump black from 23.10.1 to 24.2.0 (#16936) 2024-03-13 16:46:44 +00:00
config Ratelimiting of remote media downloads (#17256) 2024-06-05 13:43:36 +01:00
crypto Only do one concurrent fetch per server in keyring (#16894) 2024-02-09 10:51:11 +00:00
events Bring auto-accept invite logic into Synapse (#17147) 2024-05-21 20:09:17 +00:00
federation Ratelimiting of remote media downloads (#17256) 2024-06-05 13:43:36 +01:00
handlers Add Sliding Sync /sync endpoint (initial implementation) (#17187) 2024-06-06 14:44:32 -05:00
http Ratelimiting of remote media downloads (#17256) 2024-06-05 13:43:36 +01:00
logging Bump mypy from 1.5.1 to 1.8.0 (#16901) 2024-03-13 17:05:57 +00:00
media Ratelimiting of remote media downloads (#17256) 2024-06-05 13:43:36 +01:00
metrics Bump black from 23.10.1 to 24.2.0 (#16936) 2024-03-13 16:46:44 +00:00
module_api Bump mypy from 1.5.1 to 1.8.0 (#16901) 2024-03-13 17:05:57 +00:00
push Add support for MSC4115 (#17104) 2024-04-29 15:22:13 +01:00
replication Improve perf of sync device lists (#17216) 2024-05-21 16:48:20 +01:00
res Send an email if the address is already bound to an user account (#16819) 2024-04-23 16:45:24 +01:00
rest Add Sliding Sync /sync endpoint (initial implementation) (#17187) 2024-06-06 14:44:32 -05:00
server_notices Merge remote-tracking branch 'gitlab/clokep/license-license' into new_develop 2023-12-13 15:11:56 +00:00
spam_checker_api Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
state Bump black from 23.10.1 to 24.2.0 (#16936) 2024-03-13 16:46:44 +00:00
static Update link to the clients webpage, fix #15825 (#15874) 2023-07-06 17:28:09 +02:00
storage Handle hyphens in user dir search porperly (#17254) 2024-06-05 10:40:34 +01:00
streams Bump mypy from 1.5.1 to 1.8.0 (#16901) 2024-03-13 17:05:57 +00:00
synapse_rust MSC4108 implementation (#17056) 2024-04-25 12:50:12 +00:00
types Use fully-qualified PersistedEventPosition when returning RoomsForUser (#17265) 2024-06-04 12:58:03 -05:00
util Add logging to tasks managed by the task scheduler, showing CPU and database usage. (#17219) 2024-05-22 14:12:58 +01:00
__init__.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
_pydantic_compat.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
event_auth.py Bump black from 23.10.1 to 24.2.0 (#16936) 2024-03-13 16:46:44 +00:00
notifier.py In sync wait for worker to catch up since token (#17215) 2024-05-30 14:03:49 +01:00
py.typed Mark Module API error imports as re-exported and mark Synapse as containing type annotations (#11054) 2021-10-13 08:42:41 +01:00
server.py Add Sliding Sync /sync endpoint (initial implementation) (#17187) 2024-06-06 14:44:32 -05:00
visibility.py Add support for MSC4115 (#17104) 2024-04-29 15:22:13 +01:00