Clarify terminology around aggregations (#1424)
I've done my best to remove the word "bundle", because I feel like it causes more confusion than it provides. Instead I have favoured "aggregated child events" which I think is clearer. Some general clarification around these parts of the spec.
This commit is contained in:
parent
d6f38f157d
commit
d26794ee90
6 changed files with 69 additions and 52 deletions
|
@ -1999,7 +1999,7 @@ This specification describes the following relationship types:
|
|||
* [Threads](#threading).
|
||||
* [References](#reference-relations)
|
||||
|
||||
#### Aggregations
|
||||
#### Aggregations of child events
|
||||
|
||||
{{% added-in v="1.3" %}}
|
||||
|
||||
|
@ -2013,14 +2013,12 @@ of times that `key` was used by child events.
|
|||
|
||||
The actual aggregation format depends on the `rel_type`.
|
||||
|
||||
Aggregations are sometimes automatically included by a server alongside the parent
|
||||
event. This is known as a "bundled aggregation" or "bundle" for simplicity. The
|
||||
act of doing this is "bundling".
|
||||
|
||||
When an event is served to the client through the APIs listed below, a `m.relations` property
|
||||
is included under `unsigned` if the event has child events which can be aggregated and point
|
||||
at it. The `m.relations` property is an object keyed by `rel_type` and value being the type-specific
|
||||
aggregated format for that `rel_type`, also known as the bundle.
|
||||
When an event is served to the client through the APIs listed below, a
|
||||
`m.relations` property is included under `unsigned` if the event has child
|
||||
events which can be aggregated and point at it. The `m.relations` property is
|
||||
an object keyed by `rel_type` and value being the type-specific aggregated
|
||||
format for that `rel_type`. This `m.relations` property is known as a "bundled
|
||||
aggregation".
|
||||
|
||||
For example (unimportant fields not included):
|
||||
|
||||
|
@ -2056,10 +2054,10 @@ For example (unimportant fields not included):
|
|||
}
|
||||
```
|
||||
|
||||
Note how the `org.example.possible_annotations` bundle is an array compared to the
|
||||
`org.example.possible_thread` bundle where the server is summarising the state of
|
||||
the relationship in a single object. Both are valid ways to aggregate, and their
|
||||
exact types depend on the `rel_type`.
|
||||
Note how the `org.example.possible_annotations` aggregation is an array, while in the
|
||||
`org.example.possible_thread` aggregation where the server is summarising the state of
|
||||
the relationship in a single object. Both are valid ways to aggregate: the format of an
|
||||
aggregation depends on the `rel_type`.
|
||||
|
||||
{{% boxes/warning %}}
|
||||
State events do not currently receive bundled aggregations. This is not
|
||||
|
@ -2086,11 +2084,11 @@ such as `/initialSync`.
|
|||
|
||||
While this functionality allows the client to see what was known to the server at the
|
||||
time of handling, the client should continue to aggregate locally if it is aware of
|
||||
the relationship type's behaviour. For example, a client might increment a `count`
|
||||
on a parent event's bundle if it saw a new child event which referenced that parent.
|
||||
the relationship type's behaviour. For example, a client might internally increment a `count`
|
||||
in a parent event's aggregation data if it saw a new child event which referenced that parent.
|
||||
|
||||
The bundle provided by the server only includes child events which were known at the
|
||||
time the client would receive the bundle. For example, in a single `/sync` response
|
||||
The aggregation provided by the server only includes child events which were known at the
|
||||
time the client would receive the aggregation. For example, in a single `/sync` response
|
||||
with the parent and multiple child events the child events would have already been
|
||||
included on the parent's `m.relations` field. Events received in future syncs would
|
||||
need to be aggregated manually by the client.
|
||||
|
@ -2100,7 +2098,7 @@ Events from [ignored users](#ignoring-users) do not appear in the aggregation
|
|||
from the server, however clients might still have events from ignored users cached. Like
|
||||
with normal events, clients will need to de-aggregate child events sent by ignored users to
|
||||
avoid them being considered in counts. Servers must additionally ensure they do not
|
||||
consider child events from ignored users when preparing a bundle for the client.
|
||||
consider child events from ignored users when preparing an aggregation for the client.
|
||||
{{% /boxes/note %}}
|
||||
|
||||
When a parent event is redacted, the child events which pointed to that parent remain, however
|
||||
|
@ -2109,7 +2107,7 @@ to de-aggregate or disassociate the event once the relationship is lost. Clients
|
|||
aggregation or which handle redactions locally should do the same.
|
||||
|
||||
It is suggested that clients perform local echo on aggregations — for instance, aggregating
|
||||
a new child event into a bundle optimistically until the server returns a failure or the client
|
||||
a new child event into a parent event optimistically until the server returns a failure or the client
|
||||
gives up on sending the event, at which point the event should be de-aggregated and an
|
||||
error or similar shown. The client should be cautious to not aggregate an event twice if
|
||||
it has already optimistically aggregated the event. Clients are encouraged to take this
|
||||
|
@ -2118,7 +2116,7 @@ likely using the transaction ID as a temporary event ID until a proper event ID
|
|||
|
||||
{{% boxes/warning %}}
|
||||
Due to history visibility restrictions, child events might not be visible to the user
|
||||
if they are in a section of history the user cannot see. This means any bundles which would
|
||||
if they are in a section of history the user cannot see. This means any aggregations which would
|
||||
normally include those events will be lacking them and the client will not be able to
|
||||
locally aggregate the events either — relating events of importance (such as votes) should
|
||||
take into consideration history visibility.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue