Skip to main content

Module sync

Module sync 

Source
Expand description

Implements APIs for client sync API

See https://bundesmessenger.gitlab.io/backend/neo/arminius/arminius/architecture/sync.html for information about how the stream IDs work

For limited timelines: We generally fetch up to limit+1 events from the database, where limit is the amount of events the user asked for, or a sensible default. If there are actually limit+1 events we can sync to the user, we throw away the last event, and mark the timeline as limited, indicating to the user that if they use the /messages endpoint, there are more events they could fetch.

Structsยง

SyncData
This structure contains any data that needs to be synchronized.
SyncResponse ๐Ÿ”’
A wrapper around a sync response
SyncedRoom ๐Ÿ”’
A synchronized room

Enumsยง

Room ๐Ÿ”’
A room that is part of the sync response.
SyncError ๐Ÿ”’

Functionsยง

fetch_sync_data ๐Ÿ”’
This function is a central point in which we query every possible data that needs synchronization.
normalize_filter ๐Ÿ”’
Since the client can send us a filter on the fly we need to normalize the the request.
sync_events_handler ๐Ÿ”’
Handler for GET /_matrix/client/v3/sync (See https://spec.matrix.org/v1.14/client-server-api/#get_matrixclientv3sync).
wait_for_sync_data ๐Ÿ”’
Given a [arminius_lib_nats::Subscriber] instanced from sync_data_subscriber, wait until it receives a NATS message about a new sync response.