synapse.server module¶
-
class
synapse.server.
HomeServer
(hostname: str, config: synapse.config.homeserver.HomeServerConfig, reactor=None, **kwargs)¶ Bases:
object
A basic homeserver object without lazy component builders.
This will need all of the components it requires to either be passed as constructor arguments, or the relevant methods overriding to create them. Typically this would only be used for unit tests.
For every dependency in the DEPENDENCIES list below, this class creates one method,
def get_DEPENDENCY(self)
which returns the value of that dependency. If no value has yet been set nor was provided to the constructor, it will attempt to call a lazy builder method called
def build_DEPENDENCY(self)
which must be implemented by the subclass. This code may call any of the required “get” methods on the instance to obtain the sub-dependencies that one requires.
- Variables
config (synapse.config.homeserver.HomeserverConfig) –
_listening_services (list[twisted.internet.tcp.Port]) – TCP ports that we are listening on to provide HTTP services.
-
abstract property
DATASTORE_CLASS
¶ A decorator indicating abstract properties.
Requires that the metaclass is ABCMeta or derived from it. A class that has a metaclass derived from ABCMeta cannot be instantiated unless all of its abstract properties are overridden. The abstract properties can be called using any of the normal ‘super’ call mechanisms.
Usage:
- class C(metaclass=ABCMeta):
@abstractproperty def my_abstract_property(self):
…
This defines a read-only property; you can also define a read-write abstract property using the ‘long’ form of property declaration:
- class C(metaclass=ABCMeta):
def getx(self): … def setx(self, value): … x = abstractproperty(getx, setx)
‘abstractproperty’ is deprecated. Use ‘property’ with ‘abstractmethod’ instead.
-
DEPENDENCIES
= ['http_client', 'federation_client', 'federation_server', 'handlers', 'auth', 'room_creation_handler', 'state_handler', 'state_resolution_handler', 'presence_handler', 'sync_handler', 'typing_handler', 'room_list_handler', 'acme_handler', 'auth_handler', 'device_handler', 'stats_handler', 'e2e_keys_handler', 'e2e_room_keys_handler', 'event_handler', 'event_stream_handler', 'initial_sync_handler', 'application_service_api', 'application_service_scheduler', 'application_service_handler', 'device_message_handler', 'profile_handler', 'event_creation_handler', 'deactivate_account_handler', 'set_password_handler', 'notifier', 'event_sources', 'keyring', 'pusherpool', 'event_builder_factory', 'filtering', 'http_client_context_factory', 'simple_http_client', 'proxied_http_client', 'media_repository', 'media_repository_resource', 'federation_transport_client', 'federation_sender', 'receipts_handler', 'macaroon_generator', 'tcp_replication', 'read_marker_handler', 'action_generator', 'user_directory_handler', 'groups_local_handler', 'groups_server_handler', 'groups_attestation_signing', 'groups_attestation_renewer', 'secrets', 'spam_checker', 'third_party_event_rules', 'room_member_handler', 'federation_registry', 'server_notices_manager', 'server_notices_sender', 'message_handler', 'pagination_handler', 'room_context_handler', 'sendmail', 'registration_handler', 'account_validity_handler', 'saml_handler', 'event_client_serializer', 'storage']¶
-
REQUIRED_ON_MASTER_STARTUP
= ['user_directory_handler', 'stats_handler']¶
-
build_account_validity_handler
()¶
-
build_acme_handler
()¶
-
build_action_generator
()¶
-
build_application_service_api
()¶
-
build_application_service_handler
()¶
-
build_application_service_scheduler
()¶
-
build_auth
()¶
-
build_auth_handler
()¶
-
build_deactivate_account_handler
()¶
-
build_device_handler
()¶
-
build_device_message_handler
()¶
-
build_e2e_keys_handler
()¶
-
build_e2e_room_keys_handler
()¶
-
build_event_builder_factory
()¶
-
build_event_client_serializer
()¶
-
build_event_creation_handler
()¶
-
build_event_handler
()¶
-
build_event_sources
()¶
-
build_event_stream_handler
()¶
-
build_federation_client
()¶
-
build_federation_registry
()¶
-
build_federation_sender
()¶
-
build_federation_server
()¶
-
build_federation_transport_client
()¶
-
build_filtering
()¶
-
build_groups_attestation_renewer
()¶
-
build_groups_attestation_signing
()¶
-
build_groups_local_handler
()¶
-
build_groups_server_handler
()¶
-
build_handlers
()¶
-
build_http_client
()¶
-
build_http_client_context_factory
()¶
-
build_initial_sync_handler
()¶
-
build_keyring
()¶
-
build_macaroon_generator
()¶
-
build_media_repository
()¶
-
build_media_repository_resource
()¶
-
build_message_handler
()¶
-
build_notifier
()¶
-
build_pagination_handler
()¶
-
build_presence_handler
()¶
-
build_profile_handler
()¶
-
build_proxied_http_client
()¶
-
build_pusherpool
()¶
-
build_read_marker_handler
()¶
-
build_receipts_handler
()¶
-
build_registration_handler
()¶
-
build_room_context_handler
()¶
-
build_room_creation_handler
()¶
-
build_room_list_handler
()¶
-
build_room_member_handler
()¶
-
build_saml_handler
()¶
-
build_secrets
()¶
-
build_sendmail
()¶
-
build_server_notices_manager
()¶
-
build_server_notices_sender
()¶
-
build_set_password_handler
()¶
-
build_simple_http_client
()¶
-
build_spam_checker
()¶
-
build_state_handler
()¶
-
build_state_resolution_handler
()¶
-
build_stats_handler
()¶
-
build_storage
() → synapse.storage.Storage¶
-
build_sync_handler
()¶
-
build_tcp_replication
()¶
-
build_third_party_event_rules
()¶
-
build_typing_handler
()¶
-
build_user_directory_handler
()¶
-
get_account_validity_handler
()¶
-
get_acme_handler
()¶
-
get_action_generator
()¶
-
get_admin_redaction_ratelimiter
()¶
-
get_application_service_api
()¶
-
get_application_service_handler
()¶
-
get_application_service_scheduler
()¶
-
get_auth
()¶
-
get_auth_handler
()¶
-
get_clock
()¶
-
get_config
()¶
-
get_datastore
()¶
-
get_datastores
()¶
-
get_deactivate_account_handler
()¶
-
get_device_handler
()¶
-
get_device_message_handler
()¶
-
get_distributor
()¶
-
get_e2e_keys_handler
()¶
-
get_e2e_room_keys_handler
()¶
-
get_event_builder_factory
()¶
-
get_event_client_serializer
()¶
-
get_event_creation_handler
()¶
-
get_event_handler
()¶
-
get_event_sources
()¶
-
get_event_stream_handler
()¶
-
get_federation_client
()¶
-
get_federation_registry
()¶
-
get_federation_sender
()¶
-
get_federation_server
()¶
-
get_federation_transport_client
()¶
-
get_filtering
()¶
-
get_groups_attestation_renewer
()¶
-
get_groups_attestation_signing
()¶
-
get_groups_local_handler
()¶
-
get_groups_server_handler
()¶
-
get_handlers
()¶
-
get_http_client
()¶
-
get_http_client_context_factory
()¶
-
get_initial_sync_handler
()¶
-
get_ip_from_request
(request)¶
-
get_keyring
()¶
-
get_macaroon_generator
()¶
-
get_media_repository
()¶
-
get_media_repository_resource
()¶
-
get_message_handler
()¶
-
get_notifier
()¶
-
get_pagination_handler
()¶
-
get_presence_handler
()¶
-
get_profile_handler
()¶
-
get_proxied_http_client
()¶
-
get_pusherpool
()¶
-
get_ratelimiter
()¶
-
get_reactor
()¶ Fetch the Twisted reactor in use by this HomeServer.
-
get_read_marker_handler
()¶
-
get_receipts_handler
()¶
-
get_registration_handler
()¶
-
get_registration_ratelimiter
()¶
-
get_room_context_handler
()¶
-
get_room_creation_handler
()¶
-
get_room_list_handler
()¶
-
get_room_member_handler
()¶
-
get_saml_handler
()¶
-
get_secrets
()¶
-
get_sendmail
()¶
-
get_server_notices_manager
()¶
-
get_server_notices_sender
()¶
-
get_set_password_handler
()¶
-
get_simple_http_client
()¶
-
get_spam_checker
()¶
-
get_state_handler
()¶
-
get_state_resolution_handler
()¶
-
get_stats_handler
()¶
-
get_storage
()¶
-
get_sync_handler
()¶
-
get_tcp_replication
()¶
-
get_third_party_event_rules
()¶
-
get_typing_handler
()¶
-
get_user_directory_handler
()¶
-
is_mine
(domain_specific_string)¶
-
is_mine_id
(string)¶
-
remove_pusher
(app_id, push_key, user_id)¶
-
setup
()¶
-
setup_master
()¶ Some handlers have side effects on instantiation (like registering background updates). This function causes them to be fetched, and therefore instantiated, to run those side effects.
-
should_send_federation
()¶ Should this server be sending federation traffic directly?