summary refs log tree commit diff
path: root/synapse/events/builder.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-12-03 16:07:21 +0000
committerErik Johnston <erik@matrix.org>2014-12-03 16:07:21 +0000
commit75b4329aaad400abcee4b23e9c88ff845e0d73c7 (patch)
treeb2e947686ad0cf166e9dbcd8a5a3ac50555f862f /synapse/events/builder.py
parentMerge branch 'develop' of github.com:matrix-org/synapse into events_refactor (diff)
downloadsynapse-75b4329aaad400abcee4b23e9c88ff845e0d73c7.tar.xz
WIP for new way of managing events.
Diffstat (limited to 'synapse/events/builder.py')
-rw-r--r--synapse/events/builder.py20
1 files changed, 6 insertions, 14 deletions
diff --git a/synapse/events/builder.py b/synapse/events/builder.py
index d741795bc5..39b4d2a2ab 100644
--- a/synapse/events/builder.py
+++ b/synapse/events/builder.py
@@ -13,32 +13,24 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from . import Event
+from . import EventBase, FrozenEvent
 
 from synapse.types import EventID
 
 from synapse.util.stringutils import random_string
 
 
-class EventBuilder(object):
+class EventBuilder(EventBase):
     def __init__(self, key_values={}):
-        self._event_dict = dict(key_values)
-        self._metadata = {}
-
-    def update_event_key(self, key, value):
-        self._event_dict[key] = value
+        super(FrozenEvent, self).__init__(
+            key_values,
+        )
 
     def update_event_keys(self, other_dict):
         self._event_dict.update(other_dict)
 
-    def update_internal_key(self, key, value):
-        self._metadata[key] = value
-
     def build(self):
-        return Event(
-            self._event_dict,
-            self._metadata,
-        )
+        return FrozenEvent.from_event(self)
 
 
 class EventBuilderFactory(object):