summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-05-05 15:02:35 +0100
committerErik Johnston <erik@matrix.org>2021-05-05 15:06:28 +0100
commit7e7b99bca9da9bb5c8ba16aec51eef114c084561 (patch)
treebc80f63e2e5d61b1a6aee009caa495814e28785e /synapse
parentDon't use DictProperty (diff)
downloadsynapse-7e7b99bca9da9bb5c8ba16aec51eef114c084561.tar.xz
Slots
Diffstat (limited to 'synapse')
-rw-r--r--synapse/events/__init__.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/synapse/events/__init__.py b/synapse/events/__init__.py
index 7a598a8193..baae3be69c 100644
--- a/synapse/events/__init__.py
+++ b/synapse/events/__init__.py
@@ -206,6 +206,28 @@ class _EventInternalMetadata:
 
 
 class EventBase(metaclass=abc.ABCMeta):
+    __slots__ = [
+        "room_version",
+        "signatures",
+        "unsigned",
+        "rejected_reason",
+        "_dict",
+        "auth_events",
+        "depth",
+        "content",
+        "hashes",
+        "origin",
+        "origin_server_ts",
+        "prev_events",
+        "redacts",
+        "room_id",
+        "sender",
+        "type",
+        "user_id",
+        "state_key",
+        "internal_metadata",
+    ]
+
     @property
     @abc.abstractmethod
     def format_version(self) -> int:
@@ -364,6 +386,8 @@ class FrozenEvent(EventBase):
 
 
 class FrozenEventV2(EventBase):
+    __slots__ = ["_event_id"]
+
     format_version = EventFormatVersions.V2  # All events of this type are V2
 
     def __init__(
@@ -452,6 +476,8 @@ class FrozenEventV2(EventBase):
 class FrozenEventV3(FrozenEventV2):
     """FrozenEventV3, which differs from FrozenEventV2 only in the event_id format"""
 
+    __slots__ = ["_event_id"]
+
     format_version = EventFormatVersions.V3  # All events of this type are V3
 
     @property