Skip to main content

Module spaces

Module spaces 

Source
Expand description

Domains with sub-rooms, the Matrix way: a domain is a Space (a room whose m.room.create carries type: m.space), a sub-room is linked by an m.space.child state event in the space (state_key = child room id, content via = servers) and, optionally, a back-link m.space.parent in the child. Everything here is derived from ordinary state events, so no extra table exists and federation can later carry it unchanged.

A space holds no chat. Child rooms keep their own store: DM/group stay in the closed ciphertext pump, channels/forum in the public plaintext store. Hierarchy is metadata only and is never purged.

Constants§

SPACE_TYPE
m.room.create type of a domain.

Functions§

hierarchy
GET /rooms/{roomId}/hierarchy (CS API v1). Breadth-first from root, each room once, only rooms the caller may see, max_depth levels below the root. from is an opaque offset token (the page cut is deterministic for a stable tree). Ok(None) when the root itself is not visible.
restricted_allows
Whether m.room.join_rules is restricted (or knock_restricted) and one of its allow spaces has user_id joined. Join rule for restricted rooms is read from state because the rooms.join_rule column only knows invite/public.
room_type
type from the room’s m.room.create.
validate_space_state
Rejects malformed m.space.child / m.space.parent content. Empty {} is a removal and always valid; otherwise via must be a non-empty list of strings, order (if any) a short string of printable ASCII, suggested (if any) a bool.