mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-08 12:32:11 -04:00
Add basic storage functions for handling of receipts
This commit is contained in:
parent
901f56fa63
commit
80a61330ee
4 changed files with 186 additions and 17 deletions
|
@ -72,7 +72,10 @@ class StreamIdGenerator(object):
|
|||
with stream_id_gen.get_next_txn(txn) as stream_id:
|
||||
# ... persist event ...
|
||||
"""
|
||||
def __init__(self):
|
||||
def __init__(self, table, column):
|
||||
self.table = table
|
||||
self.column = column
|
||||
|
||||
self._lock = threading.Lock()
|
||||
|
||||
self._current_max = None
|
||||
|
@ -126,7 +129,7 @@ class StreamIdGenerator(object):
|
|||
|
||||
def _get_or_compute_current_max(self, txn):
|
||||
with self._lock:
|
||||
txn.execute("SELECT MAX(stream_ordering) FROM events")
|
||||
txn.execute("SELECT MAX(%s) FROM %s" % (self.column, self.table))
|
||||
rows = txn.fetchall()
|
||||
val, = rows[0]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue