mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 17:04:51 -04:00
Add support for persisting event format versions
Currently we only have the one event format version defined, but this adds the necessary infrastructure to persist and fetch the format versions alongside the events. We specify the format version rather than the room version as: 1. We don't necessarily know the room version, existing events may be either v1 or v2. 2. We'd need to be careful to prevent/handle correctly if different events in the same room reported to be of different versions, which sounds annoying.
This commit is contained in:
parent
12699a701f
commit
c5a296b10c
5 changed files with 50 additions and 4 deletions
|
@ -18,6 +18,9 @@ from distutils.util import strtobool
|
|||
|
||||
import six
|
||||
|
||||
from synapse.api.constants import (
|
||||
EventFormatVersions,
|
||||
)
|
||||
from synapse.util.caches import intern_dict
|
||||
from synapse.util.frozenutils import freeze
|
||||
|
||||
|
@ -179,6 +182,8 @@ class EventBase(object):
|
|||
|
||||
|
||||
class FrozenEvent(EventBase):
|
||||
format_version = EventFormatVersions.V1 # All events of this type are V1
|
||||
|
||||
def __init__(self, event_dict, internal_metadata_dict={}, rejected_reason=None):
|
||||
event_dict = dict(event_dict)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue