|
|
@ -515,8 +515,9 @@ is at the top)::
|
|
|
|
Suppose E3 and E4 are both ``m.room.name`` events which set the name of the
|
|
|
|
Suppose E3 and E4 are both ``m.room.name`` events which set the name of the
|
|
|
|
room. What should the name of the room be at E5?
|
|
|
|
room. What should the name of the room be at E5?
|
|
|
|
|
|
|
|
|
|
|
|
Servers should follow one of the following recursively-defined algorithms to
|
|
|
|
Servers should follow one of the following recursively-defined algorithms,
|
|
|
|
determine the room state at a given point on the DAG.
|
|
|
|
depending on the room version, to determine the room state at a given point on
|
|
|
|
|
|
|
|
the DAG.
|
|
|
|
|
|
|
|
|
|
|
|
State resolution algorithm for version 2 rooms
|
|
|
|
State resolution algorithm for version 2 rooms
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
@ -549,11 +550,12 @@ Power events
|
|
|
|
``state_key``. The idea behind this is that power events are events that have
|
|
|
|
``state_key``. The idea behind this is that power events are events that have
|
|
|
|
may remove someone's ability to do something in the room.
|
|
|
|
may remove someone's ability to do something in the room.
|
|
|
|
|
|
|
|
|
|
|
|
Unconflicted and conflicted state maps
|
|
|
|
Unconflicted state map and conflicted state set
|
|
|
|
The *unconflicted state map* is the state where the value of each key exists
|
|
|
|
The *unconflicted state map* is the state where the value of each key exists
|
|
|
|
and is the same in each state :math:`S_i`. The *conflicted state map* is the
|
|
|
|
and is the same in each state :math:`S_i`. The *conflicted state set* is the
|
|
|
|
set of all other state events. Note that the conflicted state map is a set of
|
|
|
|
set of all other state events. Note that the unconflicted state map only has
|
|
|
|
events, rather than a map of ``(event_type, state_key)`` to ``event_id``.
|
|
|
|
one event per ``(event_type, state_key)``, whereas the conflicted state set
|
|
|
|
|
|
|
|
may have multiple events.
|
|
|
|
|
|
|
|
|
|
|
|
Auth difference
|
|
|
|
Auth difference
|
|
|
|
The *auth difference* is calculated by first calculating the full auth chain
|
|
|
|
The *auth difference* is calculated by first calculating the full auth chain
|
|
|
@ -563,7 +565,7 @@ Auth difference
|
|
|
|
the auth difference is :math:`\cup C_i - \cap C_i`.
|
|
|
|
the auth difference is :math:`\cup C_i - \cap C_i`.
|
|
|
|
|
|
|
|
|
|
|
|
Full conflicted set
|
|
|
|
Full conflicted set
|
|
|
|
The *full conflicted set* is the union of the conflicted state map and the
|
|
|
|
The *full conflicted set* is the union of the conflicted state set and the
|
|
|
|
auth difference.
|
|
|
|
auth difference.
|
|
|
|
|
|
|
|
|
|
|
|
Reverse topological power ordering
|
|
|
|
Reverse topological power ordering
|
|
|
@ -594,12 +596,11 @@ Mainline ordering
|
|
|
|
such that :math:`P` is last. Given another event :math:`e`, the *closest
|
|
|
|
such that :math:`P` is last. Given another event :math:`e`, the *closest
|
|
|
|
mainline event to* :math:`e` is the first event encountered in the mainline
|
|
|
|
mainline event to* :math:`e` is the first event encountered in the mainline
|
|
|
|
when iteratively descending through the ``m.room.power_levels`` events in the
|
|
|
|
when iteratively descending through the ``m.room.power_levels`` events in the
|
|
|
|
``auth_events`` starting at :math:`e`. If :math:`e` is not an
|
|
|
|
``auth_events`` starting at :math:`e`. If no mainline event is encountered
|
|
|
|
``m.room.power_levels`` event, and does not have an ``m.room.power_levels``
|
|
|
|
when iteratively descending through the ``m.room.power_levels`` events, then
|
|
|
|
event in its ``auth_events`` (this happens if the :math:`e` is sent before
|
|
|
|
the closest mainline event to :math:`e` can be considered to be a dummy event
|
|
|
|
the first ``m.room.power_levels`` event), then the closest mainline event to
|
|
|
|
that is before any other event in the mainline of :math:`P` for the purposes
|
|
|
|
:math:`e` can be considered to be a dummy event that is before any other
|
|
|
|
of condition 1 below.
|
|
|
|
event in the mainline of :math:`P` for the purposes of condition 1 below.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The *mainline ordering based on* :math:`P` of a set of events is the
|
|
|
|
The *mainline ordering based on* :math:`P` of a set of events is the
|
|
|
|
ordering, from smallest to largest, using the following comparision relation
|
|
|
|
ordering, from smallest to largest, using the following comparision relation
|
|
|
@ -628,9 +629,9 @@ Algorithm
|
|
|
|
|
|
|
|
|
|
|
|
The *resolution* of a set of states is obtained as follows:
|
|
|
|
The *resolution* of a set of states is obtained as follows:
|
|
|
|
|
|
|
|
|
|
|
|
1. Take all *power events* and any events in their auth chains that appear in
|
|
|
|
1. Take all *power events* and any events in their auth chains, recursively,
|
|
|
|
the *full conflicted set* and order them by the *reverse topological power
|
|
|
|
that appear in the *full conflicted set* and order them by the *reverse
|
|
|
|
ordering*.
|
|
|
|
topological power ordering*.
|
|
|
|
2. Apply the *iterative auth checks algorithm* on the *unconflicted state map*
|
|
|
|
2. Apply the *iterative auth checks algorithm* on the *unconflicted state map*
|
|
|
|
and the list of events from the previous step to get a partially resolved
|
|
|
|
and the list of events from the previous step to get a partially resolved
|
|
|
|
state.
|
|
|
|
state.
|
|
|
|