mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-17 03:14:28 -05:00
Fix up state_store
naming (#12871)
This commit is contained in:
parent
a8db8c6eba
commit
4660d9fdcf
1
changelog.d/12871.misc
Normal file
1
changelog.d/12871.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Fix up the variable `state_store` naming.
|
@ -31,7 +31,7 @@ class AdminHandler:
|
|||||||
def __init__(self, hs: "HomeServer"):
|
def __init__(self, hs: "HomeServer"):
|
||||||
self.store = hs.get_datastores().main
|
self.store = hs.get_datastores().main
|
||||||
self.storage = hs.get_storage()
|
self.storage = hs.get_storage()
|
||||||
self.state_store = self.storage.state
|
self.state_storage = self.storage.state
|
||||||
|
|
||||||
async def get_whois(self, user: UserID) -> JsonDict:
|
async def get_whois(self, user: UserID) -> JsonDict:
|
||||||
connections = []
|
connections = []
|
||||||
@ -233,7 +233,7 @@ class AdminHandler:
|
|||||||
for event_id in extremities:
|
for event_id in extremities:
|
||||||
if not event_to_unseen_prevs[event_id]:
|
if not event_to_unseen_prevs[event_id]:
|
||||||
continue
|
continue
|
||||||
state = await self.state_store.get_state_for_event(event_id)
|
state = await self.state_storage.get_state_for_event(event_id)
|
||||||
writer.write_state(room_id, event_id, state)
|
writer.write_state(room_id, event_id, state)
|
||||||
|
|
||||||
return writer.finished()
|
return writer.finished()
|
||||||
|
@ -70,7 +70,7 @@ class DeviceWorkerHandler:
|
|||||||
self.store = hs.get_datastores().main
|
self.store = hs.get_datastores().main
|
||||||
self.notifier = hs.get_notifier()
|
self.notifier = hs.get_notifier()
|
||||||
self.state = hs.get_state_handler()
|
self.state = hs.get_state_handler()
|
||||||
self.state_store = hs.get_storage().state
|
self.state_storage = hs.get_storage().state
|
||||||
self._auth_handler = hs.get_auth_handler()
|
self._auth_handler = hs.get_auth_handler()
|
||||||
self.server_name = hs.hostname
|
self.server_name = hs.hostname
|
||||||
|
|
||||||
@ -203,7 +203,9 @@ class DeviceWorkerHandler:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# mapping from event_id -> state_dict
|
# mapping from event_id -> state_dict
|
||||||
prev_state_ids = await self.state_store.get_state_ids_for_events(event_ids)
|
prev_state_ids = await self.state_storage.get_state_ids_for_events(
|
||||||
|
event_ids
|
||||||
|
)
|
||||||
|
|
||||||
# Check if we've joined the room? If so we just blindly add all the users to
|
# Check if we've joined the room? If so we just blindly add all the users to
|
||||||
# the "possibly changed" users.
|
# the "possibly changed" users.
|
||||||
|
@ -126,7 +126,7 @@ class FederationHandler:
|
|||||||
|
|
||||||
self.store = hs.get_datastores().main
|
self.store = hs.get_datastores().main
|
||||||
self.storage = hs.get_storage()
|
self.storage = hs.get_storage()
|
||||||
self.state_store = self.storage.state
|
self.state_storage = self.storage.state
|
||||||
self.federation_client = hs.get_federation_client()
|
self.federation_client = hs.get_federation_client()
|
||||||
self.state_handler = hs.get_state_handler()
|
self.state_handler = hs.get_state_handler()
|
||||||
self.server_name = hs.hostname
|
self.server_name = hs.hostname
|
||||||
@ -1027,7 +1027,9 @@ class FederationHandler:
|
|||||||
if event.internal_metadata.outlier:
|
if event.internal_metadata.outlier:
|
||||||
raise NotFoundError("State not known at event %s" % (event_id,))
|
raise NotFoundError("State not known at event %s" % (event_id,))
|
||||||
|
|
||||||
state_groups = await self.state_store.get_state_groups_ids(room_id, [event_id])
|
state_groups = await self.state_storage.get_state_groups_ids(
|
||||||
|
room_id, [event_id]
|
||||||
|
)
|
||||||
|
|
||||||
# get_state_groups_ids should return exactly one result
|
# get_state_groups_ids should return exactly one result
|
||||||
assert len(state_groups) == 1
|
assert len(state_groups) == 1
|
||||||
|
@ -99,7 +99,7 @@ class FederationEventHandler:
|
|||||||
def __init__(self, hs: "HomeServer"):
|
def __init__(self, hs: "HomeServer"):
|
||||||
self._store = hs.get_datastores().main
|
self._store = hs.get_datastores().main
|
||||||
self._storage = hs.get_storage()
|
self._storage = hs.get_storage()
|
||||||
self._state_store = self._storage.state
|
self._state_storage = self._storage.state
|
||||||
|
|
||||||
self._state_handler = hs.get_state_handler()
|
self._state_handler = hs.get_state_handler()
|
||||||
self._event_creation_handler = hs.get_event_creation_handler()
|
self._event_creation_handler = hs.get_event_creation_handler()
|
||||||
@ -533,7 +533,7 @@ class FederationEventHandler:
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
await self._store.update_state_for_partial_state_event(event, context)
|
await self._store.update_state_for_partial_state_event(event, context)
|
||||||
self._state_store.notify_event_un_partial_stated(event.event_id)
|
self._state_storage.notify_event_un_partial_stated(event.event_id)
|
||||||
|
|
||||||
async def backfill(
|
async def backfill(
|
||||||
self, dest: str, room_id: str, limit: int, extremities: Collection[str]
|
self, dest: str, room_id: str, limit: int, extremities: Collection[str]
|
||||||
@ -832,7 +832,7 @@ class FederationEventHandler:
|
|||||||
event_map = {event_id: event}
|
event_map = {event_id: event}
|
||||||
try:
|
try:
|
||||||
# Get the state of the events we know about
|
# Get the state of the events we know about
|
||||||
ours = await self._state_store.get_state_groups_ids(room_id, seen)
|
ours = await self._state_storage.get_state_groups_ids(room_id, seen)
|
||||||
|
|
||||||
# state_maps is a list of mappings from (type, state_key) to event_id
|
# state_maps is a list of mappings from (type, state_key) to event_id
|
||||||
state_maps: List[StateMap[str]] = list(ours.values())
|
state_maps: List[StateMap[str]] = list(ours.values())
|
||||||
@ -1626,7 +1626,7 @@ class FederationEventHandler:
|
|||||||
# given state at the event. This should correctly handle cases
|
# given state at the event. This should correctly handle cases
|
||||||
# like bans, especially with state res v2.
|
# like bans, especially with state res v2.
|
||||||
|
|
||||||
state_sets_d = await self._state_store.get_state_groups(
|
state_sets_d = await self._state_storage.get_state_groups(
|
||||||
event.room_id, extrem_ids
|
event.room_id, extrem_ids
|
||||||
)
|
)
|
||||||
state_sets: List[Iterable[EventBase]] = list(state_sets_d.values())
|
state_sets: List[Iterable[EventBase]] = list(state_sets_d.values())
|
||||||
@ -1895,7 +1895,7 @@ class FederationEventHandler:
|
|||||||
|
|
||||||
# create a new state group as a delta from the existing one.
|
# create a new state group as a delta from the existing one.
|
||||||
prev_group = context.state_group
|
prev_group = context.state_group
|
||||||
state_group = await self._state_store.store_state_group(
|
state_group = await self._state_storage.store_state_group(
|
||||||
event.event_id,
|
event.event_id,
|
||||||
event.room_id,
|
event.room_id,
|
||||||
prev_group=prev_group,
|
prev_group=prev_group,
|
||||||
|
@ -68,7 +68,7 @@ class InitialSyncHandler:
|
|||||||
] = ResponseCache(hs.get_clock(), "initial_sync_cache")
|
] = ResponseCache(hs.get_clock(), "initial_sync_cache")
|
||||||
self._event_serializer = hs.get_event_client_serializer()
|
self._event_serializer = hs.get_event_client_serializer()
|
||||||
self.storage = hs.get_storage()
|
self.storage = hs.get_storage()
|
||||||
self.state_store = self.storage.state
|
self.state_storage = self.storage.state
|
||||||
|
|
||||||
async def snapshot_all_rooms(
|
async def snapshot_all_rooms(
|
||||||
self,
|
self,
|
||||||
@ -198,7 +198,7 @@ class InitialSyncHandler:
|
|||||||
event.stream_ordering,
|
event.stream_ordering,
|
||||||
)
|
)
|
||||||
deferred_room_state = run_in_background(
|
deferred_room_state = run_in_background(
|
||||||
self.state_store.get_state_for_events, [event.event_id]
|
self.state_storage.get_state_for_events, [event.event_id]
|
||||||
).addCallback(
|
).addCallback(
|
||||||
lambda states: cast(StateMap[EventBase], states[event.event_id])
|
lambda states: cast(StateMap[EventBase], states[event.event_id])
|
||||||
)
|
)
|
||||||
@ -355,7 +355,7 @@ class InitialSyncHandler:
|
|||||||
member_event_id: str,
|
member_event_id: str,
|
||||||
is_peeking: bool,
|
is_peeking: bool,
|
||||||
) -> JsonDict:
|
) -> JsonDict:
|
||||||
room_state = await self.state_store.get_state_for_event(member_event_id)
|
room_state = await self.state_storage.get_state_for_event(member_event_id)
|
||||||
|
|
||||||
limit = pagin_config.limit if pagin_config else None
|
limit = pagin_config.limit if pagin_config else None
|
||||||
if limit is None:
|
if limit is None:
|
||||||
|
@ -78,7 +78,7 @@ class MessageHandler:
|
|||||||
self.state = hs.get_state_handler()
|
self.state = hs.get_state_handler()
|
||||||
self.store = hs.get_datastores().main
|
self.store = hs.get_datastores().main
|
||||||
self.storage = hs.get_storage()
|
self.storage = hs.get_storage()
|
||||||
self.state_store = self.storage.state
|
self.state_storage = self.storage.state
|
||||||
self._event_serializer = hs.get_event_client_serializer()
|
self._event_serializer = hs.get_event_client_serializer()
|
||||||
self._ephemeral_events_enabled = hs.config.server.enable_ephemeral_messages
|
self._ephemeral_events_enabled = hs.config.server.enable_ephemeral_messages
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ class MessageHandler:
|
|||||||
assert (
|
assert (
|
||||||
membership_event_id is not None
|
membership_event_id is not None
|
||||||
), "check_user_in_room_or_world_readable returned invalid data"
|
), "check_user_in_room_or_world_readable returned invalid data"
|
||||||
room_state = await self.state_store.get_state_for_events(
|
room_state = await self.state_storage.get_state_for_events(
|
||||||
[membership_event_id], StateFilter.from_types([key])
|
[membership_event_id], StateFilter.from_types([key])
|
||||||
)
|
)
|
||||||
data = room_state[membership_event_id].get(key)
|
data = room_state[membership_event_id].get(key)
|
||||||
@ -186,7 +186,7 @@ class MessageHandler:
|
|||||||
|
|
||||||
# check whether the user is in the room at that time to determine
|
# check whether the user is in the room at that time to determine
|
||||||
# whether they should be treated as peeking.
|
# whether they should be treated as peeking.
|
||||||
state_map = await self.state_store.get_state_for_event(
|
state_map = await self.state_storage.get_state_for_event(
|
||||||
last_event.event_id,
|
last_event.event_id,
|
||||||
StateFilter.from_types([(EventTypes.Member, user_id)]),
|
StateFilter.from_types([(EventTypes.Member, user_id)]),
|
||||||
)
|
)
|
||||||
@ -207,7 +207,7 @@ class MessageHandler:
|
|||||||
)
|
)
|
||||||
|
|
||||||
if visible_events:
|
if visible_events:
|
||||||
room_state_events = await self.state_store.get_state_for_events(
|
room_state_events = await self.state_storage.get_state_for_events(
|
||||||
[last_event.event_id], state_filter=state_filter
|
[last_event.event_id], state_filter=state_filter
|
||||||
)
|
)
|
||||||
room_state: Mapping[Any, EventBase] = room_state_events[
|
room_state: Mapping[Any, EventBase] = room_state_events[
|
||||||
@ -237,7 +237,7 @@ class MessageHandler:
|
|||||||
assert (
|
assert (
|
||||||
membership_event_id is not None
|
membership_event_id is not None
|
||||||
), "check_user_in_room_or_world_readable returned invalid data"
|
), "check_user_in_room_or_world_readable returned invalid data"
|
||||||
room_state_events = await self.state_store.get_state_for_events(
|
room_state_events = await self.state_storage.get_state_for_events(
|
||||||
[membership_event_id], state_filter=state_filter
|
[membership_event_id], state_filter=state_filter
|
||||||
)
|
)
|
||||||
room_state = room_state_events[membership_event_id]
|
room_state = room_state_events[membership_event_id]
|
||||||
|
@ -130,7 +130,7 @@ class PaginationHandler:
|
|||||||
self.auth = hs.get_auth()
|
self.auth = hs.get_auth()
|
||||||
self.store = hs.get_datastores().main
|
self.store = hs.get_datastores().main
|
||||||
self.storage = hs.get_storage()
|
self.storage = hs.get_storage()
|
||||||
self.state_store = self.storage.state
|
self.state_storage = self.storage.state
|
||||||
self.clock = hs.get_clock()
|
self.clock = hs.get_clock()
|
||||||
self._server_name = hs.hostname
|
self._server_name = hs.hostname
|
||||||
self._room_shutdown_handler = hs.get_room_shutdown_handler()
|
self._room_shutdown_handler = hs.get_room_shutdown_handler()
|
||||||
@ -539,7 +539,7 @@ class PaginationHandler:
|
|||||||
(EventTypes.Member, event.sender) for event in events
|
(EventTypes.Member, event.sender) for event in events
|
||||||
)
|
)
|
||||||
|
|
||||||
state_ids = await self.state_store.get_state_ids_for_event(
|
state_ids = await self.state_storage.get_state_ids_for_event(
|
||||||
events[0].event_id, state_filter=state_filter
|
events[0].event_id, state_filter=state_filter
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1193,7 +1193,7 @@ class RoomContextHandler:
|
|||||||
self.auth = hs.get_auth()
|
self.auth = hs.get_auth()
|
||||||
self.store = hs.get_datastores().main
|
self.store = hs.get_datastores().main
|
||||||
self.storage = hs.get_storage()
|
self.storage = hs.get_storage()
|
||||||
self.state_store = self.storage.state
|
self.state_storage = self.storage.state
|
||||||
self._relations_handler = hs.get_relations_handler()
|
self._relations_handler = hs.get_relations_handler()
|
||||||
|
|
||||||
async def get_event_context(
|
async def get_event_context(
|
||||||
@ -1293,7 +1293,7 @@ class RoomContextHandler:
|
|||||||
# first? Shouldn't we be consistent with /sync?
|
# first? Shouldn't we be consistent with /sync?
|
||||||
# https://github.com/matrix-org/matrix-doc/issues/687
|
# https://github.com/matrix-org/matrix-doc/issues/687
|
||||||
|
|
||||||
state = await self.state_store.get_state_for_events(
|
state = await self.state_storage.get_state_for_events(
|
||||||
[last_event_id], state_filter=state_filter
|
[last_event_id], state_filter=state_filter
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class RoomBatchHandler:
|
|||||||
def __init__(self, hs: "HomeServer"):
|
def __init__(self, hs: "HomeServer"):
|
||||||
self.hs = hs
|
self.hs = hs
|
||||||
self.store = hs.get_datastores().main
|
self.store = hs.get_datastores().main
|
||||||
self.state_store = hs.get_storage().state
|
self.state_storage = hs.get_storage().state
|
||||||
self.event_creation_handler = hs.get_event_creation_handler()
|
self.event_creation_handler = hs.get_event_creation_handler()
|
||||||
self.room_member_handler = hs.get_room_member_handler()
|
self.room_member_handler = hs.get_room_member_handler()
|
||||||
self.auth = hs.get_auth()
|
self.auth = hs.get_auth()
|
||||||
@ -141,7 +141,7 @@ class RoomBatchHandler:
|
|||||||
) = await self.store.get_max_depth_of(event_ids)
|
) = await self.store.get_max_depth_of(event_ids)
|
||||||
# mapping from (type, state_key) -> state_event_id
|
# mapping from (type, state_key) -> state_event_id
|
||||||
assert most_recent_event_id is not None
|
assert most_recent_event_id is not None
|
||||||
prev_state_map = await self.state_store.get_state_ids_for_event(
|
prev_state_map = await self.state_storage.get_state_ids_for_event(
|
||||||
most_recent_event_id
|
most_recent_event_id
|
||||||
)
|
)
|
||||||
# List of state event ID's
|
# List of state event ID's
|
||||||
|
@ -56,7 +56,7 @@ class SearchHandler:
|
|||||||
self._event_serializer = hs.get_event_client_serializer()
|
self._event_serializer = hs.get_event_client_serializer()
|
||||||
self._relations_handler = hs.get_relations_handler()
|
self._relations_handler = hs.get_relations_handler()
|
||||||
self.storage = hs.get_storage()
|
self.storage = hs.get_storage()
|
||||||
self.state_store = self.storage.state
|
self.state_storage = self.storage.state
|
||||||
self.auth = hs.get_auth()
|
self.auth = hs.get_auth()
|
||||||
|
|
||||||
async def get_old_rooms_from_upgraded_room(self, room_id: str) -> Iterable[str]:
|
async def get_old_rooms_from_upgraded_room(self, room_id: str) -> Iterable[str]:
|
||||||
@ -677,7 +677,7 @@ class SearchHandler:
|
|||||||
[(EventTypes.Member, sender) for sender in senders]
|
[(EventTypes.Member, sender) for sender in senders]
|
||||||
)
|
)
|
||||||
|
|
||||||
state = await self.state_store.get_state_for_event(
|
state = await self.state_storage.get_state_for_event(
|
||||||
last_event_id, state_filter
|
last_event_id, state_filter
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ class SyncHandler:
|
|||||||
self.state = hs.get_state_handler()
|
self.state = hs.get_state_handler()
|
||||||
self.auth = hs.get_auth()
|
self.auth = hs.get_auth()
|
||||||
self.storage = hs.get_storage()
|
self.storage = hs.get_storage()
|
||||||
self.state_store = self.storage.state
|
self.state_storage = self.storage.state
|
||||||
|
|
||||||
# TODO: flush cache entries on subsequent sync request.
|
# TODO: flush cache entries on subsequent sync request.
|
||||||
# Once we get the next /sync request (ie, one with the same access token
|
# Once we get the next /sync request (ie, one with the same access token
|
||||||
@ -630,7 +630,7 @@ class SyncHandler:
|
|||||||
event: event of interest
|
event: event of interest
|
||||||
state_filter: The state filter used to fetch state from the database.
|
state_filter: The state filter used to fetch state from the database.
|
||||||
"""
|
"""
|
||||||
state_ids = await self.state_store.get_state_ids_for_event(
|
state_ids = await self.state_storage.get_state_ids_for_event(
|
||||||
event.event_id, state_filter=state_filter or StateFilter.all()
|
event.event_id, state_filter=state_filter or StateFilter.all()
|
||||||
)
|
)
|
||||||
if event.is_state():
|
if event.is_state():
|
||||||
@ -710,7 +710,7 @@ class SyncHandler:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
last_event = last_events[-1]
|
last_event = last_events[-1]
|
||||||
state_ids = await self.state_store.get_state_ids_for_event(
|
state_ids = await self.state_storage.get_state_ids_for_event(
|
||||||
last_event.event_id,
|
last_event.event_id,
|
||||||
state_filter=StateFilter.from_types(
|
state_filter=StateFilter.from_types(
|
||||||
[(EventTypes.Name, ""), (EventTypes.CanonicalAlias, "")]
|
[(EventTypes.Name, ""), (EventTypes.CanonicalAlias, "")]
|
||||||
@ -888,11 +888,13 @@ class SyncHandler:
|
|||||||
|
|
||||||
if full_state:
|
if full_state:
|
||||||
if batch:
|
if batch:
|
||||||
current_state_ids = await self.state_store.get_state_ids_for_event(
|
current_state_ids = (
|
||||||
batch.events[-1].event_id, state_filter=state_filter
|
await self.state_storage.get_state_ids_for_event(
|
||||||
|
batch.events[-1].event_id, state_filter=state_filter
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
state_ids = await self.state_store.get_state_ids_for_event(
|
state_ids = await self.state_storage.get_state_ids_for_event(
|
||||||
batch.events[0].event_id, state_filter=state_filter
|
batch.events[0].event_id, state_filter=state_filter
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -913,7 +915,7 @@ class SyncHandler:
|
|||||||
elif batch.limited:
|
elif batch.limited:
|
||||||
if batch:
|
if batch:
|
||||||
state_at_timeline_start = (
|
state_at_timeline_start = (
|
||||||
await self.state_store.get_state_ids_for_event(
|
await self.state_storage.get_state_ids_for_event(
|
||||||
batch.events[0].event_id, state_filter=state_filter
|
batch.events[0].event_id, state_filter=state_filter
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -947,8 +949,10 @@ class SyncHandler:
|
|||||||
)
|
)
|
||||||
|
|
||||||
if batch:
|
if batch:
|
||||||
current_state_ids = await self.state_store.get_state_ids_for_event(
|
current_state_ids = (
|
||||||
batch.events[-1].event_id, state_filter=state_filter
|
await self.state_storage.get_state_ids_for_event(
|
||||||
|
batch.events[-1].event_id, state_filter=state_filter
|
||||||
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# Its not clear how we get here, but empirically we do
|
# Its not clear how we get here, but empirically we do
|
||||||
@ -978,7 +982,7 @@ class SyncHandler:
|
|||||||
# So we fish out all the member events corresponding to the
|
# So we fish out all the member events corresponding to the
|
||||||
# timeline here, and then dedupe any redundant ones below.
|
# timeline here, and then dedupe any redundant ones below.
|
||||||
|
|
||||||
state_ids = await self.state_store.get_state_ids_for_event(
|
state_ids = await self.state_storage.get_state_ids_for_event(
|
||||||
batch.events[0].event_id,
|
batch.events[0].event_id,
|
||||||
# we only want members!
|
# we only want members!
|
||||||
state_filter=StateFilter.from_types(
|
state_filter=StateFilter.from_types(
|
||||||
|
@ -114,7 +114,7 @@ class Mailer:
|
|||||||
|
|
||||||
self.send_email_handler = hs.get_send_email_handler()
|
self.send_email_handler = hs.get_send_email_handler()
|
||||||
self.store = self.hs.get_datastores().main
|
self.store = self.hs.get_datastores().main
|
||||||
self.state_store = self.hs.get_storage().state
|
self.state_storage = self.hs.get_storage().state
|
||||||
self.macaroon_gen = self.hs.get_macaroon_generator()
|
self.macaroon_gen = self.hs.get_macaroon_generator()
|
||||||
self.state_handler = self.hs.get_state_handler()
|
self.state_handler = self.hs.get_state_handler()
|
||||||
self.storage = hs.get_storage()
|
self.storage = hs.get_storage()
|
||||||
@ -494,7 +494,7 @@ class Mailer:
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# Attempt to check the historical state for the room.
|
# Attempt to check the historical state for the room.
|
||||||
historical_state = await self.state_store.get_state_for_event(
|
historical_state = await self.state_storage.get_state_for_event(
|
||||||
event.event_id, StateFilter.from_types((type_state_key,))
|
event.event_id, StateFilter.from_types((type_state_key,))
|
||||||
)
|
)
|
||||||
sender_state_event = historical_state.get(type_state_key)
|
sender_state_event = historical_state.get(type_state_key)
|
||||||
@ -767,7 +767,7 @@ class Mailer:
|
|||||||
member_event_ids.append(sender_state_event_id)
|
member_event_ids.append(sender_state_event_id)
|
||||||
else:
|
else:
|
||||||
# Attempt to check the historical state for the room.
|
# Attempt to check the historical state for the room.
|
||||||
historical_state = await self.state_store.get_state_for_event(
|
historical_state = await self.state_storage.get_state_for_event(
|
||||||
event_id, StateFilter.from_types((type_state_key,))
|
event_id, StateFilter.from_types((type_state_key,))
|
||||||
)
|
)
|
||||||
sender_state_event = historical_state.get(type_state_key)
|
sender_state_event = historical_state.get(type_state_key)
|
||||||
|
@ -127,7 +127,7 @@ class StateHandler:
|
|||||||
def __init__(self, hs: "HomeServer"):
|
def __init__(self, hs: "HomeServer"):
|
||||||
self.clock = hs.get_clock()
|
self.clock = hs.get_clock()
|
||||||
self.store = hs.get_datastores().main
|
self.store = hs.get_datastores().main
|
||||||
self.state_store = hs.get_storage().state
|
self.state_storage = hs.get_storage().state
|
||||||
self.hs = hs
|
self.hs = hs
|
||||||
self._state_resolution_handler = hs.get_state_resolution_handler()
|
self._state_resolution_handler = hs.get_state_resolution_handler()
|
||||||
self._storage = hs.get_storage()
|
self._storage = hs.get_storage()
|
||||||
@ -339,7 +339,7 @@ class StateHandler:
|
|||||||
#
|
#
|
||||||
|
|
||||||
if not state_group_before_event:
|
if not state_group_before_event:
|
||||||
state_group_before_event = await self.state_store.store_state_group(
|
state_group_before_event = await self.state_storage.store_state_group(
|
||||||
event.event_id,
|
event.event_id,
|
||||||
event.room_id,
|
event.room_id,
|
||||||
prev_group=state_group_before_event_prev_group,
|
prev_group=state_group_before_event_prev_group,
|
||||||
@ -384,7 +384,7 @@ class StateHandler:
|
|||||||
state_ids_after_event[key] = event.event_id
|
state_ids_after_event[key] = event.event_id
|
||||||
delta_ids = {key: event.event_id}
|
delta_ids = {key: event.event_id}
|
||||||
|
|
||||||
state_group_after_event = await self.state_store.store_state_group(
|
state_group_after_event = await self.state_storage.store_state_group(
|
||||||
event.event_id,
|
event.event_id,
|
||||||
event.room_id,
|
event.room_id,
|
||||||
prev_group=state_group_before_event,
|
prev_group=state_group_before_event,
|
||||||
@ -418,7 +418,7 @@ class StateHandler:
|
|||||||
"""
|
"""
|
||||||
logger.debug("resolve_state_groups event_ids %s", event_ids)
|
logger.debug("resolve_state_groups event_ids %s", event_ids)
|
||||||
|
|
||||||
state_groups = await self.state_store.get_state_group_for_events(event_ids)
|
state_groups = await self.state_storage.get_state_group_for_events(event_ids)
|
||||||
|
|
||||||
state_group_ids = state_groups.values()
|
state_group_ids = state_groups.values()
|
||||||
|
|
||||||
@ -426,8 +426,8 @@ class StateHandler:
|
|||||||
state_group_ids_set = set(state_group_ids)
|
state_group_ids_set = set(state_group_ids)
|
||||||
if len(state_group_ids_set) == 1:
|
if len(state_group_ids_set) == 1:
|
||||||
(state_group_id,) = state_group_ids_set
|
(state_group_id,) = state_group_ids_set
|
||||||
state = await self.state_store.get_state_for_groups(state_group_ids_set)
|
state = await self.state_storage.get_state_for_groups(state_group_ids_set)
|
||||||
prev_group, delta_ids = await self.state_store.get_state_group_delta(
|
prev_group, delta_ids = await self.state_storage.get_state_group_delta(
|
||||||
state_group_id
|
state_group_id
|
||||||
)
|
)
|
||||||
return _StateCacheEntry(
|
return _StateCacheEntry(
|
||||||
@ -441,7 +441,7 @@ class StateHandler:
|
|||||||
|
|
||||||
room_version = await self.store.get_room_version_id(room_id)
|
room_version = await self.store.get_room_version_id(room_id)
|
||||||
|
|
||||||
state_to_resolve = await self.state_store.get_state_for_groups(
|
state_to_resolve = await self.state_storage.get_state_for_groups(
|
||||||
state_group_ids_set
|
state_group_ids_set
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class FederationTestCase(unittest.FederatingHomeserverTestCase):
|
|||||||
hs = self.setup_test_homeserver(federation_http_client=None)
|
hs = self.setup_test_homeserver(federation_http_client=None)
|
||||||
self.handler = hs.get_federation_handler()
|
self.handler = hs.get_federation_handler()
|
||||||
self.store = hs.get_datastores().main
|
self.store = hs.get_datastores().main
|
||||||
self.state_store = hs.get_storage().state
|
self.state_storage = hs.get_storage().state
|
||||||
self._event_auth_handler = hs.get_event_auth_handler()
|
self._event_auth_handler = hs.get_event_auth_handler()
|
||||||
return hs
|
return hs
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ class FederationTestCase(unittest.FederatingHomeserverTestCase):
|
|||||||
# mapping from (type, state_key) -> state_event_id
|
# mapping from (type, state_key) -> state_event_id
|
||||||
assert most_recent_prev_event_id is not None
|
assert most_recent_prev_event_id is not None
|
||||||
prev_state_map = self.get_success(
|
prev_state_map = self.get_success(
|
||||||
self.state_store.get_state_ids_for_event(most_recent_prev_event_id)
|
self.state_storage.get_state_ids_for_event(most_recent_prev_event_id)
|
||||||
)
|
)
|
||||||
# List of state event ID's
|
# List of state event ID's
|
||||||
prev_state_ids = list(prev_state_map.values())
|
prev_state_ids = list(prev_state_map.values())
|
||||||
|
Loading…
Reference in New Issue
Block a user