Fix/improve some docstrings in the replication code. (#4949)
parent
bbd244c7b2
commit
acaa18f7dd
|
@ -0,0 +1 @@
|
||||||
|
Fix/improve some docstrings in the replication code.
|
|
@ -103,10 +103,18 @@ class ReplicationClientHandler(object):
|
||||||
hs.get_reactor().connectTCP(host, port, self.factory)
|
hs.get_reactor().connectTCP(host, port, self.factory)
|
||||||
|
|
||||||
def on_rdata(self, stream_name, token, rows):
|
def on_rdata(self, stream_name, token, rows):
|
||||||
"""Called when we get new replication data. By default this just pokes
|
"""Called to handle a batch of replication data with a given stream token.
|
||||||
the slave store.
|
|
||||||
|
|
||||||
Can be overriden in subclasses to handle more.
|
By default this just pokes the slave store. Can be overriden in subclasses to
|
||||||
|
handle more.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
stream_name (str): name of the replication stream for this batch of rows
|
||||||
|
token (int): stream token for this batch of rows
|
||||||
|
rows (list): a list of Stream.ROW_TYPE objects.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Deferred|None
|
||||||
"""
|
"""
|
||||||
logger.debug("Received rdata %s -> %s", stream_name, token)
|
logger.debug("Received rdata %s -> %s", stream_name, token)
|
||||||
return self.store.process_replication_rows(stream_name, token, rows)
|
return self.store.process_replication_rows(stream_name, token, rows)
|
||||||
|
|
|
@ -162,8 +162,10 @@ class Stream(object):
|
||||||
until the `upto_token`
|
until the `upto_token`
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
(list(ROW_TYPE), int): list of updates plus the token used as an
|
Deferred[Tuple[List[Tuple[int, Any]], int]:
|
||||||
upper bound of the updates (i.e. the "current token")
|
Resolves to a pair ``(updates, current_token)``, where ``updates`` is a
|
||||||
|
list of ``(token, row)`` entries. ``row`` will be json-serialised and
|
||||||
|
sent over the replication steam.
|
||||||
"""
|
"""
|
||||||
updates, current_token = yield self.get_updates_since(self.last_token)
|
updates, current_token = yield self.get_updates_since(self.last_token)
|
||||||
self.last_token = current_token
|
self.last_token = current_token
|
||||||
|
@ -176,8 +178,10 @@ class Stream(object):
|
||||||
stream updates
|
stream updates
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
(list(ROW_TYPE), int): list of updates plus the token used as an
|
Deferred[Tuple[List[Tuple[int, Any]], int]:
|
||||||
upper bound of the updates (i.e. the "current token")
|
Resolves to a pair ``(updates, current_token)``, where ``updates`` is a
|
||||||
|
list of ``(token, row)`` entries. ``row`` will be json-serialised and
|
||||||
|
sent over the replication steam.
|
||||||
"""
|
"""
|
||||||
if from_token in ("NOW", "now"):
|
if from_token in ("NOW", "now"):
|
||||||
defer.returnValue(([], self.upto_token))
|
defer.returnValue(([], self.upto_token))
|
||||||
|
|
Loading…
Reference in New Issue