diff --git a/Client-Sync-Server-Design.md b/Client-Sync-Server-Design.md index 49e6839..f97b59c 100644 --- a/Client-Sync-Server-Design.md +++ b/Client-Sync-Server-Design.md @@ -38,20 +38,23 @@ Database: - For each room, get the latest N messages: `SELECT * FROM timeline WHERE room_id=? ORDER BY pkey_id DESC LIMIT N` - "Roll back" the current state by the number of timeline entries and return that along with the `pkey_id` stream token to Alice. -#### Alice hits /sync with a token with no new events +#### Alice hits /sync with a token - Get all rooms Alice is joined to: `SELECT room_id FROM room_state WHERE type="m.room.member" AND state_key="@alice:localhost" AND membership="join";` - Cache this information in-memory. +- We need to know if this token is going to make us do a lot of work. Work out if we are `= M: +Else if number of entries >= M: - Ask the room server: * Which rooms Alice is in. * For each room, get current state and latest N events.