diff options
author | Erik Johnston <erik@matrix.org> | 2014-08-14 10:01:04 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2014-08-14 10:01:04 +0100 |
commit | 10294b60824347d73b01f7ce4add18467d1e6f0c (patch) | |
tree | 06d04a0a2e0ccf183bfc602ce9694d5958ed7a2e /synapse/federation | |
parent | Make feedback table also store sender. (diff) | |
parent | grammar fix (diff) | |
download | synapse-10294b60824347d73b01f7ce4add18467d1e6f0c.tar.xz |
Merge branch 'master' of github.com:matrix-org/synapse into sql_refactor
Conflicts: synapse/storage/_base.py
Diffstat (limited to 'synapse/federation')
-rw-r--r-- | synapse/federation/handler.py | 4 | ||||
-rw-r--r-- | synapse/federation/persistence.py | 6 | ||||
-rw-r--r-- | synapse/federation/replication.py | 18 | ||||
-rw-r--r-- | synapse/federation/transport.py | 34 |
4 files changed, 31 insertions, 31 deletions
diff --git a/synapse/federation/handler.py b/synapse/federation/handler.py index d361f0aaf7..580e591aca 100644 --- a/synapse/federation/handler.py +++ b/synapse/federation/handler.py @@ -75,8 +75,8 @@ class FederationEventHandler(object): @log_function @defer.inlineCallbacks def backfill(self, room_id, limit): - # TODO: Work out which destinations to ask for pagination - # self.replication_layer.paginate(dest, room_id, limit) + # TODO: Work out which destinations to ask for backfill + # self.replication_layer.backfill(dest, room_id, limit) pass @log_function diff --git a/synapse/federation/persistence.py b/synapse/federation/persistence.py index 372245712a..e0e4de4e8c 100644 --- a/synapse/federation/persistence.py +++ b/synapse/federation/persistence.py @@ -114,14 +114,14 @@ class PduActions(object): @defer.inlineCallbacks @log_function - def paginate(self, context, pdu_list, limit): + def backfill(self, context, pdu_list, limit): """ For a given list of PDU id and origins return the proceeding `limit` `Pdu`s in the given `context`. Returns: Deferred: Results in a list of `Pdu`s. """ - results = yield self.store.get_pagination( + results = yield self.store.get_backfill( context, pdu_list, limit ) @@ -131,7 +131,7 @@ class PduActions(object): def is_new(self, pdu): """ When we receive a `Pdu` from a remote home server, we want to figure out whether it is `new`, i.e. it is not some historic PDU that - we haven't seen simply because we haven't paginated back that far. + we haven't seen simply because we haven't backfilled back that far. Returns: Deferred: Results in a `bool` diff --git a/synapse/federation/replication.py b/synapse/federation/replication.py index 01020566cf..bc9df2f214 100644 --- a/synapse/federation/replication.py +++ b/synapse/federation/replication.py @@ -118,7 +118,7 @@ class ReplicationLayer(object): *Note:* The home server should always call `send_pdu` even if it knows that it does not need to be replicated to other home servers. This is in case e.g. someone else joins via a remote home server and then - paginates. + backfills. TODO: Figure out when we should actually resolve the deferred. @@ -179,13 +179,13 @@ class ReplicationLayer(object): @defer.inlineCallbacks @log_function - def paginate(self, dest, context, limit): + def backfill(self, dest, context, limit): """Requests some more historic PDUs for the given context from the given destination server. Args: dest (str): The remote home server to ask. - context (str): The context to paginate back on. + context (str): The context to backfill. limit (int): The maximum number of PDUs to return. Returns: @@ -193,16 +193,16 @@ class ReplicationLayer(object): """ extremities = yield self.store.get_oldest_pdus_in_context(context) - logger.debug("paginate extrem=%s", extremities) + logger.debug("backfill extrem=%s", extremities) # If there are no extremeties then we've (probably) reached the start. if not extremities: return - transaction_data = yield self.transport_layer.paginate( + transaction_data = yield self.transport_layer.backfill( dest, context, extremities, limit) - logger.debug("paginate transaction_data=%s", repr(transaction_data)) + logger.debug("backfill transaction_data=%s", repr(transaction_data)) transaction = Transaction(**transaction_data) @@ -281,9 +281,9 @@ class ReplicationLayer(object): @defer.inlineCallbacks @log_function - def on_paginate_request(self, context, versions, limit): + def on_backfill_request(self, context, versions, limit): - pdus = yield self.pdu_actions.paginate(context, versions, limit) + pdus = yield self.pdu_actions.backfill(context, versions, limit) defer.returnValue((200, self._transaction_from_pdus(pdus).get_dict())) @@ -427,7 +427,7 @@ class ReplicationLayer(object): # Get missing pdus if necessary. is_new = yield self.pdu_actions.is_new(pdu) if is_new and not pdu.outlier: - # We only paginate backwards to the min depth. + # We only backfill backwards to the min depth. min_depth = yield self.store.get_min_depth_for_context(pdu.context) if min_depth and pdu.depth > min_depth: diff --git a/synapse/federation/transport.py b/synapse/federation/transport.py index 69166036fb..e09dfc2670 100644 --- a/synapse/federation/transport.py +++ b/synapse/federation/transport.py @@ -112,7 +112,7 @@ class TransportLayer(object): return self._do_request_for_transaction(destination, subpath) @log_function - def paginate(self, dest, context, pdu_tuples, limit): + def backfill(self, dest, context, pdu_tuples, limit): """ Requests `limit` previous PDUs in a given context before list of PDUs. @@ -126,14 +126,14 @@ class TransportLayer(object): Deferred: Results in a dict received from the remote homeserver. """ logger.debug( - "paginate dest=%s, context=%s, pdu_tuples=%s, limit=%s", + "backfill dest=%s, context=%s, pdu_tuples=%s, limit=%s", dest, context, repr(pdu_tuples), str(limit) ) if not pdu_tuples: return - subpath = "/paginate/%s/" % context + subpath = "/backfill/%s/" % context args = {"v": ["%s,%s" % (i, o) for i, o in pdu_tuples]} args["limit"] = limit @@ -251,8 +251,8 @@ class TransportLayer(object): self.server.register_path( "GET", - re.compile("^" + PREFIX + "/paginate/([^/]*)/$"), - lambda request, context: self._on_paginate_request( + re.compile("^" + PREFIX + "/backfill/([^/]*)/$"), + lambda request, context: self._on_backfill_request( context, request.args["v"], request.args["limit"] ) @@ -352,7 +352,7 @@ class TransportLayer(object): defer.returnValue(data) @log_function - def _on_paginate_request(self, context, v_list, limits): + def _on_backfill_request(self, context, v_list, limits): if not limits: return defer.succeed( (400, {"error": "Did not include limit param"}) @@ -362,7 +362,7 @@ class TransportLayer(object): versions = [v.split(",", 1) for v in v_list] - return self.request_handler.on_paginate_request( + return self.request_handler.on_backfill_request( context, versions, limit) @@ -371,14 +371,14 @@ class TransportReceivedHandler(object): """ def on_incoming_transaction(self, transaction): """ Called on PUT /send/<transaction_id>, or on response to a request - that we sent (e.g. a pagination request) + that we sent (e.g. a backfill request) Args: transaction (synapse.transaction.Transaction): The transaction that was sent to us. Returns: - twisted.internet.defer.Deferred: A deferred that get's fired when + twisted.internet.defer.Deferred: A deferred that gets fired when the transaction has finished being processed. The result should be a tuple in the form of @@ -438,14 +438,14 @@ class TransportRequestHandler(object): def on_context_state_request(self, context): """ Called on GET /state/<context>/ - Get's hit when someone wants all the *current* state for a given + Gets hit when someone wants all the *current* state for a given contexts. Args: context (str): The name of the context that we're interested in. Returns: - twisted.internet.defer.Deferred: A deferred that get's fired when + twisted.internet.defer.Deferred: A deferred that gets fired when the transaction has finished being processed. The result should be a tuple in the form of @@ -457,20 +457,20 @@ class TransportRequestHandler(object): """ pass - def on_paginate_request(self, context, versions, limit): - """ Called on GET /paginate/<context>/?v=...&limit=... + def on_backfill_request(self, context, versions, limit): + """ Called on GET /backfill/<context>/?v=...&limit=... - Get's hit when we want to paginate backwards on a given context from + Gets hit when we want to backfill backwards on a given context from the given point. Args: - context (str): The context to paginate on - versions (list): A list of 2-tuple's representing where to paginate + context (str): The context to backfill + versions (list): A list of 2-tuples representing where to backfill from, in the form `(pdu_id, origin)` limit (int): How many pdus to return. Returns: - Deferred: Resultsin a tuple in the form of + Deferred: Results in a tuple in the form of `(response_code, respond_body)`, where `response_body` is a python dict that will get serialized to JSON. |