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

Commit 47d53b3

Browse files
committed
Merge commit '17fa4c7ca' into anoa/dinsic_release_1_21_x
* commit '17fa4c7ca': Catch up after Federation Outage (split, 2): Track last successful stream ordering after transmission (#8247) Catch-up after Federation Outage (split, 1) (#8230) Fix type signature in simple_select_one_onecol and friends (#8241) Stop sub-classing object (#8249)
2 parents 581445c + 17fa4c7 commit 47d53b3

File tree

177 files changed

+658
-478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+658
-478
lines changed

changelog.d/8230.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Track the latest event for every destination and room for catch-up after federation outage.

changelog.d/8241.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add type hints to `synapse.storage.database`.

changelog.d/8247.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Track the `stream_ordering` of the last successfully-sent event to every destination, so we can use this information to 'catch up' a remote server after an outage.

changelog.d/8249.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Stop sub-classing from object.

contrib/cmdclient/http.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from twisted.web.http_headers import Headers
2525

2626

27-
class HttpClient(object):
27+
class HttpClient:
2828
""" Interface for talking json over http
2929
"""
3030

@@ -169,7 +169,7 @@ def sleep(self, seconds):
169169
return d
170170

171171

172-
class _RawProducer(object):
172+
class _RawProducer:
173173
def __init__(self, data):
174174
self.data = data
175175
self.body = data
@@ -186,7 +186,7 @@ def stopProducing(self):
186186
pass
187187

188188

189-
class _JsonProducer(object):
189+
class _JsonProducer:
190190
""" Used by the twisted http client to create the HTTP body from json
191191
"""
192192

contrib/experiments/cursesio.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def close(self):
141141
curses.endwin()
142142

143143

144-
class Callback(object):
144+
class Callback:
145145
def __init__(self, stdio):
146146
self.stdio = stdio
147147

contrib/experiments/test_messaging.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def excpetion_errback(failure):
5555
logging.exception(failure)
5656

5757

58-
class InputOutput(object):
58+
class InputOutput:
5959
""" This is responsible for basic I/O so that a user can interact with
6060
the example app.
6161
"""
@@ -132,7 +132,7 @@ def emit(self, record):
132132
self.io.print_log(msg)
133133

134134

135-
class Room(object):
135+
class Room:
136136
""" Used to store (in memory) the current membership state of a room, and
137137
which home servers we should send PDUs associated with the room to.
138138
"""

scripts-dev/hash_history.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from synapse.storage.signatures import SignatureStore
1616

1717

18-
class Store(object):
18+
class Store:
1919
_get_pdu_tuples = PduStore.__dict__["_get_pdu_tuples"]
2020
_get_pdu_content_hashes_txn = SignatureStore.__dict__["_get_pdu_content_hashes_txn"]
2121
_get_prev_pdu_hashes_txn = SignatureStore.__dict__["_get_prev_pdu_hashes_txn"]

synapse/api/auth.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class _InvalidMacaroonException(Exception):
5858
pass
5959

6060

61-
class Auth(object):
61+
class Auth:
6262
"""
6363
FIXME: This class contains a mix of functions for authenticating users
6464
of our client-server API and authenticating events added to room graphs.

synapse/api/auth_blocking.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
logger = logging.getLogger(__name__)
2323

2424

25-
class AuthBlocking(object):
25+
class AuthBlocking:
2626
def __init__(self, hs):
2727
self.store = hs.get_datastore()
2828

synapse/api/constants.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
MAX_USERID_LENGTH = 255
2929

3030

31-
class Membership(object):
31+
class Membership:
3232

3333
"""Represents the membership states of a user in a room."""
3434

@@ -40,22 +40,22 @@ class Membership(object):
4040
LIST = (INVITE, JOIN, KNOCK, LEAVE, BAN)
4141

4242

43-
class PresenceState(object):
43+
class PresenceState:
4444
"""Represents the presence state of a user."""
4545

4646
OFFLINE = "offline"
4747
UNAVAILABLE = "unavailable"
4848
ONLINE = "online"
4949

5050

51-
class JoinRules(object):
51+
class JoinRules:
5252
PUBLIC = "public"
5353
KNOCK = "knock"
5454
INVITE = "invite"
5555
PRIVATE = "private"
5656

5757

58-
class LoginType(object):
58+
class LoginType:
5959
PASSWORD = "m.login.password"
6060
EMAIL_IDENTITY = "m.login.email.identity"
6161
MSISDN = "m.login.msisdn"
@@ -65,7 +65,7 @@ class LoginType(object):
6565
DUMMY = "m.login.dummy"
6666

6767

68-
class EventTypes(object):
68+
class EventTypes:
6969
Member = "m.room.member"
7070
Create = "m.room.create"
7171
Tombstone = "m.room.tombstone"
@@ -96,17 +96,17 @@ class EventTypes(object):
9696
Presence = "m.presence"
9797

9898

99-
class RejectedReason(object):
99+
class RejectedReason:
100100
AUTH_ERROR = "auth_error"
101101

102102

103-
class RoomCreationPreset(object):
103+
class RoomCreationPreset:
104104
PRIVATE_CHAT = "private_chat"
105105
PUBLIC_CHAT = "public_chat"
106106
TRUSTED_PRIVATE_CHAT = "trusted_private_chat"
107107

108108

109-
class ThirdPartyEntityKind(object):
109+
class ThirdPartyEntityKind:
110110
USER = "user"
111111
LOCATION = "location"
112112

@@ -115,7 +115,7 @@ class ThirdPartyEntityKind(object):
115115
ServerNoticeLimitReached = "m.server_notice.usage_limit_reached"
116116

117117

118-
class UserTypes(object):
118+
class UserTypes:
119119
"""Allows for user type specific behaviour. With the benefit of hindsight
120120
'admin' and 'guest' users should also be UserTypes. Normal users are type None
121121
"""
@@ -125,7 +125,7 @@ class UserTypes(object):
125125
ALL_USER_TYPES = (SUPPORT, BOT)
126126

127127

128-
class RelationTypes(object):
128+
class RelationTypes:
129129
"""The types of relations known to this server.
130130
"""
131131

@@ -134,14 +134,14 @@ class RelationTypes(object):
134134
REFERENCE = "m.reference"
135135

136136

137-
class LimitBlockingTypes(object):
137+
class LimitBlockingTypes:
138138
"""Reasons that a server may be blocked"""
139139

140140
MONTHLY_ACTIVE_USER = "monthly_active_user"
141141
HS_DISABLED = "hs_disabled"
142142

143143

144-
class EventContentFields(object):
144+
class EventContentFields:
145145
"""Fields found in events' content, regardless of type."""
146146

147147
# Labels for the event, cf https://github.com/matrix-org/matrix-doc/pull/2326
@@ -152,6 +152,6 @@ class EventContentFields(object):
152152
SELF_DESTRUCT_AFTER = "org.matrix.self_destruct_after"
153153

154154

155-
class RoomEncryptionAlgorithms(object):
155+
class RoomEncryptionAlgorithms:
156156
MEGOLM_V1_AES_SHA2 = "m.megolm.v1.aes-sha2"
157157
DEFAULT = MEGOLM_V1_AES_SHA2

synapse/api/errors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
logger = logging.getLogger(__name__)
3333

3434

35-
class Codes(object):
35+
class Codes:
3636
UNRECOGNIZED = "M_UNRECOGNIZED"
3737
UNAUTHORIZED = "M_UNAUTHORIZED"
3838
FORBIDDEN = "M_FORBIDDEN"

synapse/api/filtering.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def matrix_user_id_validator(user_id_str):
130130
return UserID.from_string(user_id_str)
131131

132132

133-
class Filtering(object):
133+
class Filtering:
134134
def __init__(self, hs):
135135
super(Filtering, self).__init__()
136136
self.store = hs.get_datastore()
@@ -168,7 +168,7 @@ def check_valid_filter(self, user_filter_json):
168168
raise SynapseError(400, str(e))
169169

170170

171-
class FilterCollection(object):
171+
class FilterCollection:
172172
def __init__(self, filter_json):
173173
self._filter_json = filter_json
174174

@@ -249,7 +249,7 @@ def blocks_all_room_timeline(self):
249249
)
250250

