[Zope3-checkins] CVS: Zope3/src/zodb/storage - base.py:1.18
Jeremy Hylton
jeremy@zope.com
Thu, 13 Mar 2003 17:03:38 -0500
Update of /cvs-repository/Zope3/src/zodb/storage
In directory cvs.zope.org:/tmp/cvs-serv32037/storage
Modified Files:
base.py
Log Message:
Add some usage notes for BaseStorage.
=== Zope3/src/zodb/storage/base.py 1.17 => 1.18 ===
--- Zope3/src/zodb/storage/base.py:1.17 Thu Mar 13 16:32:28 2003
+++ Zope3/src/zodb/storage/base.py Thu Mar 13 17:03:38 2003
@@ -56,29 +56,49 @@
class BaseStorage:
+ """Abstract base class that support storage implementations.
+
+ A subclass must define the following methods:
+ load()
+ close()
+ cleanup()
+ lastSerial()
+ lastTransaction()
+ XXX the previous two should be provided by base
+
+ _begin()
+ _vote()
+ _abort()
+ _finish()
+
+ If the subclass wants to implement IUndoStorage, it must implement
+ all the methods in that interface.
+
+ If the subclass wants to implement IVersionStorage, it must implement
+ all the methods in that interface.
+ """
+
_transaction = None # Transaction that is being committed
_serial = ZERO # Transaction serial number
_tstatus = ' ' # Transaction status, used for copying data
_is_read_only = False
_version = None
- def __init__(self, name, base=None):
+ def __init__(self, name):
self._name = name
# Allocate locks:
l = threading.RLock()
self._lock_acquire = l.acquire
self._lock_release = l.release
+ # XXX Should use a condition variable here
l = threading.Lock()
self._commit_lock_acquire = l.acquire
self._commit_lock_release = l.release
self._ts = newTimeStamp()
self._serial = self._ts.raw()
- if base is None:
- self._oid = ZERO
- else:
- self._oid = base._oid
+ self._oid = ZERO
def abortVersion(self, src, transaction):
if transaction is not self._transaction: