Skip to main content

Module sync

Module sync 

Source
Expand description

/sync snapshot. Returns JSON. Does not wait, poll, or wake.

Structs§

AccountDataFilter
RoomFilter
RoomStateFilter
RoomTimelineFilter
SyncFilter
SyncQuery

Constants§

SYNC_HERO_LIMIT
m.heroes cap (plan §3.4).
SYNC_MAX_TIMEOUT_MS
timeout (ms) is clamped to this ceiling regardless of what the client asks for (plan §4 /sync row).
SYNC_TIMELINE_DEFAULT_LIMIT
filter.room.timeline.limit default and ceiling (P10 brief — overrides plan §3.2’s own “default 20” wherever they differ).
SYNC_TIMELINE_MAX_LIMIT
SYNC_TO_DEVICE_CAP
to_device.events cap per response (P10 brief).

Functions§

build_invite_room_block
One rooms.invite.{roomId} block, or None when the invite is not new (an incremental sync whose invite predates since_stream).
build_join_room_block
One rooms.join.{roomId} block, or None when this is an incremental sync AND nothing changed for this room at all (a room is only listed when something happened — see the module doc’s emptiness rule).
build_leave_room_block
One rooms.leave.{roomId} block: timeline up to and including the leave/kick/ban event itself (naturally bounded — nothing after that point is ever queried), state minimal (v1 simplification: the client was previously joined, so it already has the room’s bootstrap state from before it left — nothing new is reconstructed here).
build_receipt_event
One coalesced m.receipt ephemeral event (plan §3.6): every m.read receipt (visible to the whole room by definition) plus ONLY the caller’s own m.read.private receipt — Matrix’s own privacy rule that a private receipt must never reach another user’s /sync. None when receipts contained only OTHER users’ private receipts — after the privacy filter there is nothing left worth an (otherwise empty-content) event at all, and an empty-but-present m.receipt event would wrongly count as “this room changed” for the emptiness check that gates a room’s inclusion.
build_sync_response
format_event
format_pagination_token
parse_filter_param
Resolve the filter query param: a stored filter_id (looked up via crate::store::get_filter, scoped to user_id — the same isolation routes::matrix::account::get_filter enforces) or inline JSON (a leading {). Absent/empty is SyncFilter::default.
passes_type_filter
types/not_types gate shared by the timeline and account-data filter sections — own copy per this codebase’s one-copy-per-route-module convention (mirrors routes::matrix::messaging::event_passes_filter).
sync_response_is_empty
“No rooms/account-data/to-device/device-lists changes, no typing/receipt change” (P10 brief) — device_one_time_keys_count/ device_unused_fallback_key_types are deliberately NOT part of this check: they are static per-device facts always present, never a “new since last time” signal.