Fixup doc comments

This commit is contained in:
Erik Johnston 2018-08-09 10:23:49 +01:00
parent 5785b93711
commit 72d1902bbe
2 changed files with 28 additions and 0 deletions

View File

@ -811,6 +811,13 @@ class FederationHandlerRegistry(object):
class ReplicationFederationHandlerRegistry(FederationHandlerRegistry): class ReplicationFederationHandlerRegistry(FederationHandlerRegistry):
"""A FederationHandlerRegistry for worker processes.
When receiving EDU or queries it will check if an appropriate handler has
been registered on the worker, if there isn't one then it calls off to the
master process.
"""
def __init__(self, hs): def __init__(self, hs):
self.config = hs.config self.config = hs.config
self.http_client = hs.get_simple_http_client() self.http_client = hs.get_simple_http_client()
@ -822,6 +829,8 @@ class ReplicationFederationHandlerRegistry(FederationHandlerRegistry):
super(ReplicationFederationHandlerRegistry, self).__init__() super(ReplicationFederationHandlerRegistry, self).__init__()
def on_edu(self, edu_type, origin, content): def on_edu(self, edu_type, origin, content):
"""Overrides FederationHandlerRegistry
"""
handler = self.edu_handlers.get(edu_type) handler = self.edu_handlers.get(edu_type)
if handler: if handler:
return super(ReplicationFederationHandlerRegistry, self).on_edu( return super(ReplicationFederationHandlerRegistry, self).on_edu(
@ -835,6 +844,8 @@ class ReplicationFederationHandlerRegistry(FederationHandlerRegistry):
) )
def on_query(self, query_type, args): def on_query(self, query_type, args):
"""Overrides FederationHandlerRegistry
"""
handler = self.query_handlers.get(query_type) handler = self.query_handlers.get(query_type)
if handler: if handler:
return handler(args) return handler(args)

View File

@ -157,6 +157,15 @@ class ReplicationFederationSendEventsRestServlet(ReplicationEndpoint):
class ReplicationFederationSendEduRestServlet(ReplicationEndpoint): class ReplicationFederationSendEduRestServlet(ReplicationEndpoint):
"""Handles EDUs newly received from federation, including persisting and """Handles EDUs newly received from federation, including persisting and
notifying. notifying.
Request format:
POST /_synapse/replication/fed_send_edu/:edu_type/:txn_id
{
"origin": ...,
"content: { ... }
}
""" """
NAME = "fed_send_edu" NAME = "fed_send_edu"
@ -196,6 +205,14 @@ class ReplicationFederationSendEduRestServlet(ReplicationEndpoint):
class ReplicationGetQueryRestServlet(ReplicationEndpoint): class ReplicationGetQueryRestServlet(ReplicationEndpoint):
"""Handle responding to queries from federation. """Handle responding to queries from federation.
Request format:
POST /_synapse/replication/fed_query/:query_type
{
"args": { ... }
}
""" """
NAME = "fed_query" NAME = "fed_query"