diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-10-17 17:33:58 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-10-17 17:33:58 +0100 |
commit | dc3c2823ac425c9b5bbe6883b7d33a12059a08fb (patch) | |
tree | 22d02a68df93c3f98b0be7de8a07040268420369 /synapse/federation | |
parent | Rename 'meta' to 'unsigned' (diff) | |
parent | keep 'origin_server_ts' as 'ts' in the database to avoid needlessly updating ... (diff) | |
download | synapse-dc3c2823ac425c9b5bbe6883b7d33a12059a08fb.tar.xz |
Merge branch 'develop' into event_signing
Conflicts: synapse/federation/replication.py
Diffstat (limited to 'synapse/federation')
-rw-r--r-- | synapse/federation/pdu_codec.py | 4 | ||||
-rw-r--r-- | synapse/federation/persistence.py | 2 | ||||
-rw-r--r-- | synapse/federation/replication.py | 4 | ||||
-rw-r--r-- | synapse/federation/units.py | 17 |
4 files changed, 14 insertions, 13 deletions
diff --git a/synapse/federation/pdu_codec.py b/synapse/federation/pdu_codec.py index 7e574f451d..991aae2a56 100644 --- a/synapse/federation/pdu_codec.py +++ b/synapse/federation/pdu_codec.py @@ -95,8 +95,8 @@ class PduCodec(object): if k not in ["event_id", "room_id", "type"] }) - if "ts" not in kwargs: - kwargs["ts"] = int(self.clock.time_msec()) + if "origin_server_ts" not in kwargs: + kwargs["origin_server_ts"] = int(self.clock.time_msec()) pdu = Pdu(**kwargs) pdu = add_event_pdu_content_hash(pdu) diff --git a/synapse/federation/persistence.py b/synapse/federation/persistence.py index de36a80e41..7043fcc504 100644 --- a/synapse/federation/persistence.py +++ b/synapse/federation/persistence.py @@ -157,7 +157,7 @@ class TransactionActions(object): transaction.prev_ids = yield self.store.prep_send_transaction( transaction.transaction_id, transaction.destination, - transaction.ts, + transaction.origin_server_ts, [(p["pdu_id"], p["origin"]) for p in transaction.pdus] ) diff --git a/synapse/federation/replication.py b/synapse/federation/replication.py index f2a5d4d5e2..4a9414c1d4 100644 --- a/synapse/federation/replication.py +++ b/synapse/federation/replication.py @@ -427,7 +427,7 @@ class ReplicationLayer(object): return Transaction( origin=self.server_name, pdus=pdus, - ts=int(time_now), + origin_server_ts=int(time_now), destination=None, ) @@ -595,7 +595,7 @@ class _TransactionQueue(object): logger.debug("TX [%s] Persisting transaction...", destination) transaction = Transaction.create_new( - ts=int(self._clock.time_msec()), + origin_server_ts=int(self._clock.time_msec()), transaction_id=str(self._next_txn_id), origin=self.server_name, destination=destination, diff --git a/synapse/federation/units.py b/synapse/federation/units.py index c629e5793e..b81e162512 100644 --- a/synapse/federation/units.py +++ b/synapse/federation/units.py @@ -41,7 +41,7 @@ class Pdu(JsonEncodedObject): { "pdu_id": "78c", - "ts": 1404835423000, + "origin_server_ts": 1404835423000, "origin": "bar", "prev_ids": [ ["23b", "foo"], @@ -56,7 +56,7 @@ class Pdu(JsonEncodedObject): "pdu_id", "context", "origin", - "ts", + "origin_server_ts", "pdu_type", "destinations", "transaction_id", @@ -84,7 +84,7 @@ class Pdu(JsonEncodedObject): "pdu_id", "context", "origin", - "ts", + "origin_server_ts", "pdu_type", "content", ] @@ -122,6 +122,7 @@ class Pdu(JsonEncodedObject): """ if pdu_tuple: d = copy.copy(pdu_tuple.pdu_entry._asdict()) + d["origin_server_ts"] = d.pop("ts") for k in d.keys(): if d[k] is None: @@ -212,7 +213,7 @@ class Transaction(JsonEncodedObject): "transaction_id", "origin", "destination", - "ts", + "origin_server_ts", "previous_ids", "pdus", "edus", @@ -229,7 +230,7 @@ class Transaction(JsonEncodedObject): "transaction_id", "origin", "destination", - "ts", + "origin_server_ts", "pdus", ] @@ -251,10 +252,10 @@ class Transaction(JsonEncodedObject): @staticmethod def create_new(pdus, **kwargs): """ Used to create a new transaction. Will auto fill out - transaction_id and ts keys. + transaction_id and origin_server_ts keys. """ - if "ts" not in kwargs: - raise KeyError("Require 'ts' to construct a Transaction") + if "origin_server_ts" not in kwargs: + raise KeyError("Require 'origin_server_ts' to construct a Transaction") if "transaction_id" not in kwargs: raise KeyError( "Require 'transaction_id' to construct a Transaction" |