forked from MirrorHub/synapse
Document abstract class and method better
This commit is contained in:
parent
f793bc3877
commit
1b2af11650
1 changed files with 13 additions and 8 deletions
|
@ -148,6 +148,11 @@ def filter_to_clause(event_filter):
|
||||||
|
|
||||||
|
|
||||||
class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
|
class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
|
||||||
|
"""This is an abstract base class where subclasses must implement
|
||||||
|
`get_room_max_stream_ordering` and `get_room_min_stream_ordering`
|
||||||
|
which can be called in the initializer.
|
||||||
|
"""
|
||||||
|
|
||||||
__metaclass__ = abc.ABCMeta
|
__metaclass__ = abc.ABCMeta
|
||||||
|
|
||||||
def __init__(self, db_conn, hs):
|
def __init__(self, db_conn, hs):
|
||||||
|
@ -170,6 +175,14 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
|
||||||
|
|
||||||
self._stream_order_on_start = self.get_room_max_stream_ordering()
|
self._stream_order_on_start = self.get_room_max_stream_ordering()
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
|
def get_room_max_stream_ordering(self):
|
||||||
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
|
def get_room_min_stream_ordering(self):
|
||||||
|
raise NotImplementedError()
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_room_events_stream_for_rooms(self, room_ids, from_key, to_key, limit=0,
|
def get_room_events_stream_for_rooms(self, room_ids, from_key, to_key, limit=0,
|
||||||
order='DESC'):
|
order='DESC'):
|
||||||
|
@ -421,14 +434,6 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
|
||||||
)
|
)
|
||||||
defer.returnValue("t%d-%d" % (topo, token))
|
defer.returnValue("t%d-%d" % (topo, token))
|
||||||
|
|
||||||
@abc.abstractmethod
|
|
||||||
def get_room_max_stream_ordering(self):
|
|
||||||
raise NotImplementedError()
|
|
||||||
|
|
||||||
@abc.abstractmethod
|
|
||||||
def get_room_min_stream_ordering(self):
|
|
||||||
raise NotImplementedError()
|
|
||||||
|
|
||||||
def get_stream_token_for_event(self, event_id):
|
def get_stream_token_for_event(self, event_id):
|
||||||
"""The stream token for an event
|
"""The stream token for an event
|
||||||
Args:
|
Args:
|
||||||
|
|
Loading…
Reference in a new issue