summary refs log tree commit diff
path: root/contrib
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-10-07 15:15:33 +0100
committerGitHub <noreply@github.com>2020-10-07 15:15:33 +0100
commit52a50e8686ec9af6c629004171748f41eae09f73 (patch)
treefafcd0682f75a7620c1c0a470254f24e688b1c64 /contrib
parentAdd typing information to the device handler. (#8407) (diff)
downloadsynapse-52a50e8686ec9af6c629004171748f41eae09f73.tar.xz
Use vector clocks for room stream tokens. (#8439)
Currently when using multiple event persisters we (in the worst case) don't tell clients about events until all event persisters have persisted new events after the original event. This is a suboptimal, especially if one of the event persisters goes down.

To handle this, we encode the position of each event persister in the room tokens so that we can send events to clients immediately. To reduce the size of the token we do two things:

1. We create a unique immutable persistent mapping between instance names and a generated small integer ID, which we can encode in the tokens instead of the instance name; and
2. We encode the "persisted upto position" of the room token and then only explicitly include instances that have positions strictly greater than that.

The new tokens look something like: `m3478~1.3488~2.3489`, where the first number is the min position, and the subsequent `-` separated pairs are the instance ID to positions map. (We use `.` and `~` as separators as they're URL safe and not already used by `StreamToken`).
Diffstat (limited to 'contrib')
0 files changed, 0 insertions, 0 deletions