Commit 61d2c751 authored by Jim Fulton's avatar Jim Fulton

Better historical connection implementation

- Lower-weight instances when not using RelStorage

- Still works with new RelStorage instances.

- Doesn't make me include loadBefore in MVCCAdapterInstance objects. :)
parent ebbe9fdd
......@@ -103,9 +103,17 @@ class Connection(ExportImport, object):
# Multi-database support
self.connections = {self._db.database_name: self}
storage = db._mvcc_storage.new_instance()
storage = db._mvcc_storage
if before:
storage = HistoricalStorageAdapter(storage, before)
try:
before_instance = storage.before_instance
except AttributeError:
def before_instance(before):
return HistoricalStorageAdapter(
storage.new_instance(), before)
storage = before_instance(before)
else:
storage = storage.new_instance()
self._normal_storage = self._storage = storage
self.new_oid = db.new_oid
......
......@@ -53,7 +53,7 @@ class MVCCAdapter(Base):
return instance
def before_instance(self, before=None):
return BeforeAdapterInstance(self, before)
return HistoricalStorageAdapter(self._storage, before)
def undo_instance(self):
return UndoAdapterInstance(self)
......@@ -97,7 +97,6 @@ class MVCCAdapterInstance(Base):
_copy_methods = Base._copy_methods + (
'loadSerial', 'new_oid', 'tpc_vote',
'checkCurrentSerialInTransaction', 'tpc_abort',
'loadBefore',
)
def __init__(self, base):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment