mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-06 14:04:59 -04:00
Split purge API into events vs state
This commit is contained in:
parent
b7fe62b766
commit
7c8c97e635
6 changed files with 308 additions and 184 deletions
|
@ -989,6 +989,29 @@ class StateGroupWorkerStore(
|
|||
|
||||
return self.runInteraction("store_state_group", _store_state_group_txn)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def get_referenced_state_groups(self, state_groups):
|
||||
"""Check if the state groups are referenced by events.
|
||||
|
||||
Args:
|
||||
state_groups (Iterable[int])
|
||||
|
||||
Returns:
|
||||
Deferred[set[int]]: The subset of state groups that are
|
||||
referenced.
|
||||
"""
|
||||
|
||||
rows = yield self._simple_select_many_batch(
|
||||
table="event_to_state_groups",
|
||||
column="state_group",
|
||||
iterable=state_groups,
|
||||
keyvalues={},
|
||||
retcols=("DISTINCT state_group",),
|
||||
desc="get_referenced_state_groups",
|
||||
)
|
||||
|
||||
return set(row["state_group"] for row in rows)
|
||||
|
||||
|
||||
class StateBackgroundUpdateStore(
|
||||
StateGroupBackgroundUpdateStore, BackgroundUpdateStore
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue