Skip to content

Commit 3f28588

Browse files
committed
Add graph to show how historical state plays into the DAG
1 parent 7df80fe commit 3f28588

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

proposals/2716-batch-send-historical-messages.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,66 @@ flowchart BT
499499
</details>
500500

501501

502+
503+
#### Add in the historical state
504+
505+
In order to show the display name and avatar for the historical messages,
506+
the state provided by `state_events_at_start` needs to resolve when one of
507+
the historical messages is fetched.
508+
509+
It's probably most semantic to have the state float outside of the normal DAG
510+
in a chain by referencing a fake `prev_event`. Then the insertion event
511+
reference the last piece in the floating state chain.
512+
513+
In Synapse, the fake `prev_event` causes it to look like an "outlier" because
514+
the homeserver can't fully fetch and resolve the state at the point. As a
515+
result, the state will not be resolved into the current state of the room,
516+
and it won't be visible in the chat history. This allows us to insert multiple
517+
batches without having a bunch of `@mxid joined the room` noise between each
518+
batch.
519+
520+
![](https://user-images.githubusercontent.com/558581/137247868-b7d5b996-02ac-49f8-bbfa-1417ddc60bae.png)
521+
522+
[Mermaid live editor playground link](https://mermaid-js.github.io/mermaid-live-editor/edit/#eyJjb2RlIjoiZmxvd2NoYXJ0IEJUXG4gICAgc3ViZ3JhcGggbGl2ZVxuICAgICAgICBtYXJrZXIxPlwibWFya2VyXCJdIC0tLS0-IEIgLS0tLS0tLS0tLS0tLS0tLS0-IEFcbiAgICBlbmRcbiAgICBcbiAgICBzdWJncmFwaCBiYXRjaDBcbiAgICAgICAgYmF0Y2gwLWJhdGNoW1tcImJhdGNoXCJdXSAtLT4gYmF0Y2gwLTIoKFwiMlwiKSkgLS0-IGJhdGNoMC0xKCgxKSkgLS0-IGJhdGNoMC0wKCgwKSkgLS0-IGJhdGNoMC1pbnNlcnRpb25bL2luc2VydGlvblxcXVxuICAgIGVuZFxuXG4gICAgc3ViZ3JhcGggYmF0Y2gxXG4gICAgICAgIGJhdGNoMS1iYXRjaFtbXCJiYXRjaFwiXV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S0tLS0tLS0tLS0tPiBBXG4gICAgYmF0Y2gwLWJhdGNoIC0uLT4gYmF0Y2gwLWluc2VydGlvbkJhc2VbL2luc2VydGlvblxcXVxuICAgIGJhdGNoMS1iYXRjaCAtLi0-IGJhdGNoMC1pbnNlcnRpb25cbiAgICBiYXRjaDItYmF0Y2ggLS4tPiBiYXRjaDEtaW5zZXJ0aW9uXG4iLCJtZXJtYWlkIjoie1xuICBcInRoZW1lXCI6IFwiZGVmYXVsdFwiXG59IiwidXBkYXRlRWRpdG9yIjpmYWxzZSwiYXV0b1N5bmMiOnRydWUsInVwZGF0ZURpYWdyYW0iOmZhbHNlfQ)
523+
524+
<details>
525+
<summary>mermaid graph syntax</summary>
526+
527+
```mermaid
528+
flowchart BT
529+
subgraph live
530+
marker1>"marker"] ----> B -----------------> A
531+
end
532+
533+
subgraph batch0
534+
batch0-batch[["batch"]] --> batch0-2(("2")) --> batch0-1((1)) --> batch0-0((0)) --> batch0-insertion[/insertion\]
535+
end
536+
537+
subgraph batch1
538+
batch1-batch[["batch"]] --> batch1-2(("2")) --> batch1-1((1)) --> batch1-0((0)) --> batch1-insertion[/insertion\]
539+
end
540+
541+
subgraph batch2
542+
batch2-batch[["batch"]] --> batch2-2(("2")) --> batch2-1((1)) --> batch2-0((0)) --> batch2-insertion[/insertion\]
543+
end
544+
545+
546+
batch0-insertion --> memberBob0(["m.room.member (bob)"]) --> memberAlice0(["m.room.member (alice)"]) --> fakePrevEvent0{{fake_prev_event}}
547+
batch1-insertion --> memberBob1(["m.room.member (bob)"]) --> memberAlice1(["m.room.member (alice)"]) --> fakePrevEvent1{{fake_prev_event}}
548+
batch2-insertion --> memberBob2(["m.room.member (bob)"]) --> memberAlice2(["m.room.member (alice)"]) --> fakePrevEvent2{{fake_prev_event}}
549+
550+
marker1 -.-> batch0-insertionBase
551+
batch0-insertionBase[/insertion\] ---------------> A
552+
batch0-batch -.-> batch0-insertionBase[/insertion\]
553+
batch1-batch -.-> batch0-insertion
554+
batch2-batch -.-> batch1-insertion
555+
```
556+
557+
</details>
558+
559+
560+
561+
502562
## Potential issues
503563

504564
Also see the security considerations section below.

0 commit comments

Comments
 (0)