[Zodb-checkins] CVS: Zope3/src/zodb - connection.py:1.6.2.1 db.py:1.6.2.1 export.py:1.3.2.1 interfaces.py:1.6.2.1 lockfile.py:1.2.6.1 serialize.py:1.7.2.1
Sidnei da Silva
sidnei@x3ng.com.br
Tue, 11 Feb 2003 09:41:50 -0500
Update of /cvs-repository/Zope3/src/zodb
In directory cvs.zope.org:/tmp/cvs-serv18615/src/zodb
Modified Files:
Tag: paris-copypasterename-branch
connection.py db.py export.py interfaces.py lockfile.py
serialize.py
Log Message:
Updating from HEAD to make sure everything still works before merging
=== Zope3/src/zodb/connection.py 1.6 => 1.6.2.1 ===
--- Zope3/src/zodb/connection.py:1.6 Tue Jan 28 13:17:30 2003
+++ Zope3/src/zodb/connection.py Tue Feb 11 09:40:48 2003
@@ -104,7 +104,7 @@
self._created = Set()
# new_oid is used by serialize
- self.new_oid = self._storage.new_oid
+ self.newObjectId = self._storage.newObjectId
######################################################################
# IAppConnection defines the next two methods
@@ -270,12 +270,12 @@
# commit_sub() will call tpc_begin() on the real storage
self._commit_sub(txn)
else:
- self._storage.tpc_begin(txn)
+ self._storage.tpcBegin(txn)
for obj in self._txns.get(txn, ()):
self._objcommit(obj, txn)
- s = self._storage.tpc_vote(txn)
+ s = self._storage.tpcVote(txn)
self._handle_serial(s)
return True
@@ -284,7 +284,7 @@
# without calling prepare()
if self._tmp is not None:
self._abort_sub()
- self._storage.tpc_abort(txn)
+ self._storage.tpcAbort(txn)
objs = self._txns.get(txn)
if objs is not None:
@@ -307,7 +307,7 @@
# XXX We should really have a try/finally because the begin
# call acquired a lock that will only be released in
# _invalidate_modified().
- self._storage.tpc_finish(txn, self._invalidate_modified)
+ self._storage.tpcFinish(txn, self._invalidate_modified)
try:
del self._txns[txn]
except KeyError:
@@ -323,14 +323,14 @@
tmp.registerDB(self._db)
self._modified = Set()
self._created = Set()
- self._storage.tpc_begin(txn)
+ self._storage.tpcBegin(txn)
for obj in self._txns.get(txn, ()):
self._objcommit(obj, txn)
self.importHook(txn) # hook for ExportImport
# The tpc_finish() of TmpStore returns an UndoInfo object.
- undo = self._storage.tpc_finish(txn)
+ undo = self._storage.tpcFinish(txn)
self._storage._created = self._created
self._created = Set()
return Rollback(self, undo)
@@ -392,7 +392,7 @@
self._logger.debug("commit object %s", u64(oid))
if oid is None or object._p_jar is not self:
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
object._p_jar = self
object._p_oid = oid
self._created.add(oid)
@@ -436,7 +436,7 @@
self._storage = self._tmp
self._tmp = None
- self._storage.tpc_begin(txn)
+ self._storage.tpcBegin(txn)
# Copy invalidating and creating info from temporary storage:
self._modified |= Set(tmp._index)
@@ -548,8 +548,8 @@
return self._bver
return self._db._storage.modifiedInVersion(oid)
- def new_oid(self):
- return self._db._storage.new_oid()
+ def newObjectId(self):
+ return self._db._storage.newObjectId()
def registerDB(self, db):
self._db = db
@@ -568,24 +568,24 @@
self._pos += l + 24
return serial
- def tpc_abort(self, transaction):
+ def tpcAbort(self, transaction):
if transaction is not self._transaction:
return
self._tindex.clear()
self._transaction = None
self._pos = self._tpos
- def tpc_begin(self, transaction):
+ def tpcBegin(self, transaction):
if self._transaction is transaction:
return
self._transaction = transaction
self._tindex.clear() # Just to be sure!
self._pos = self._tpos
- def tpc_vote(self, transaction):
+ def tpcVote(self, transaction):
pass
- def tpc_finish(self, transaction, f=None):
+ def tpcFinish(self, transaction, f=None):
if transaction is not self._transaction:
return
if f is not None:
=== Zope3/src/zodb/db.py 1.6 => 1.6.2.1 ===
--- Zope3/src/zodb/db.py:1.6 Tue Feb 4 05:32:46 2003
+++ Zope3/src/zodb/db.py Tue Feb 11 09:40:48 2003
@@ -24,7 +24,7 @@
from types import StringType
import logging
-from zodb.interfaces import StorageError, StorageVersionError
+from zodb.storage.interfaces import *
from zodb.connection import Connection
from zodb.serialize import getDBRoot
from zodb.ztransaction import Transaction
@@ -82,15 +82,18 @@
except KeyError:
# Create the database's root in the storage if it doesn't exist
t = Transaction(description="initial database creation")
- storage.tpc_begin(t)
+ storage.tpcBegin(t)
storage.store(z64, None, getDBRoot(), '', t)
- storage.tpc_vote(t)
- storage.tpc_finish(t)
+ storage.tpcVote(t)
+ storage.tpcFinish(t)
# Pass through methods:
- for m in ('supportsVersions', 'undoInfo', 'versionEmpty',
- 'versions', 'modifiedInVersion', 'versionEmpty'):
- setattr(self, m, getattr(storage, m))
+ if IUndoStorage.isImplementedBy(storage):
+ self.undoInfo = storage.undoInfo
+ if IVersionStorage.isImplementedBy(storage):
+ for m in ['versionEmpty', 'versions', 'modifiedInVersion',
+ 'versionEmpty']:
+ setattr(self, m, getattr(storage, m))
def _checkVersion(self):
# Make sure the database version that created the storage is
@@ -335,10 +338,10 @@
get_transaction().join(self)
def prepare(self, txn):
- self._storage.tpc_begin(txn)
+ self._storage.tpcBegin(txn)
try:
self._prepare(txn)
- self._storage.tpc_vote(txn)
+ self._storage.tpcVote(txn)
except StorageError, err:
logging.getLogger("zodb").info("Error during prepare: %s", err)
return False
@@ -346,10 +349,10 @@
return True
def abort(self, txn):
- self._storage.tpc_abort(txn)
+ self._storage.tpcAbort(txn)
def commit(self, txn):
- self._storage.tpc_finish(txn)
+ self._storage.tpcFinish(txn)
def _prepare(self, txn):
# Hook for clients to perform action during 2PC
@@ -400,7 +403,7 @@
self._tid = tid
def _prepare(self, txn):
- self._oids = self._storage.transactionalUndo(self._tid, txn)
+ self._oids = self._storage.undo(self._tid, txn)
def commit(self, txn):
super(TransactionalUndo, self).commit(txn)
=== Zope3/src/zodb/export.py 1.3 => 1.3.2.1 ===
--- Zope3/src/zodb/export.py:1.3 Tue Jan 28 11:42:25 2003
+++ Zope3/src/zodb/export.py Tue Feb 11 09:40:48 2003
@@ -120,12 +120,12 @@
oid = h[:8]
new_ref = copier.oids.get(oid)
if new_ref is None:
- new_oid = self._storage.new_oid()
- copier.oids[oid] = new_oid, None
- return_oid_list.append(new_oid)
- self._created.add(new_oid)
+ newObjectId = self._storage.newObjectId()
+ copier.oids[oid] = newObjectId, None
+ return_oid_list.append(newObjectId)
+ self._created.add(newObjectId)
else:
- new_oid = new_ref[0]
+ newObjectId = new_ref[0]
new = copier.copy(p)
- self._storage.store(new_oid, None, new, self._version, txn)
+ self._storage.store(newObjectId, None, new, self._version, txn)
=== Zope3/src/zodb/interfaces.py 1.6 => 1.6.2.1 ===
--- Zope3/src/zodb/interfaces.py:1.6 Tue Jan 28 13:17:30 2003
+++ Zope3/src/zodb/interfaces.py Tue Feb 11 09:40:48 2003
@@ -25,6 +25,26 @@
from transaction.interfaces \
import TransactionError, RollbackError, ConflictError as _ConflictError
+__all__ = ['POSError',
+ 'POSKeyError',
+ 'ConflictError',
+ 'ReadConflictError',
+ 'DanglingReferenceError',
+ 'VersionError',
+ 'VersionCommitError',
+ 'VersionLockError',
+ 'UndoError',
+ 'MultipleUndoErrors',
+ 'ExportError',
+ 'Unsupported',
+
+ 'InvalidObjectReference',
+ 'IAppConnection',
+ 'IConnection',
+ 'ITransaction',
+ 'ITransactionAttrs',
+ ]
+
def _fmt_oid(oid):
return "%016x" % zodb.utils.u64(oid)
@@ -183,37 +203,6 @@
def __str__(self):
return "\n".join([_fmt_undo(*pair) for pair in self._errs])
-
-class StorageError(POSError):
- """Base class for storage based exceptions."""
-
-class StorageVersionError(StorageError):
- """The storage version doesn't match the database version."""
-
- def __init__(self, db_ver, storage_ver):
- self.db_ver = db_ver
- self.storage_ver = storage_ver
-
- def __str__(self):
- db = ".".join(self.db_ver)
- storage = ".".join(self.storage_ver)
- return ("Storage version %s passed to database version %s"
- % (storage, db))
-
-class StorageTransactionError(StorageError):
- """An operation was invoked for an invalid transaction or state."""
-
-class StorageSystemError(StorageError):
- """Panic! Internal storage error!"""
-
-class MountedStorageError(StorageError):
- """Unable to access mounted storage."""
-
-class ReadOnlyError(StorageError):
- """Unable to modify objects in a read-only storage."""
-
-class TransactionTooLargeError(StorageTransactionError):
- """The transaction exhausted some finite storage resource."""
class ExportError(POSError):
"""An export file doesn't have the right format."""
=== Zope3/src/zodb/lockfile.py 1.2 => 1.2.6.1 ===
--- Zope3/src/zodb/lockfile.py:1.2 Wed Dec 25 09:12:16 2002
+++ Zope3/src/zodb/lockfile.py Tue Feb 11 09:40:48 2003
@@ -12,7 +12,7 @@
#
##############################################################################
-from zodb.interfaces import StorageSystemError
+from zodb.storage.interfaces import StorageSystemError
# Try to create a function that creates Unix file locks.
try:
=== Zope3/src/zodb/serialize.py 1.7 => 1.7.2.1 ===
--- Zope3/src/zodb/serialize.py:1.7 Tue Jan 28 11:42:25 2003
+++ Zope3/src/zodb/serialize.py Tue Feb 11 09:40:48 2003
@@ -72,7 +72,7 @@
return klass, newargs
class RootJar:
- def new_oid(self):
+ def newObjectId(self):
return "\0" * 8
def getDBRoot():
@@ -91,7 +91,7 @@
self._p.persistent_id = self._persistent_id
self._stack = []
if jar is not None:
- assert hasattr(jar, "new_oid")
+ assert hasattr(jar, "newObjectId")
self._jar = jar
def _persistent_id(self, obj):
@@ -120,7 +120,7 @@
if oid is None or obj._p_jar is not self._jar:
# XXX log warning if obj._p_jar is not self
- oid = self._jar.new_oid()
+ oid = self._jar.newObjectId()
obj._p_jar = self._jar
obj._p_oid = oid
self._stack.append(obj)
@@ -271,9 +271,9 @@
classmeta = None
new_ref = self._cache.get(oid)
if new_ref is None:
- new_oid = self._storage.new_oid()
- self._created.add(new_oid)
- self._cache[oid] = new_ref = new_oid, classmeta
+ newObjectId = self._storage.newObjectId()
+ self._created.add(newObjectId)
+ self._cache[oid] = new_ref = newObjectId, classmeta
return CopyReference(new_ref)
def readPickle(self, pickle):