mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 10:56:06 -04:00
Get current state by using current_state_events table
This commit is contained in:
parent
3872c7a107
commit
8ffbe43ba1
5 changed files with 52 additions and 31 deletions
|
@ -14,7 +14,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
from ._base import SQLBaseStore
|
||||
from synapse.util.caches.descriptors import cached, cachedList
|
||||
from synapse.util.caches.descriptors import cached, cachedList, cachedInlineCallbacks
|
||||
from synapse.util.caches import intern_string
|
||||
from synapse.storage.engines import PostgresEngine
|
||||
|
||||
|
@ -69,6 +69,18 @@ class StateStore(SQLBaseStore):
|
|||
where_clause="type='m.room.member'",
|
||||
)
|
||||
|
||||
@cachedInlineCallbacks(max_entries=100000, iterable=True)
|
||||
def get_current_state_ids(self, room_id):
|
||||
rows = yield self._simple_select_list(
|
||||
table="current_state_events",
|
||||
keyvalues={"room_id": room_id},
|
||||
retcols=["event_id", "type", "state_key"],
|
||||
desc="_calculate_state_delta",
|
||||
)
|
||||
defer.returnValue({
|
||||
(r["type"], r["state_key"]): r["event_id"] for r in rows
|
||||
})
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def get_state_groups_ids(self, room_id, event_ids):
|
||||
if not event_ids:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue