This commit is contained in:
Erik Johnston 2017-06-07 11:08:36 +01:00
parent 09e4bc0501
commit 6ba21bf2b8
2 changed files with 15 additions and 0 deletions

View File

@ -644,6 +644,10 @@ class RoomMemberStore(SQLBaseStore):
class _JoinedHostsCache(object): class _JoinedHostsCache(object):
"""Cache for joined hosts in a room that is optimised to handle updates
via state deltas.
"""
def __init__(self, store, room_id): def __init__(self, store, room_id):
self.store = store self.store = store
self.room_id = room_id self.room_id = room_id
@ -658,6 +662,11 @@ class _JoinedHostsCache(object):
@defer.inlineCallbacks @defer.inlineCallbacks
def get_destinations(self, state_entry): def get_destinations(self, state_entry):
"""Get set of destinations for a state entry
Args:
state_entry(synapse.state._StateCacheEntry)
"""
if state_entry.state_group == self.state_group: if state_entry.state_group == self.state_group:
defer.returnValue(frozenset(self.hosts_to_joined_users)) defer.returnValue(frozenset(self.hosts_to_joined_users))

View File

@ -99,6 +99,12 @@ class StateStore(SQLBaseStore):
) )
def get_state_group_delta(self, state_group): def get_state_group_delta(self, state_group):
"""Given a state group try to return a previous group and a delta between
the old and the new.
Returns:
(prev_group, delta_ids), where both may be None.
"""
def _get_state_group_delta_txn(txn): def _get_state_group_delta_txn(txn):
prev_group = self._simple_select_one_onecol_txn( prev_group = self._simple_select_one_onecol_txn(
txn, txn,