From 4bfdec1eb28aa272391607b2cf1f24c781d9ba74 Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Fri, 29 Aug 2014 18:39:09 +0100 Subject: [PATCH] Rename 'events_key' to 'room_key' so it matches the name of the event source --- synapse/handlers/message.py | 6 +++--- synapse/handlers/room.py | 10 +++++----- synapse/streams/events.py | 2 +- synapse/types.py | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 3d7f97bcff..c8ff34e5f5 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -274,11 +274,11 @@ class MessageHandler(BaseRoomHandler): messages, token = yield self.store.get_recent_events_for_room( event.room_id, limit=limit, - end_token=now_token.events_key, + end_token=now_token.room_key, ) - start_token = now_token.copy_and_replace("events_key", token[0]) - end_token = now_token.copy_and_replace("events_key", token[1]) + start_token = now_token.copy_and_replace("room_key", token[0]) + end_token = now_token.copy_and_replace("room_key", token[1]) d["messages"] = { "chunk": [m.get_dict() for m in messages], diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index 6fbb4bc18d..b27bdecd43 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -476,13 +476,13 @@ class RoomEventSource(object): events, end_key = yield self.store.get_room_events_stream( user_id=user.to_string(), - from_key=from_token.events_key, + from_key=from_token.room_key, to_key=to_key, room_id=None, limit=limit, ) - end_token = from_token.copy_and_replace("events_key", end_key) + end_token = from_token.copy_and_replace("room_key", end_key) defer.returnValue((events, end_token)) @@ -496,17 +496,17 @@ class RoomEventSource(object): limit = pagination_config.limit direction = pagination_config.direction - to_key = to_token.events_key if to_token else None + to_key = to_token.room_key if to_token else None events, next_key = yield self.store.paginate_room_events( room_id=key, - from_key=from_token.events_key, + from_key=from_token.room_key, to_key=to_key, direction=direction, limit=limit, with_feedback=True ) - next_token = from_token.copy_and_replace("events_key", next_key) + next_token = from_token.copy_and_replace("room_key", next_key) defer.returnValue((events, next_token)) diff --git a/synapse/streams/events.py b/synapse/streams/events.py index 4bec6605bd..8480368673 100644 --- a/synapse/streams/events.py +++ b/synapse/streams/events.py @@ -54,7 +54,7 @@ class EventSources(object): @defer.inlineCallbacks def get_current_token(self): token = StreamToken( - events_key=( + room_key=( yield self.sources["room"].get_current_token_part() ), presence_key=( diff --git a/synapse/types.py b/synapse/types.py index d93b02a56e..1a9dceabf5 100644 --- a/synapse/types.py +++ b/synapse/types.py @@ -97,7 +97,7 @@ class RoomID(DomainSpecificString): class StreamToken( namedtuple( "Token", - ("events_key", "presence_key", "typing_key") + ("room_key", "presence_key", "typing_key") ) ): _SEPARATOR = "_"