251251

252-
class Filter(object):
252+
class Filter:
253253
def __init__(self, filter_json):
254254
self.filter_json = filter_json
255255

synapse/api/ratelimiting.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from synapse.util import Clock
2222

2323

24-
class Ratelimiter(object):
24+
class Ratelimiter:
2525
"""
2626
Ratelimit actions marked by arbitrary keys.
2727

synapse/api/room_versions.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import attr
1919

2020

21-
class EventFormatVersions(object):
21+
class EventFormatVersions:
2222
"""This is an internal enum for tracking the version of the event format,
2323
independently from the room version.
2424
"""
@@ -35,20 +35,20 @@ class EventFormatVersions(object):
3535
}
3636

3737

38-
class StateResolutionVersions(object):
38+
class StateResolutionVersions:
3939
"""Enum to identify the state resolution algorithms"""
4040

4141
V1 = 1 # room v1 state res
4242
V2 = 2 # MSC1442 state res: room v2 and later
4343

4444

45-
class RoomDisposition(object):
45+
class RoomDisposition:
4646
STABLE = "stable"
4747
UNSTABLE = "unstable"
4848

4949

5050
@attr.s(slots=True, frozen=True)
51-
class RoomVersion(object):
51+
class RoomVersion:
5252
"""An object which describes the unique attributes of a room version."""
5353

5454
identifier = attr.ib() # str; the identifier for this version
@@ -69,7 +69,7 @@ class RoomVersion(object):
6969
limit_notifications_power_levels = attr.ib(type=bool)
7070

7171

72-
class RoomVersions(object):
72+
class RoomVersions:
7373
V1 = RoomVersion(
7474
"1",
7575
RoomDisposition.STABLE,

synapse/api/urls.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
LEGACY_MEDIA_PREFIX = "/_matrix/media/v1"
3434

3535

36-
class ConsentURIBuilder(object):
36+
class ConsentURIBuilder:
3737
def __init__(self, hs_config):
3838
"""
3939
Args:

