From 1fdf2cf8e84769c5e15ca8bb53fe61e5507365d7 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Wed, 8 Sep 2021 11:02:31 -0400 Subject: [PATCH] Document that /spaces & /hierarchy can be routed to workers. (#10648) Also refactors some of the registration of endpoints on workers. --- changelog.d/10648.doc | 1 + docs/upgrade.md | 10 +++++++- docs/workers.md | 5 ++++ synapse/app/generic_worker.py | 44 +++++++++++++++-------------------- 4 files changed, 34 insertions(+), 26 deletions(-) create mode 100644 changelog.d/10648.doc diff --git a/changelog.d/10648.doc b/changelog.d/10648.doc new file mode 100644 index 000000000..4bd8df523 --- /dev/null +++ b/changelog.d/10648.doc @@ -0,0 +1 @@ +Update the documentation to note that the `/spaces` and `/hierarchy` endpoints can be routed to workers. diff --git a/docs/upgrade.md b/docs/upgrade.md index 453dbbabe..f9b832cb3 100644 --- a/docs/upgrade.md +++ b/docs/upgrade.md @@ -85,6 +85,15 @@ process, for example: dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb ``` +# Upgrading to v1.43.0 + +## The spaces summary APIs can now be handled by workers + +The [available worker applications documentation](https://matrix-org.github.io/synapse/latest/workers.html#available-worker-applications) +has been updated to reflect that calls to the `/spaces`, `/hierarchy`, and +`/summary` endpoints can now be routed to workers for both client API and +federation requests. + # Upgrading to v1.42.0 ## Removal of old Room Admin API @@ -112,7 +121,6 @@ process failed. See the default templates linked above for an example. Users will stop receiving message updates via email for addresses that were once, but not still, linked to their account. - # Upgrading to v1.41.0 ## Add support for routing outbound HTTP requests via a proxy for federation diff --git a/docs/workers.md b/docs/workers.md index 312124189..f1673d67d 100644 --- a/docs/workers.md +++ b/docs/workers.md @@ -209,6 +209,8 @@ expressions: ^/_matrix/federation/v1/user/devices/ ^/_matrix/federation/v1/get_groups_publicised$ ^/_matrix/key/v2/query + ^/_matrix/federation/unstable/org.matrix.msc2946/spaces/ + ^/_matrix/federation/unstable/org.matrix.msc2946/hierarchy/ # Inbound federation transaction request ^/_matrix/federation/v1/send/ @@ -220,6 +222,9 @@ expressions: ^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/context/.*$ ^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/members$ ^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/state$ + ^/_matrix/client/unstable/org.matrix.msc2946/rooms/.*/spaces$ + ^/_matrix/client/unstable/org.matrix.msc2946/rooms/.*/hierarchy$ + ^/_matrix/client/unstable/im.nheko.summary/rooms/.*/summary$ ^/_matrix/client/(api/v1|r0|unstable)/account/3pid$ ^/_matrix/client/(api/v1|r0|unstable)/devices$ ^/_matrix/client/(api/v1|r0|unstable)/keys/query$ diff --git a/synapse/app/generic_worker.py b/synapse/app/generic_worker.py index 2eb8d5a79..7d2cd6a90 100644 --- a/synapse/app/generic_worker.py +++ b/synapse/app/generic_worker.py @@ -69,39 +69,34 @@ from synapse.rest.client import ( account_data, events, groups, + initial_sync, login, presence, + profile, + push_rule, read_marker, receipts, room, room_keys, + sendtodevice, sync, tags, user_directory, + versions, + voip, ) from synapse.rest.client._base import client_patterns from synapse.rest.client.account import ThreepidRestServlet -from synapse.rest.client.account_data import AccountDataServlet, RoomAccountDataServlet from synapse.rest.client.devices import DevicesRestServlet -from synapse.rest.client.initial_sync import InitialSyncRestServlet from synapse.rest.client.keys import ( KeyChangesServlet, KeyQueryServlet, OneTimeKeyServlet, ) -from synapse.rest.client.profile import ( - ProfileAvatarURLRestServlet, - ProfileDisplaynameRestServlet, - ProfileRestServlet, -) -from synapse.rest.client.push_rule import PushRuleRestServlet from synapse.rest.client.register import ( RegisterRestServlet, RegistrationTokenValidityRestServlet, ) -from synapse.rest.client.sendtodevice import SendToDeviceRestServlet -from synapse.rest.client.versions import VersionsRestServlet -from synapse.rest.client.voip import VoipRestServlet from synapse.rest.health import HealthResource from synapse.rest.key.v2 import KeyApiV2Resource from synapse.rest.synapse.client import build_synapse_client_resource_tree @@ -288,32 +283,31 @@ class GenericWorkerServer(HomeServer): login.register_servlets(self, resource) ThreepidRestServlet(self).register(resource) DevicesRestServlet(self).register(resource) - KeyQueryServlet(self).register(resource) - OneTimeKeyServlet(self).register(resource) - KeyChangesServlet(self).register(resource) - VoipRestServlet(self).register(resource) - PushRuleRestServlet(self).register(resource) - VersionsRestServlet(self).register(resource) - ProfileAvatarURLRestServlet(self).register(resource) - ProfileDisplaynameRestServlet(self).register(resource) - ProfileRestServlet(self).register(resource) + # Read-only KeyUploadServlet(self).register(resource) - AccountDataServlet(self).register(resource) - RoomAccountDataServlet(self).register(resource) + KeyQueryServlet(self).register(resource) + KeyChangesServlet(self).register(resource) + OneTimeKeyServlet(self).register(resource) + + voip.register_servlets(self, resource) + push_rule.register_servlets(self, resource) + versions.register_servlets(self, resource) + + profile.register_servlets(self, resource) sync.register_servlets(self, resource) events.register_servlets(self, resource) - room.register_servlets(self, resource, True) + room.register_servlets(self, resource, is_worker=True) room.register_deprecated_servlets(self, resource) - InitialSyncRestServlet(self).register(resource) + initial_sync.register_servlets(self, resource) room_keys.register_servlets(self, resource) tags.register_servlets(self, resource) account_data.register_servlets(self, resource) receipts.register_servlets(self, resource) read_marker.register_servlets(self, resource) - SendToDeviceRestServlet(self).register(resource) + sendtodevice.register_servlets(self, resource) user_directory.register_servlets(self, resource)