diff --git a/src/github.com/matrix-org/dendrite/syncserver/README.md b/src/github.com/matrix-org/dendrite/syncserver/README.md index 219519a30..1fc62b376 100644 --- a/src/github.com/matrix-org/dendrite/syncserver/README.md +++ b/src/github.com/matrix-org/dendrite/syncserver/README.md @@ -21,7 +21,7 @@ The logic for working out which rooms is based on [Synapse](https://github.com/m For each room, the /sync response returns the most recent timeline events and the state of the room at the start of the timeline. The logic for working out *which* events is not based entirely on Synapse code, as it is known broken with respect to working out room state. In order to know which events to return, the server needs to calculate room state at various points in the history of -the room. For example, imagine a room with the following 15 events (letters are state events (updated via '), numbers are timeline events): +the room. For example, imagine a room with the following 15 events (letters are state events (updated via `'`), numbers are timeline events): ``` index 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 (1-based indexing as StreamPosition(0) represents no event) @@ -30,6 +30,12 @@ timeline [A, B, C, D, 1, 2, 3, D', 4, D'', 5, B', D''', D'''', 6] The current state of this room is: `[A, B', C, D'''']`. +If this room was requested with `?since=14&limit=5` then 1 timeline event would be returned, the most recent one: +``` + 15 + [ 6 ] +``` + If this room was requested with `?since=9&limit=5` then 5 timeline events would be returned, the most recent ones: ``` 11 12 13 14 15 @@ -37,7 +43,7 @@ If this room was requested with `?since=9&limit=5` then 5 timeline events would ``` The state of the room at the START of the timeline can be represented in 2 ways: - - The 'full_state' from index 0 : `[A, B, C, D'']` (aka the state between 0-11 exclusive) + - The `full_state` from index 0 : `[A, B, C, D'']` (aka the state between 0-11 exclusive) - A partial state from index 9 : `[D'']` (aka the state between 9-11 exclusive) Servers advance state events (e.g from `D'` to `D''`) based on the state conflict resolution algorithm.