summary refs log tree commit diff
path: root/synapse/events
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2021-09-22 17:58:57 +0100
committerGitHub <noreply@github.com>2021-09-22 17:58:57 +0100
commit26f2bfedbf5493d8a69d1b38147b6236e7606cd3 (patch)
tree7e1886447a6293f0c5f6ac92778891b93df1d3b2 /synapse/events
parentTreat "\u0000" as "\u0020" for the purposes of message search (message indexi... (diff)
downloadsynapse-26f2bfedbf5493d8a69d1b38147b6236e7606cd3.tar.xz
Factor out a separate `EventContext.for_outlier` (#10883)
Constructing an EventContext for an outlier is actually really simple, and
there's no sense in going via an `async` method in the `StateHandler`.

This also means that we can resolve a bunch of FIXMEs.
Diffstat (limited to 'synapse/events')
-rw-r--r--synapse/events/snapshot.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/synapse/events/snapshot.py b/synapse/events/snapshot.py

index f8d898c3b1..5ba01eeef9 100644 --- a/synapse/events/snapshot.py +++ b/synapse/events/snapshot.py
@@ -80,9 +80,7 @@ class EventContext: (type, state_key) -> event_id - FIXME: what is this for an outlier? it seems ill-defined. It seems like - it could be either {}, or the state we were given by the remote - server, depending on $THINGS + For an outlier, this is {} Note that this is a private attribute: it should be accessed via ``get_current_state_ids``. _AsyncEventContext impl calculates this @@ -96,7 +94,7 @@ class EventContext: (type, state_key) -> event_id - FIXME: again, what is this for an outlier? + For an outlier, this is {} As with _current_state_ids, this is a private attribute. It should be accessed via get_prev_state_ids. @@ -130,6 +128,14 @@ class EventContext: delta_ids=delta_ids, ) + @staticmethod + def for_outlier(): + """Return an EventContext instance suitable for persisting an outlier event""" + return EventContext( + current_state_ids={}, + prev_state_ids={}, + ) + async def serialize(self, event: EventBase, store: "DataStore") -> dict: """Converts self to a type that can be serialized as JSON, and then deserialized by `deserialize`