mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-08-04 00:44:10 -04:00
Rename database classes to make some sense (#8033)
This commit is contained in:
parent
0a86850ba3
commit
a7bdf98d01
337 changed files with 1408 additions and 1323 deletions
|
@ -15,7 +15,7 @@
|
|||
|
||||
from synapse.rest import admin
|
||||
from synapse.rest.client.v1 import login, room
|
||||
from synapse.storage.data_stores.main import stats
|
||||
from synapse.storage.databases.main import stats
|
||||
|
||||
from tests import unittest
|
||||
|
||||
|
@ -42,16 +42,16 @@ class StatsRoomTests(unittest.HomeserverTestCase):
|
|||
Add the background updates we need to run.
|
||||
"""
|
||||
# Ugh, have to reset this flag
|
||||
self.store.db.updates._all_done = False
|
||||
self.store.db_pool.updates._all_done = False
|
||||
|
||||
self.get_success(
|
||||
self.store.db.simple_insert(
|
||||
self.store.db_pool.simple_insert(
|
||||
"background_updates",
|
||||
{"update_name": "populate_stats_prepare", "progress_json": "{}"},
|
||||
)
|
||||
)
|
||||
self.get_success(
|
||||
self.store.db.simple_insert(
|
||||
self.store.db_pool.simple_insert(
|
||||
"background_updates",
|
||||
{
|
||||
"update_name": "populate_stats_process_rooms_2",
|
||||
|
@ -61,7 +61,7 @@ class StatsRoomTests(unittest.HomeserverTestCase):
|
|||
)
|
||||
)
|
||||
self.get_success(
|
||||
self.store.db.simple_insert(
|
||||
self.store.db_pool.simple_insert(
|
||||
"background_updates",
|
||||
{
|
||||
"update_name": "populate_stats_process_users",
|
||||
|
@ -71,7 +71,7 @@ class StatsRoomTests(unittest.HomeserverTestCase):
|
|||
)
|
||||
)
|
||||
self.get_success(
|
||||
self.store.db.simple_insert(
|
||||
self.store.db_pool.simple_insert(
|
||||
"background_updates",
|
||||
{
|
||||
"update_name": "populate_stats_cleanup",
|
||||
|
@ -82,7 +82,7 @@ class StatsRoomTests(unittest.HomeserverTestCase):
|
|||
)
|
||||
|
||||
def get_all_room_state(self):
|
||||
return self.store.db.simple_select_list(
|
||||
return self.store.db_pool.simple_select_list(
|
||||
"room_stats_state", None, retcols=("name", "topic", "canonical_alias")
|
||||
)
|
||||
|
||||
|
@ -96,7 +96,7 @@ class StatsRoomTests(unittest.HomeserverTestCase):
|
|||
end_ts = self.store.quantise_stats_time(self.reactor.seconds() * 1000)
|
||||
|
||||
return self.get_success(
|
||||
self.store.db.simple_select_one(
|
||||
self.store.db_pool.simple_select_one(
|
||||
table + "_historical",
|
||||
{id_col: stat_id, end_ts: end_ts},
|
||||
cols,
|
||||
|
@ -109,10 +109,10 @@ class StatsRoomTests(unittest.HomeserverTestCase):
|
|||
self._add_background_updates()
|
||||
|
||||
while not self.get_success(
|
||||
self.store.db.updates.has_completed_background_updates()
|
||||
self.store.db_pool.updates.has_completed_background_updates()
|
||||
):
|
||||
self.get_success(
|
||||
self.store.db.updates.do_next_background_update(100), by=0.1
|
||||
self.store.db_pool.updates.do_next_background_update(100), by=0.1
|
||||
)
|
||||
|
||||
def test_initial_room(self):
|
||||
|
@ -146,10 +146,10 @@ class StatsRoomTests(unittest.HomeserverTestCase):
|
|||
self._add_background_updates()
|
||||
|
||||
while not self.get_success(
|
||||
self.store.db.updates.has_completed_background_updates()
|
||||
self.store.db_pool.updates.has_completed_background_updates()
|
||||
):
|
||||
self.get_success(
|
||||
self.store.db.updates.do_next_background_update(100), by=0.1
|
||||
self.store.db_pool.updates.do_next_background_update(100), by=0.1
|
||||
)
|
||||
|
||||
r = self.get_success(self.get_all_room_state())
|
||||
|
@ -186,9 +186,9 @@ class StatsRoomTests(unittest.HomeserverTestCase):
|
|||
# the position that the deltas should begin at, once they take over.
|
||||
self.hs.config.stats_enabled = True
|
||||
self.handler.stats_enabled = True
|
||||
self.store.db.updates._all_done = False
|
||||
self.store.db_pool.updates._all_done = False
|
||||
self.get_success(
|
||||
self.store.db.simple_update_one(
|
||||
self.store.db_pool.simple_update_one(
|
||||
table="stats_incremental_position",
|
||||
keyvalues={},
|
||||
updatevalues={"stream_id": 0},
|
||||
|
@ -196,17 +196,17 @@ class StatsRoomTests(unittest.HomeserverTestCase):
|
|||
)
|
||||
|
||||
self.get_success(
|
||||
self.store.db.simple_insert(
|
||||
self.store.db_pool.simple_insert(
|
||||
"background_updates",
|
||||
{"update_name": "populate_stats_prepare", "progress_json": "{}"},
|
||||
)
|
||||
)
|
||||
|
||||
while not self.get_success(
|
||||
self.store.db.updates.has_completed_background_updates()
|
||||
self.store.db_pool.updates.has_completed_background_updates()
|
||||
):
|
||||
self.get_success(
|
||||
self.store.db.updates.do_next_background_update(100), by=0.1
|
||||
self.store.db_pool.updates.do_next_background_update(100), by=0.1
|
||||
)
|
||||
|
||||
# Now, before the table is actually ingested, add some more events.
|
||||
|
@ -217,7 +217,7 @@ class StatsRoomTests(unittest.HomeserverTestCase):
|
|||
|
||||
# Now do the initial ingestion.
|
||||
self.get_success(
|
||||
self.store.db.simple_insert(
|
||||
self.store.db_pool.simple_insert(
|
||||
"background_updates",
|
||||
{
|
||||
"update_name": "populate_stats_process_rooms_2",
|
||||
|
@ -226,7 +226,7 @@ class StatsRoomTests(unittest.HomeserverTestCase):
|
|||
)
|
||||
)
|
||||
self.get_success(
|
||||
self.store.db.simple_insert(
|
||||
self.store.db_pool.simple_insert(
|
||||
"background_updates",
|
||||
{
|
||||
"update_name": "populate_stats_cleanup",
|
||||
|
@ -236,12 +236,12 @@ class StatsRoomTests(unittest.HomeserverTestCase):
|
|||
)
|
||||
)
|
||||
|
||||
self.store.db.updates._all_done = False
|
||||
self.store.db_pool.updates._all_done = False
|
||||
while not self.get_success(
|
||||
self.store.db.updates.has_completed_background_updates()
|
||||
self.store.db_pool.updates.has_completed_background_updates()
|
||||
):
|
||||
self.get_success(
|
||||
self.store.db.updates.do_next_background_update(100), by=0.1
|
||||
self.store.db_pool.updates.do_next_background_update(100), by=0.1
|
||||
)
|
||||
|
||||
self.reactor.advance(86401)
|
||||
|
@ -703,15 +703,15 @@ class StatsRoomTests(unittest.HomeserverTestCase):
|
|||
|
||||
# preparation stage of the initial background update
|
||||
# Ugh, have to reset this flag
|
||||
self.store.db.updates._all_done = False
|
||||
self.store.db_pool.updates._all_done = False
|
||||
|
||||
self.get_success(
|
||||
self.store.db.simple_delete(
|
||||
self.store.db_pool.simple_delete(
|
||||
"room_stats_current", {"1": 1}, "test_delete_stats"
|
||||
)
|
||||
)
|
||||
self.get_success(
|
||||
self.store.db.simple_delete(
|
||||
self.store.db_pool.simple_delete(
|
||||
"user_stats_current", {"1": 1}, "test_delete_stats"
|
||||
)
|
||||
)
|
||||
|
@ -723,9 +723,9 @@ class StatsRoomTests(unittest.HomeserverTestCase):
|
|||
|
||||
# now do the background updates
|
||||
|
||||
self.store.db.updates._all_done = False
|
||||
self.store.db_pool.updates._all_done = False
|
||||
self.get_success(
|
||||
self.store.db.simple_insert(
|
||||
self.store.db_pool.simple_insert(
|
||||
"background_updates",
|
||||
{
|
||||
"update_name": "populate_stats_process_rooms_2",
|
||||
|
@ -735,7 +735,7 @@ class StatsRoomTests(unittest.HomeserverTestCase):
|
|||
)
|
||||
)
|
||||
self.get_success(
|
||||
self.store.db.simple_insert(
|
||||
self.store.db_pool.simple_insert(
|
||||
"background_updates",
|
||||
{
|
||||
"update_name": "populate_stats_process_users",
|
||||
|
@ -745,7 +745,7 @@ class StatsRoomTests(unittest.HomeserverTestCase):
|
|||
)
|
||||
)
|
||||
self.get_success(
|
||||
self.store.db.simple_insert(
|
||||
self.store.db_pool.simple_insert(
|
||||
"background_updates",
|
||||
{
|
||||
"update_name": "populate_stats_cleanup",
|
||||
|
@ -756,10 +756,10 @@ class StatsRoomTests(unittest.HomeserverTestCase):
|
|||
)
|
||||
|
||||
while not self.get_success(
|
||||
self.store.db.updates.has_completed_background_updates()
|
||||
self.store.db_pool.updates.has_completed_background_updates()
|
||||
):
|
||||
self.get_success(
|
||||
self.store.db.updates.do_next_background_update(100), by=0.1
|
||||
self.store.db_pool.updates.do_next_background_update(100), by=0.1
|
||||
)
|
||||
|
||||
r1stats_complete = self._get_current_stats("room", r1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue