mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-21 17:15:38 +03:00
Rename resolve_events_with_factory
This commit is contained in:
parent
4a28d3d36f
commit
810715f79a
5 changed files with 13 additions and 13 deletions
|
@ -53,7 +53,7 @@ from synapse.replication.http.federation import (
|
|||
ReplicationFederationSendEventsRestServlet,
|
||||
)
|
||||
from synapse.replication.http.membership import ReplicationUserJoinedLeftRoomRestServlet
|
||||
from synapse.state import StateResolutionStore, resolve_events_with_factory
|
||||
from synapse.state import StateResolutionStore, resolve_events_with_store
|
||||
from synapse.types import UserID, get_domain_from_id
|
||||
from synapse.util import logcontext, unwrapFirstError
|
||||
from synapse.util.async_helpers import Linearizer
|
||||
|
@ -385,7 +385,7 @@ class FederationHandler(BaseHandler):
|
|||
event_map[x.event_id] = x
|
||||
|
||||
room_version = yield self.store.get_room_version(room_id)
|
||||
state_map = yield resolve_events_with_factory(
|
||||
state_map = yield resolve_events_with_store(
|
||||
room_version, state_maps, event_map,
|
||||
state_res_store=StateResolutionStore(self.store),
|
||||
)
|
||||
|
|
|
@ -394,7 +394,7 @@ class StateHandler(object):
|
|||
}
|
||||
|
||||
with Measure(self.clock, "state._resolve_events"):
|
||||
new_state = yield resolve_events_with_factory(
|
||||
new_state = yield resolve_events_with_store(
|
||||
room_version, state_set_ids,
|
||||
event_map=state_map,
|
||||
state_res_store=StateResolutionStore(self.store),
|
||||
|
@ -478,10 +478,10 @@ class StateResolutionHandler(object):
|
|||
|
||||
# start by assuming we won't have any conflicted state, and build up the new
|
||||
# state map by iterating through the state groups. If we discover a conflict,
|
||||
# we give up and instead use `resolve_events_with_factory`.
|
||||
# we give up and instead use `resolve_events_with_store`.
|
||||
#
|
||||
# XXX: is this actually worthwhile, or should we just let
|
||||
# resolve_events_with_factory do it?
|
||||
# resolve_events_with_store do it?
|
||||
new_state = {}
|
||||
conflicted_state = False
|
||||
for st in itervalues(state_groups_ids):
|
||||
|
@ -496,7 +496,7 @@ class StateResolutionHandler(object):
|
|||
if conflicted_state:
|
||||
logger.info("Resolving conflicted state for %r", room_id)
|
||||
with Measure(self.clock, "state._resolve_events"):
|
||||
new_state = yield resolve_events_with_factory(
|
||||
new_state = yield resolve_events_with_store(
|
||||
room_version,
|
||||
list(itervalues(state_groups_ids)),
|
||||
event_map=event_map,
|
||||
|
@ -581,7 +581,7 @@ def _make_state_cache_entry(
|
|||
)
|
||||
|
||||
|
||||
def resolve_events_with_factory(room_version, state_sets, event_map, state_res_store):
|
||||
def resolve_events_with_store(room_version, state_sets, event_map, state_res_store):
|
||||
"""
|
||||
Args:
|
||||
room_version(str): Version of the room
|
||||
|
@ -604,11 +604,11 @@ def resolve_events_with_factory(room_version, state_sets, event_map, state_res_s
|
|||
a map from (type, state_key) to event_id.
|
||||
"""
|
||||
if room_version == RoomVersions.V1:
|
||||
return v1.resolve_events_with_factory(
|
||||
return v1.resolve_events_with_store(
|
||||
state_sets, event_map, state_res_store.get_events,
|
||||
)
|
||||
elif room_version == RoomVersions.VDH_TEST:
|
||||
return v2.resolve_events_with_factory(
|
||||
return v2.resolve_events_with_store(
|
||||
state_sets, event_map, state_res_store,
|
||||
)
|
||||
else:
|
||||
|
|
|
@ -31,7 +31,7 @@ POWER_KEY = (EventTypes.PowerLevels, "")
|
|||
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def resolve_events_with_factory(state_sets, event_map, state_map_factory):
|
||||
def resolve_events_with_store(state_sets, event_map, state_map_factory):
|
||||
"""
|
||||
Args:
|
||||
state_sets(list): List of dicts of (type, state_key) -> event_id,
|
||||
|
|
|
@ -29,7 +29,7 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def resolve_events_with_factory(state_sets, event_map, state_res_store):
|
||||
def resolve_events_with_store(state_sets, event_map, state_res_store):
|
||||
"""Resolves the state using the v2 state resolution algorithm
|
||||
|
||||
Args:
|
||||
|
|
|
@ -24,7 +24,7 @@ from synapse.event_auth import auth_types_for_event
|
|||
from synapse.events import FrozenEvent
|
||||
from synapse.state.v2 import (
|
||||
lexicographical_topological_sort,
|
||||
resolve_events_with_factory,
|
||||
resolve_events_with_store,
|
||||
)
|
||||
from synapse.types import EventID
|
||||
|
||||
|
@ -541,7 +541,7 @@ class StateTestCase(unittest.TestCase):
|
|||
elif len(prev_events) == 1:
|
||||
state_before = dict(state_at_event[prev_events[0]])
|
||||
else:
|
||||
state_d = resolve_events_with_factory(
|
||||
state_d = resolve_events_with_store(
|
||||
[state_at_event[n] for n in prev_events],
|
||||
event_map=event_map,
|
||||
state_res_store=TestStateResolutionStore(event_map),
|
||||
|
|
Loading…
Reference in a new issue