Refactor get_recent_events_for_room return type

There is no reason to return a tuple of tokens when the last token is
always the token passed as an argument. Changing it makes it consistent
with other storage APIs
This commit is contained in:
Erik Johnston 2018-05-09 11:55:34 +01:00
parent 05e0a2462c
commit c4af4c24ca
3 changed files with 21 additions and 7 deletions

View file

@ -359,6 +359,20 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
@defer.inlineCallbacks
def get_recent_events_for_room(self, room_id, limit, end_token):
"""Get the most recent events in the room in topological ordering.
Args:
room_id (str)
limit (int)
end_token (str): The stream token representing now.
Returns:
Deferred[tuple[list[FrozenEvent], str]]: Returns a list of
events and a token pointint to the start of the returned
events.
The events returned are in ascending order.
"""
rows, token = yield self.get_recent_event_ids_for_room(
room_id, limit, end_token,
)
@ -372,7 +386,7 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
self._set_before_and_after(events, rows)
defer.returnValue((events, (token, end_token)))
defer.returnValue((events, token))
@defer.inlineCallbacks
def get_recent_event_ids_for_room(self, room_id, limit, end_token):