This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add helper base class for generating new replication endpoints #3632
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d81602b
Add helper base class for generating new replication endpoints
erikjohnston 729b672
Use new helper base class for ReplicationSendEventRestServlet
erikjohnston 443da00
Use new helper base class for membership requests
erikjohnston 16bd63f
Newsfile
erikjohnston cb298ff
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/re…
erikjohnston 051a99c
Fix isort
erikjohnston 5011417
Fixup logging and docstrings
erikjohnston bebe325
Rename POST param to METHOD
erikjohnston 6256479
Fixup wording and remove dead code
erikjohnston File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,7 +151,7 @@ def send_request(**kwargs): | |
if e.code != 504 or not cls.RETRY_ON_TIMEOUT: | ||
raise | ||
|
||
logger.warn("send_federation_events_to_master request timed out") | ||
logger.warn("%s request timed out", cls.NAME) | ||
|
||
# If we timed out we probably don't need to worry about backing | ||
# off too much, but lets just wait a little anyway. | ||
|
@@ -190,7 +190,9 @@ def register(self, http_server): | |
http_server.register_paths(method, [pattern], handler) | ||
|
||
def _cached_handler(self, request, txn_id, **kwargs): | ||
"""Wraps `_handle_request` the responses should be cached. | ||
"""Called on new incoming requests when caching is enabled. Checks | ||
if their is a cached response for the request and returns that, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. their |
||
otherwise calls `_handle_request` and caches its response. | ||
""" | ||
# We just use the txn_id here, but we probably also want to use the | ||
# other PATH_ARGS as well. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,16 @@ | |
|
||
class ReplicationRemoteJoinRestServlet(ReplicationEndpoint): | ||
"""Does a remote join for the given user to the given room | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please could you document the format of the URI - particularly since it seems to be changing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (ditto below) |
||
|
||
Request format: | ||
|
||
POST /_synapse/replication/remote_join/:room_id/:user_id | ||
|
||
{ | ||
"requester": ..., | ||
"remote_room_hosts": [...], | ||
"content": { ... } | ||
} | ||
""" | ||
|
||
NAME = "remote_join" | ||
|
@@ -85,6 +95,15 @@ def _handle_request(self, request, room_id, user_id): | |
|
||
class ReplicationRemoteRejectInviteRestServlet(ReplicationEndpoint): | ||
"""Rejects the invite for the user and room. | ||
|
||
Request format: | ||
|
||
POST /_synapse/replication/remote_reject_invite/:room_id/:user_id | ||
|
||
{ | ||
"requester": ..., | ||
"remote_room_hosts": [...], | ||
} | ||
""" | ||
|
||
NAME = "remote_reject_invite" | ||
|
@@ -153,6 +172,17 @@ def _handle_request(self, request, room_id, user_id): | |
|
||
class ReplicationRegister3PIDGuestRestServlet(ReplicationEndpoint): | ||
"""Gets/creates a guest account for given 3PID. | ||
|
||
Request format: | ||
|
||
POST /_synapse/replication/get_or_register_3pid_guest/ | ||
|
||
{ | ||
"requester": ..., | ||
"medium": ..., | ||
"address": ..., | ||
"inviter_user_id": ... | ||
} | ||
""" | ||
|
||
NAME = "get_or_register_3pid_guest" | ||
|
@@ -206,6 +236,12 @@ def _handle_request(self, request): | |
|
||
class ReplicationUserJoinedLeftRoomRestServlet(ReplicationEndpoint): | ||
"""Notifies that a user has joined or left the room | ||
|
||
Request format: | ||
|
||
POST /_synapse/replication/membership_change/:room_id/:user_id/:change | ||
|
||
{} | ||
""" | ||
|
||
NAME = "membership_change" | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there