You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

61 lines
1.9 KiB

  1. # Copyright 2018 New Vector Ltd
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. from typing import TYPE_CHECKING
  15. from synapse.http.server import JsonResource
  16. from synapse.replication.http import (
  17. account_data,
  18. devices,
  19. federation,
  20. login,
  21. membership,
  22. presence,
  23. push,
  24. register,
  25. send_event,
  26. send_events,
  27. state,
  28. streams,
  29. )
  30. if TYPE_CHECKING:
  31. from synapse.server import HomeServer
  32. REPLICATION_PREFIX = "/_synapse/replication"
  33. class ReplicationRestResource(JsonResource):
  34. def __init__(self, hs: "HomeServer"):
  35. # We enable extracting jaeger contexts here as these are internal APIs.
  36. super().__init__(hs, canonical_json=False, extract_context=True)
  37. self.register_servlets(hs)
  38. def register_servlets(self, hs: "HomeServer") -> None:
  39. send_event.register_servlets(hs, self)
  40. send_events.register_servlets(hs, self)
  41. federation.register_servlets(hs, self)
  42. presence.register_servlets(hs, self)
  43. membership.register_servlets(hs, self)
  44. streams.register_servlets(hs, self)
  45. account_data.register_servlets(hs, self)
  46. push.register_servlets(hs, self)
  47. state.register_servlets(hs, self)
  48. # The following can't currently be instantiated on workers.
  49. if hs.config.worker.worker_app is None:
  50. login.register_servlets(hs, self)
  51. register.register_servlets(hs, self)
  52. devices.register_servlets(hs, self)