Add replication stream for pushers

This commit is contained in:
Mark Haines 2016-03-15 17:01:43 +00:00
parent e462aa97bf
commit b6e8420aee
6 changed files with 107 additions and 18 deletions

View file

@ -49,9 +49,14 @@ class StreamIdGenerator(object):
with stream_id_gen.get_next() as stream_id:
# ... persist event ...
"""
def __init__(self, db_conn, table, column):
def __init__(self, db_conn, table, column, extra_tables=[]):
self._lock = threading.Lock()
self._current_max = _load_max_id(db_conn, table, column)
for table, column in extra_tables:
self._current_max = max(
self._current_max,
_load_max_id(db_conn, table, column)
)
self._unfinished_ids = deque()
def get_next(self):