Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Split purge API into events vs state and add PurgeEventsStorage #6295

Merged
merged 14 commits into from
Nov 8, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/6295.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Split out state storage into separate data store.
7 changes: 5 additions & 2 deletions synapse/handlers/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def __init__(self, hs):
self.hs = hs
self.auth = hs.get_auth()
self.store = hs.get_datastore()
self.storage = hs.get_storage()
self.clock = hs.get_clock()
self._server_name = hs.hostname

Expand Down Expand Up @@ -125,7 +126,9 @@ def _purge_history(self, purge_id, room_id, token, delete_local_events):
self._purges_in_progress_by_room.add(room_id)
try:
with (yield self.pagination_lock.write(room_id)):
yield self.store.purge_history(room_id, token, delete_local_events)
yield self.storage.purge_events.purge_history(
room_id, token, delete_local_events
)
logger.info("[purge] complete")
self._purges_by_id[purge_id].status = PurgeStatus.STATUS_COMPLETE
except Exception:
Expand Down Expand Up @@ -168,7 +171,7 @@ async def purge_room(self, room_id):
if joined:
raise SynapseError(400, "Users are still joined to this room")

await self.store.purge_room(room_id)
await self.storage.purge_events.purge_room(room_id)

@defer.inlineCallbacks
def get_messages(
Expand Down
2 changes: 2 additions & 0 deletions synapse/storage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from synapse.storage.data_stores import DataStores
from synapse.storage.data_stores.main import DataStore
from synapse.storage.persist_events import EventsPersistenceStorage
from synapse.storage.purge_events import PurgeEventsStorage

__all__ = ["DataStores", "DataStore"]

Expand All @@ -45,6 +46,7 @@ def __init__(self, hs, stores: DataStores):
self.main = stores.main

self.persistence = EventsPersistenceStorage(hs, stores)
self.purge_events = PurgeEventsStorage(hs, stores)


def are_all_users_on_domain(txn, database_engine, domain):
Expand Down
Loading