Skip to content

Instantly share code, notes, and snippets.

@elliotchance
Created December 4, 2019 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elliotchance/933d96660288ea97cebf61c71df99d25 to your computer and use it in GitHub Desktop.
Save elliotchance/933d96660288ea97cebf61c71df99d25 to your computer and use it in GitHub Desktop.
class SerializableTransaction(RepeatableReadTransaction):
def __init__(self, table, xid):
Transaction.__init__(self, table, xid)
self.existing_xids = self.table.active_xids.copy()
def record_is_visible(self, record):
is_visible = ReadCommittedTransaction.record_is_visible(self, record) \
and record['created_xid'] <= self.xid \
and record['created_xid'] in self.existing_xids
if is_visible:
self.table.locks.add(self, record['id'])
return is_visible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment