Skip to content

Commit 2bfaa20

Browse files
committed
Rename flag parameter
Emphasize that state deltas without an event ID are for deleted state.
1 parent 10d4540 commit 2bfaa20

2 files changed

Lines changed: 11 additions & 15 deletions

File tree

synapse/storage/controllers/state.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -658,15 +658,15 @@ async def get_current_state_deltas(
658658
self,
659659
prev_stream_id: int,
660660
max_stream_id: int,
661-
only_with_event_id: Literal[False] = False,
661+
exclude_deleted: Literal[False] = False,
662662
) -> Tuple[int, List[StateDelta]]: ...
663663

664664
@overload
665665
async def get_current_state_deltas(
666666
self,
667667
prev_stream_id: int,
668668
max_stream_id: int,
669-
only_with_event_id: Literal[True],
669+
exclude_deleted: Literal[True],
670670
) -> Tuple[int, List[StateDeltaWithEventId]]: ...
671671

672672
@trace
@@ -675,17 +675,15 @@ async def get_current_state_deltas(
675675
self,
676676
prev_stream_id: int,
677677
max_stream_id: int,
678-
only_with_event_id: bool = False,
678+
exclude_deleted: bool = False,
679679
) -> Tuple[int, Union[List[StateDelta], List[StateDeltaWithEventId]]]:
680680
"""Fetch a list of room state changes since the given stream id
681681
682682
Args:
683683
prev_stream_id: point to get changes since (exclusive)
684684
max_stream_id: the point that we know has been correctly persisted
685685
- ie, an upper limit to return changes from.
686-
only_with_event_id: whether to return only state deltas that have
687-
an associated event ID. (Deltas without an event ID represent
688-
deleted state.)
686+
exclude_deleted: whether to exclude deltas for deleted state.
689687
690688
Returns:
691689
A tuple consisting of:
@@ -697,7 +695,7 @@ async def get_current_state_deltas(
697695
# https://github.com/matrix-org/synapse/issues/13008
698696

699697
return await self.stores.main.get_partial_current_state_deltas(
700-
prev_stream_id, max_stream_id, only_with_event_id
698+
prev_stream_id, max_stream_id, exclude_deleted
701699
)
702700

703701
@trace

synapse/storage/databases/main/state_deltas.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,30 +73,30 @@ async def get_partial_current_state_deltas(
7373
self,
7474
prev_stream_id: int,
7575
max_stream_id: int,
76-
only_with_event_id: Literal[False] = False,
76+
exclude_deleted: Literal[False] = False,
7777
) -> Tuple[int, List[StateDelta]]: ...
7878

7979
@overload
8080
async def get_partial_current_state_deltas(
8181
self,
8282
prev_stream_id: int,
8383
max_stream_id: int,
84-
only_with_event_id: Literal[True],
84+
exclude_deleted: Literal[True],
8585
) -> Tuple[int, List[StateDeltaWithEventId]]: ...
8686

8787
@overload
8888
async def get_partial_current_state_deltas(
8989
self,
9090
prev_stream_id: int,
9191
max_stream_id: int,
92-
only_with_event_id: bool,
92+
exclude_deleted: bool,
9393
) -> Tuple[int, Union[List[StateDelta], List[StateDeltaWithEventId]]]: ...
9494

9595
async def get_partial_current_state_deltas(
9696
self,
9797
prev_stream_id: int,
9898
max_stream_id: int,
99-
only_with_event_id: bool = False,
99+
exclude_deleted: bool = False,
100100
) -> Tuple[int, Union[List[StateDelta], List[StateDeltaWithEventId]]]:
101101
"""Fetch a list of room state changes since the given stream id
102102
@@ -106,9 +106,7 @@ async def get_partial_current_state_deltas(
106106
prev_stream_id: point to get changes since (exclusive)
107107
max_stream_id: the point that we know has been correctly persisted
108108
- ie, an upper limit to return changes from.
109-
only_with_event_id: whether to return only state deltas that have
110-
an associated event ID. (Deltas without an event ID represent
111-
deleted state.)
109+
exclude_deleted: whether to exclude deltas for deleted state.
112110
113111
Returns:
114112
A tuple consisting of:
@@ -132,7 +130,7 @@ async def get_partial_current_state_deltas(
132130
return max_stream_id, []
133131

134132
StateDeltaType: Union[Type[StateDelta], Type[StateDeltaWithEventId]]
135-
if not only_with_event_id:
133+
if not exclude_deleted:
136134
StateDeltaType = StateDelta
137135
sql_and_event_id = ""
138136
else:

0 commit comments

Comments
 (0)