synapse/app/_base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def install_dns_limiter(reactor, max_dns_requests_in_flight=100):
349349
reactor.installNameResolver(new_resolver)
350350

351351

352-
class _LimitedHostnameResolver(object):
352+
class _LimitedHostnameResolver:
353353
"""Wraps a IHostnameResolver, limiting the number of in-flight DNS lookups.
354354
"""
355355

@@ -409,7 +409,7 @@ def _resolve(
409409
yield deferred
410410

411411

412-
class _DeferredResolutionReceiver(object):
412+
class _DeferredResolutionReceiver:
413413
"""Wraps a IResolutionReceiver and simply resolves the given deferred when
414414
resolution is complete
415415
"""

synapse/app/generic_worker.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ def on_remote_server_up(self, server: str):
745745
self.send_handler.wake_destination(server)
746746

747747

748-
class FederationSenderHandler(object):
748+
class FederationSenderHandler:
749749
"""Processes the fedration replication stream
750750
751751
This class is only instantiate on the worker responsible for sending outbound

synapse/appservice/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
logger = logging.getLogger(__name__)
2828

2929

30-
class ApplicationServiceState(object):
30+
class ApplicationServiceState:
3131
DOWN = "down"
3232
UP = "up"
3333

3434

35-
class AppServiceTransaction(object):
35+
class AppServiceTransaction:
3636
"""Represents an application service transaction."""
3737

3838
def __init__(self, service, id, events):
@@ -64,7 +64,7 @@ async def complete(self, store: "DataStore") -> None:
6464
await store.complete_appservice_txn(service=self.service, txn_id=self.id)
6565

6666

67-
class ApplicationService(object):
67+
class ApplicationService:
6868
"""Defines an application service. This definition is mostly what is
6969
provided to the /register AS API.
7070

synapse/appservice/scheduler.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
logger = logging.getLogger(__name__)
5858

5959

60-
class ApplicationServiceScheduler(object):
60+
class ApplicationServiceScheduler:
6161
""" Public facing API for this module. Does the required DI to tie the
6262
components together. This also serves as the "event_pool", which in this
6363
case is a simple array.
@@ -86,7 +86,7 @@ def submit_event_for_as(self, service, event):
8686
self.queuer.enqueue(service, event)
8787

8888

89-
class _ServiceQueuer(object):
89+
class _ServiceQueuer:
9090
"""Queue of events waiting to be sent to appservices.
9191
9292
Groups events into transactions per-appservice, and sends them on to the
@@ -133,7 +133,7 @@ async def _send_request(self, service):
133133
self.requests_in_flight.discard(service.id)
134134

135135

136-
class _TransactionController(object):
136+
class _TransactionController:
137137
"""Transaction manager.
138138
139139
Builds AppServiceTransactions and runs their lifecycle. Also starts a Recoverer
@@ -209,7 +209,7 @@ async def _is_service_up(self, service):
209209
return state == ApplicationServiceState.UP or state is None
210210

211211

212-
class _Recoverer(object):
212+
class _Recoverer:
213213
"""Manages retries and backoff for a DOWN appservice.
214214
215215
We have one of these for each appservice which is currently considered DOWN.

synapse/config/_base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def path_exists(file_path):
8989
return False
9090

9191

92-
class Config(object):
92+
class Config:
9393
"""
9494
A configuration section, containing configuration keys and values.
9595
@@ -284,7 +284,7 @@ def mxc_to_http_filter(value, width, height, resize_method="crop"):
284284
return mxc_to_http_filter
285285

286286

287-
class RootConfig(object):
287+
class RootConfig:
288288
"""
289289
Holder of an application's configuration.
290290

0 commit comments

Comments
 (0)