Commit 31a75407 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 5be94d4d
...@@ -146,6 +146,27 @@ def zconn_at(zconn): # -> tid ...@@ -146,6 +146,27 @@ def zconn_at(zconn): # -> tid
raise POSException.ConnectionStateError("database connection is closed") raise POSException.ConnectionStateError("database connection is closed")
# ZODB5 uses MVCC uniformly # ZODB5 uses MVCC uniformly
#
# zconn.db._storage always provides IMVCCStorage - either raw storage provides it,
# or DB wraps raw storage with MVCCAdapter.
#
# MVCCAdapter in turn uses either MVCCAdapterInstance (current) or
# HistoricalStorageAdapter, or UndoAdapterInstance. Retriving zconn.at from those:
#
# MVCCAdapterInstance
# ._start
#
# HistoricalStorageAdapter
# ._before
#
# UndoAdapterInstance
# # no way to retrieve `at`, but .undo_instance() through which
# # UndoAdapterInstance is returnerd, is not used anywhere.
#
# For the reference: FileStorage, ZEO and NEO do not provide IMVCCStorage, thus
# for them we can rely on MVCCAdapterInstance.
#
# RelStorage is IMVCCStorage - TODO: how to extract at.
if zmajor >= 5: if zmajor >= 5:
zstor = zconn._storage zstor = zconn._storage
if isinstance(zstor, ZODB.mvccadapter.MVCCAdapterInstance): if isinstance(zstor, ZODB.mvccadapter.MVCCAdapterInstance):
...@@ -156,7 +177,24 @@ def zconn_at(zconn): # -> tid ...@@ -156,7 +177,24 @@ def zconn_at(zconn): # -> tid
raise AssertionError("zconn_at: TODO: add support for zstor %r" % zstor) raise AssertionError("zconn_at: TODO: add support for zstor %r" % zstor)
raise AssertionError("zconn_at: TODO: add support for ZODB34") # ZODB4
#
# Connection:
# .before !None for historic connections
#
# ._txn_time - if !None - set to tid of _next_ transaction
# XXX set to None initially - what to do?
#
# # XXX do something like that ZODB5 is doing:
# zconn._start = zconn._storage.lastTransaction() + 1
# # XXX _and_ check out queued invalidations
elif zmajor == 4:
raise AssertionError("zconn_at: TODO: add support for ZODB4")
# ZODB3
else:
raise AssertionError("zconn_at: TODO: add support for ZODB3")
# before2at converts tid that specifies database state as "before" into tid that # before2at converts tid that specifies database state as "before" into tid that
......
ZODB5
-----
zconn.db._storage always provides IMVCCStorage - either raw storage provides it,
or DB wraps raw storage with MVCCAdapter.
MVCCAdapter in turn uses either MVCCAdapterInstance (current) or
HistoricalStorageAdapter, or UndoAdapterInstance. Retriving zconn.at from those:
MVCCAdapterInstance
._start
HistoricalStorageAdapter
._before
UndoAdapterInstance
# no way to retrieve `at`, but .undo_instance() through which
# UndoAdapterInstance is returnerd, is not used anywhere.
For the reference: FileStorage, ZEO and NEO do not provide IMVCCStorage, thus
for them we can rely on MVCCAdapterInstance.
RelStorage is IMVCCStorage - TODO: how to extract at.
ZODB4
-----
Connection:
.before !None for historic connections
._txn_time - if !None - set to tid of _next_ transaction
XXX set to None initially - what to do?
# XXX do something like that ZODB5 is doing:
zconn._start = zconn._storage.lastTransaction() + 1
# XXX _and_ check out queued invalidations
ZODB3
-----
TODO
----------------------------------------
zconn._storage
DB.getTid(at, before)
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