[Zope3-checkins] CVS: Zope3/src/zodb/storage/tests - version.py:1.3 undoversion.py:1.3 undo.py:1.5 timeiter.py:1.3 test_whitebox.py:1.7 test_storage_api.py:1.6 test_file.py:1.6 test_create.py:1.6 test_autopack.py:1.9 synchronization.py:1.4 revision.py:1.4 recovery.py:1.4 readonly.py:1.4 persistent.py:1.3 packable.py:1.4 mt.py:1.4 iterator.py:1.4 history.py:1.3 corruption.py:1.4 conflict.py:1.4 basic.py:1.6 base.py:1.6
Jeremy Hylton
jeremy@zope.com
Wed, 5 Feb 2003 18:29:06 -0500
Update of /cvs-repository/Zope3/src/zodb/storage/tests
In directory cvs.zope.org:/tmp/cvs-serv16759/src/zodb/storage/tests
Modified Files:
version.py undoversion.py undo.py timeiter.py test_whitebox.py
test_storage_api.py test_file.py test_create.py
test_autopack.py synchronization.py revision.py recovery.py
readonly.py persistent.py packable.py mt.py iterator.py
history.py corruption.py conflict.py basic.py base.py
Log Message:
Merge storage-interface-branch to trunk.
Rename methods that had underscores to use camel case.
new_oid => newObjectId
tpc_begin => tpcBegin
tpc_vote => tpcVote
tpc_finish => tpcFinish
tpc_abort => tpcAbort
transactionalUndo => undo
Remove some methods from storage interfaces.
Move storage-related exceptions to zodb.storage.interfaces.
Add __implements__ to storages and use for introspection in place of
supportsXXX().
=== Zope3/src/zodb/storage/tests/version.py 1.2 => 1.3 ===
--- Zope3/src/zodb/storage/tests/version.py:1.2 Wed Dec 25 09:12:20 2002
+++ Zope3/src/zodb/storage/tests/version.py Wed Feb 5 18:28:27 2003
@@ -20,13 +20,18 @@
from zodb.ztransaction import Transaction
from zodb.storage.tests.minpo import MinPO
from zodb.storage.tests.base import zodb_unpickle
+from zodb.storage.interfaces import IUndoStorage, IVersionStorage
class VersionStorage:
+
+ def checkIVersionStorage(self):
+ self.assert_(IVersionStorage.isImplementedBy(self._storage))
+
def checkVersionedStoreAndLoad(self):
eq = self.assertEqual
# Store a couple of non-version revisions of the object
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid = self._dostore(oid, data=MinPO(11))
revid = self._dostore(oid, revid=revid, data=MinPO(12))
# And now store some new revisions in a version
@@ -48,7 +53,7 @@
eq(s, max(revid, vrevid))
def checkVersionedLoadErrors(self):
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
version = 'test-version'
revid = self._dostore(oid, data=MinPO(11))
revid = self._dostore(oid, revid=revid, data=MinPO(12),
@@ -56,13 +61,13 @@
# Try to load a bogus oid
self.assertRaises(KeyError,
self._storage.load,
- self._storage.new_oid(), '')
+ self._storage.newObjectId(), '')
data, revid = self._storage.load(oid, 'bogus')
self.assertEqual(zodb_unpickle(data), MinPO(11))
def checkVersionLock(self):
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid = self._dostore(oid, data=MinPO(11))
version = 'test-version'
revid = self._dostore(oid, revid=revid, data=MinPO(12),
@@ -77,7 +82,7 @@
version = 'test-version'
self.failUnless(self._storage.versionEmpty(version))
# Now store some objects
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid = self._dostore(oid, data=MinPO(11))
revid = self._dostore(oid, revid=revid, data=MinPO(12))
revid = self._dostore(oid, revid=revid, data=MinPO(13),
@@ -94,9 +99,9 @@
def checkVersions(self):
unless = self.failUnless
# Store some objects in the non-version
- oid1 = self._storage.new_oid()
- oid2 = self._storage.new_oid()
- oid3 = self._storage.new_oid()
+ oid1 = self._storage.newObjectId()
+ oid2 = self._storage.newObjectId()
+ oid3 = self._storage.newObjectId()
revid1 = self._dostore(oid1, data=MinPO(11))
revid2 = self._dostore(oid2, data=MinPO(12))
revid3 = self._dostore(oid3, data=MinPO(13))
@@ -119,7 +124,7 @@
def _setup_version(self, version='test-version'):
# Store some revisions in the non-version
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid = self._dostore(oid, data=MinPO(49))
revid = self._dostore(oid, revid=revid, data=MinPO(50))
nvrevid = revid = self._dostore(oid, revid=revid, data=MinPO(51))
@@ -144,10 +149,10 @@
## s1 = self._storage.getSerial(oid)
# Now abort the version -- must be done in a transaction
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
oids = self._storage.abortVersion(version, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
## s2 = self._storage.getSerial(oid)
## eq(s1, s2) # or self.assert(s2 > s1) ?
eq(len(oids), 1)
@@ -160,20 +165,18 @@
oid, version = self._setup_version()
# Now abort a bogus version
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
# And try to abort the empty version
- if (hasattr(self._storage, 'supportsTransactionalUndo')
- and self._storage.supportsTransactionalUndo()):
- # XXX FileStorage used to be broken on this one
+ if IUndoStorage.isImplementedBy(self._storage):
self.assertRaises(interfaces.VersionError,
self._storage.abortVersion,
'', t)
# But now we really try to abort the version
oids = self._storage.abortVersion(version, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
eq(len(oids), 1)
eq(oids[0], oid)
data, revid = self._storage.load(oid, '')
@@ -189,23 +192,23 @@
data, revid1 = self._storage.load(oid1, version1)
eq(zodb_unpickle(data), MinPO(54))
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
try:
self.assertRaises(interfaces.VersionCommitError,
self._storage.commitVersion,
'one', 'one', t)
finally:
- self._storage.tpc_abort(t)
+ self._storage.tpcAbort(t)
def checkModifyAfterAbortVersion(self):
eq = self.assertEqual
oid, version = self._setup_version()
# Now abort the version
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
oids = self._storage.abortVersion(version, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
# Load the object's current state (which gets us the revid)
data, revid = self._storage.load(oid, '')
# And modify it a few times
@@ -225,10 +228,10 @@
eq(zodb_unpickle(data), MinPO(51))
# Try committing this version to the empty version
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
oids = self._storage.commitVersion(version, '', t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
data, revid = self._storage.load(oid, '')
eq(zodb_unpickle(data), MinPO(54))
@@ -252,11 +255,11 @@
# Okay, now let's commit object1 to version2
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
oids = self._storage.commitVersion(version1, version2,
t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
eq(len(oids), 1)
eq(oids[0], oid1)
data, revid = self._storage.load(oid1, version2)
@@ -288,10 +291,10 @@
# First, let's abort version1
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
oids = self._storage.abortVersion(version1, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
eq(len(oids), 1)
eq(oids[0], oid1)
data, revid = self._storage.load(oid1, '')
@@ -308,10 +311,10 @@
eq(zodb_unpickle(data), MinPO(54))
# Okay, now let's commit version2 back to the trunk
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
oids = self._storage.commitVersion(version2, '', t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
eq(len(oids), 1)
eq(oids[0], oid2)
data, revid = self._storage.load(oid1, '')
@@ -323,7 +326,7 @@
data, revid = self._storage.load(oid2, version2)
eq(zodb_unpickle(data), MinPO(54))
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid = self._dostore(oid, revid=revid, data=MinPO(54), version='one')
self.assertRaises(KeyError,
self._storage.load, oid, '')
=== Zope3/src/zodb/storage/tests/undoversion.py 1.2 => 1.3 ===
--- Zope3/src/zodb/storage/tests/undoversion.py:1.2 Wed Dec 25 09:12:20 2002
+++ Zope3/src/zodb/storage/tests/undoversion.py Wed Feb 5 18:28:27 2003
@@ -21,7 +21,7 @@
class TransactionalUndoVersionStorage:
def checkUndoInVersion(self):
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
version = 'one'
revid_a = self._dostore(oid, data=MinPO(91))
revid_b = self._dostore(oid, revid=revid_a, data=MinPO(92),
@@ -31,10 +31,10 @@
info=self._storage.undoInfo()
tid=info[0]['id']
t = Transaction()
- self._storage.tpc_begin(t)
- oids = self._storage.transactionalUndo(tid, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcBegin(t)
+ oids = self._storage.undo(tid, t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
assert len(oids) == 1
assert oids[0] == oid
data, revid = self._storage.load(oid, '')
@@ -45,10 +45,10 @@
assert zodb_unpickle(data) == MinPO(92)
# Now commit the version...
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
oids = self._storage.commitVersion(version, '', t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
assert len(oids) == 1
assert oids[0] == oid
@@ -60,10 +60,10 @@
info=self._storage.undoInfo()
tid=info[0]['id']
t = Transaction()
- self._storage.tpc_begin(t)
- oids = self._storage.transactionalUndo(tid, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcBegin(t)
+ oids = self._storage.undo(tid, t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
assert len(oids) == 1
assert oids[0] == oid
data, revid = self._storage.load(oid, version)
@@ -72,10 +72,10 @@
assert zodb_unpickle(data) == MinPO(91)
# Now abort the version
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
oids = self._storage.abortVersion(version, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
assert len(oids) == 1
assert oids[0] == oid
@@ -87,10 +87,10 @@
info=self._storage.undoInfo()
tid=info[0]['id']
t = Transaction()
- self._storage.tpc_begin(t)
- oids = self._storage.transactionalUndo(tid, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcBegin(t)
+ oids = self._storage.undo(tid, t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
assert len(oids) == 1
assert oids[0] == oid
# And the object should be back in versions 'one' and ''
=== Zope3/src/zodb/storage/tests/undo.py 1.4 => 1.5 ===
--- Zope3/src/zodb/storage/tests/undo.py:1.4 Tue Feb 4 17:21:04 2003
+++ Zope3/src/zodb/storage/tests/undo.py Wed Feb 5 18:28:27 2003
@@ -35,7 +35,7 @@
self.__serials[oid] = serial
def _transaction_vote(self, trans):
- r = self._storage.tpc_vote(trans)
+ r = self._storage.tpcVote(trans)
if r:
for oid, serial in r:
self.__serials[oid] = serial
@@ -46,13 +46,13 @@
def _multi_obj_transaction(self, objs):
newrevs = {}
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
self._transaction_begin()
for oid, rev, data in objs:
self._transaction_store(oid, rev, data, '', t)
newrevs[oid] = None
self._transaction_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcFinish(t)
for oid in newrevs.keys():
newrevs[oid] = self._transaction_newserial(oid)
return newrevs
@@ -70,7 +70,7 @@
def checkSimpleTransactionalUndo(self):
eq = self.assertEqual
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid = self._dostore(oid, data=MinPO(23))
revid = self._dostore(oid, revid=revid, data=MinPO(24))
revid = self._dostore(oid, revid=revid, data=MinPO(25))
@@ -80,10 +80,10 @@
# Now start an undo transaction
t = Transaction()
t.note('undo1')
- self._storage.tpc_begin(t)
- oids = self._storage.transactionalUndo(tid, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcBegin(t)
+ oids = self._storage.undo(tid, t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
eq(len(oids), 1)
eq(oids[0], oid)
data, revid = self._storage.load(oid, '')
@@ -93,10 +93,10 @@
tid = info[2]['id']
t = Transaction()
t.note('undo2')
- self._storage.tpc_begin(t)
- oids = self._storage.transactionalUndo(tid, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcBegin(t)
+ oids = self._storage.undo(tid, t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
eq(len(oids), 1)
eq(oids[0], oid)
data, revid = self._storage.load(oid, '')
@@ -106,10 +106,10 @@
tid = info[4]['id']
t = Transaction()
t.note('undo3')
- self._storage.tpc_begin(t)
- oids = self._storage.transactionalUndo(tid, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcBegin(t)
+ oids = self._storage.undo(tid, t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
eq(len(oids), 1)
eq(oids[0], oid)
@@ -120,10 +120,10 @@
info = self._storage.undoInfo()
tid = info[0]['id']
t = Transaction()
- self._storage.tpc_begin(t)
- oids = self._storage.transactionalUndo(tid, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcBegin(t)
+ oids = self._storage.undo(tid, t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
eq(len(oids), 1)
eq(oids[0], oid)
data, revid = self._storage.load(oid, '')
@@ -132,17 +132,17 @@
def checkUndoCreationBranch1(self):
eq = self.assertEqual
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid = self._dostore(oid, data=MinPO(11))
revid = self._dostore(oid, revid=revid, data=MinPO(12))
# Undo the last transaction
info = self._storage.undoInfo()
tid = info[0]['id']
t = Transaction()
- self._storage.tpc_begin(t)
- oids = self._storage.transactionalUndo(tid, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcBegin(t)
+ oids = self._storage.undo(tid, t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
eq(len(oids), 1)
eq(oids[0], oid)
data, revid = self._storage.load(oid, '')
@@ -152,10 +152,10 @@
info = self._storage.undoInfo()
tid = info[2]['id']
t = Transaction()
- self._storage.tpc_begin(t)
- oids = self._storage.transactionalUndo(tid, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcBegin(t)
+ oids = self._storage.undo(tid, t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
eq(len(oids), 1)
eq(oids[0], oid)
self.assertRaises(KeyError, self._storage.load, oid, '')
@@ -163,17 +163,17 @@
def checkUndoCreationBranch2(self):
eq = self.assertEqual
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid = self._dostore(oid, data=MinPO(11))
revid = self._dostore(oid, revid=revid, data=MinPO(12))
# Undo the last transaction
info = self._storage.undoInfo()
tid = info[0]['id']
t = Transaction()
- self._storage.tpc_begin(t)
- oids = self._storage.transactionalUndo(tid, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcBegin(t)
+ oids = self._storage.undo(tid, t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
eq(len(oids), 1)
eq(oids[0], oid)
data, revid = self._storage.load(oid, '')
@@ -183,10 +183,10 @@
info = self._storage.undoInfo()
tid = info[0]['id']
t = Transaction()
- self._storage.tpc_begin(t)
- oids = self._storage.transactionalUndo(tid, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcBegin(t)
+ oids = self._storage.undo(tid, t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
eq(len(oids), 1)
eq(oids[0], oid)
data, revid = self._storage.load(oid, '')
@@ -198,12 +198,12 @@
# Convenience
p31, p32, p51, p52 = map(zodb_pickle,
map(MinPO, (31, 32, 51, 52)))
- oid1 = self._storage.new_oid()
- oid2 = self._storage.new_oid()
+ oid1 = self._storage.newObjectId()
+ oid2 = self._storage.newObjectId()
revid1 = revid2 = z64
# Store two objects in the same transaction
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
self._transaction_begin()
self._transaction_store(oid1, revid1, p31, '', t)
self._transaction_store(oid2, revid2, p51, '', t)
@@ -211,11 +211,11 @@
self._transaction_vote(t)
revid1 = self._transaction_newserial(oid1)
revid2 = self._transaction_newserial(oid2)
- self._storage.tpc_finish(t)
+ self._storage.tpcFinish(t)
eq(revid1, revid2)
# Update those same two objects
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
self._transaction_begin()
self._transaction_store(oid1, revid1, p32, '', t)
self._transaction_store(oid2, revid2, p52, '', t)
@@ -223,7 +223,7 @@
self._transaction_vote(t)
revid1 = self._transaction_newserial(oid1)
revid2 = self._transaction_newserial(oid2)
- self._storage.tpc_finish(t)
+ self._storage.tpcFinish(t)
eq(revid1, revid2)
# Make sure the objects have the current value
data, revid1 = self._storage.load(oid1, '')
@@ -234,10 +234,10 @@
info = self._storage.undoInfo()
tid = info[0]['id']
t = Transaction()
- self._storage.tpc_begin(t)
- oids = self._storage.transactionalUndo(tid, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcBegin(t)
+ oids = self._storage.undo(tid, t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
eq(len(oids), 2)
self.failUnless(oid1 in oids)
self.failUnless(oid2 in oids)
@@ -254,8 +254,8 @@
p30, p31, p32, p50, p51, p52 = map(zodb_pickle,
map(MinPO,
(30, 31, 32, 50, 51, 52)))
- oid1 = self._storage.new_oid()
- oid2 = self._storage.new_oid()
+ oid1 = self._storage.newObjectId()
+ oid2 = self._storage.newObjectId()
revid1 = revid2 = z64
# Store two objects in the same transaction
d = self._multi_obj_transaction([(oid1, revid1, p30),
@@ -285,11 +285,11 @@
tid = info[0]['id']
tid1 = info[1]['id']
t = Transaction()
- self._storage.tpc_begin(t)
- oids = self._storage.transactionalUndo(tid, t)
- oids1 = self._storage.transactionalUndo(tid1, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcBegin(t)
+ oids = self._storage.undo(tid, t)
+ oids1 = self._storage.undo(tid1, t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
# We get the finalization stuff called an extra time:
## self._storage.tpc_vote(t)
## self._storage.tpc_finish(t)
@@ -305,10 +305,10 @@
info = self._storage.undoInfo()
tid = info[0]['id']
t = Transaction()
- self._storage.tpc_begin(t)
- oids = self._storage.transactionalUndo(tid, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcBegin(t)
+ oids = self._storage.undo(tid, t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
eq(len(oids), 2)
unless(oid1 in oids)
unless(oid2 in oids)
@@ -325,19 +325,19 @@
map(MinPO, (31, 32, 33, 51, 52, 53)))
# Like the above, but the first revision of the objects are stored in
# different transactions.
- oid1 = self._storage.new_oid()
- oid2 = self._storage.new_oid()
+ oid1 = self._storage.newObjectId()
+ oid2 = self._storage.newObjectId()
revid1 = self._dostore(oid1, data=p31, already_pickled=1)
revid2 = self._dostore(oid2, data=p51, already_pickled=1)
# Update those same two objects
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
self._transaction_begin()
self._transaction_store(oid1, revid1, p32, '', t)
self._transaction_store(oid2, revid2, p52, '', t)
# Finish the transaction
self._transaction_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcFinish(t)
revid1 = self._transaction_newserial(oid1)
revid2 = self._transaction_newserial(oid2)
eq(revid1, revid2)
@@ -345,10 +345,10 @@
info = self._storage.undoInfo()
tid = info[0]['id']
t = Transaction()
- self._storage.tpc_begin(t)
- oids = self._storage.transactionalUndo(tid, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcBegin(t)
+ oids = self._storage.undo(tid, t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
eq(len(oids), 2)
self.failUnless(oid1 in oids)
self.failUnless(oid2 in oids)
@@ -359,13 +359,13 @@
# Like the above, but this time, the second transaction contains only
# one object.
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
self._transaction_begin()
self._transaction_store(oid1, revid1, p33, '', t)
self._transaction_store(oid2, revid2, p53, '', t)
# Finish the transaction
self._transaction_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcFinish(t)
revid1 = self._transaction_newserial(oid1)
revid2 = self._transaction_newserial(oid2)
eq(revid1, revid2)
@@ -376,10 +376,10 @@
info = self._storage.undoInfo()
tid = info[1]['id']
t = Transaction()
- self._storage.tpc_begin(t)
- oids = self._storage.transactionalUndo(tid, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcBegin(t)
+ oids = self._storage.undo(tid, t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
eq(len(oids), 1)
self.failUnless(oid1 in oids)
self.failUnless(not oid2 in oids)
@@ -393,7 +393,7 @@
def checkNotUndoable(self):
eq = self.assertEqual
# Set things up so we've got a transaction that can't be undone
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid_a = self._dostore(oid, data=MinPO(51))
revid_b = self._dostore(oid, revid=revid_a, data=MinPO(52))
revid_c = self._dostore(oid, revid=revid_b, data=MinPO(53))
@@ -401,28 +401,28 @@
info = self._storage.undoInfo()
tid = info[1]['id']
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
self.assertRaises(interfaces.UndoError,
- self._storage.transactionalUndo,
+ self._storage.undo,
tid, t)
- self._storage.tpc_abort(t)
+ self._storage.tpcAbort(t)
# Now have more fun: object1 and object2 are in the same transaction,
# which we'll try to undo to, but one of them has since modified in
# different transaction, so the undo should fail.
oid1 = oid
revid1 = revid_c
- oid2 = self._storage.new_oid()
+ oid2 = self._storage.newObjectId()
revid2 = z64
p81, p82, p91, p92 = map(zodb_pickle,
map(MinPO, (81, 82, 91, 92)))
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
self._transaction_begin()
self._transaction_store(oid1, revid1, p81, '', t)
self._transaction_store(oid2, revid2, p91, '', t)
self._transaction_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcFinish(t)
revid1 = self._transaction_newserial(oid1)
revid2 = self._transaction_newserial(oid2)
eq(revid1, revid2)
@@ -440,17 +440,17 @@
info = self._storage.undoInfo()
tid = info[1]['id']
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
self.assertRaises(interfaces.UndoError,
- self._storage.transactionalUndo,
+ self._storage.undo,
tid, t)
- self._storage.tpc_abort(t)
+ self._storage.tpcAbort(t)
self._iterate()
def checkTransactionalUndoAfterPack(self):
eq = self.assertEqual
# Add a few object revisions
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid1 = self._dostore(oid, data=MinPO(51))
# For the pack(), we need a timestamp greater than revid1's timestamp.
# The semantics of pack()'s `t' argument is that all non-current
@@ -475,10 +475,10 @@
eq(len(info2), 2)
# And now attempt to undo the last transaction
t = Transaction()
- self._storage.tpc_begin(t)
- oids = self._storage.transactionalUndo(tid, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcBegin(t)
+ oids = self._storage.undo(tid, t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
eq(len(oids), 1)
eq(oids[0], oid)
data, revid = self._storage.load(oid, '')
@@ -556,14 +556,14 @@
for i in range(BATCHES):
t = Transaction()
tid = p64(i + 1)
- s.tpc_begin(t, tid)
+ s.tpcBegin(t, tid)
for j in range(OBJECTS):
- oid = s.new_oid()
+ oid = s.newObjectId()
obj = MinPO(i * OBJECTS + j)
revid = s.store(oid, None, zodb_pickle(obj), '', t)
orig.append((tid, oid, revid))
- s.tpc_vote(t)
- s.tpc_finish(t)
+ s.tpcVote(t)
+ s.tpcFinish(t)
i = 0
for tid, oid, revid in orig:
@@ -576,13 +576,13 @@
def undo(i):
info = s.undoInfo()
t = Transaction()
- s.tpc_begin(t)
+ s.tpcBegin(t)
base = i * OBJECTS + i
for j in range(OBJECTS):
tid = info[base + j]['id']
- s.transactionalUndo(tid, t)
- s.tpc_vote(t)
- s.tpc_finish(t)
+ s.undo(tid, t)
+ s.tpcVote(t)
+ s.tpcFinish(t)
for i in range(BATCHES):
undo(i)
@@ -592,13 +592,13 @@
# OBJECTS * BATCHES modifications, followed by
# BATCHES undos
- iter = s.iterator()
+ fsiter = iter(s.iterator())
offset = 0
eq = self.assertEqual
for i in range(BATCHES):
- txn = iter[offset]
+ txn = fsiter.next()
offset += 1
tid = p64(i + 1)
@@ -611,12 +611,12 @@
eq(L1, L2)
for i in range(BATCHES * OBJECTS):
- txn = iter[offset]
+ txn = fsiter.next()
offset += 1
eq(len([rec for rec in txn if rec.data_txn is None]), 1)
for i in range(BATCHES):
- txn = iter[offset]
+ txn = fsiter.next()
offset += 1
# The undos are performed in reverse order.
@@ -628,4 +628,4 @@
L2.sort()
eq(L1, L2)
- self.assertRaises(IndexError, iter.__getitem__, offset)
+ self.assertRaises(StopIteration, fsiter.next)
=== Zope3/src/zodb/storage/tests/timeiter.py 1.2 => 1.3 ===
--- Zope3/src/zodb/storage/tests/timeiter.py:1.2 Wed Dec 25 09:12:20 2002
+++ Zope3/src/zodb/storage/tests/timeiter.py Wed Feb 5 18:28:27 2003
@@ -234,7 +234,7 @@
objects = 0
size = 0
t0 = time.time()
- dstdb.tpc_begin(txn, tid, txn.status)
+ dstdb.tpcBegin(txn, tid, txn.status)
t1 = time.time()
try:
for r in txn:
@@ -254,13 +254,13 @@
newrevid = dstdb.store(oid, oldrevid, r.data, r.version, txn)
prevrevids[oid] = newrevid
t2 = time.time()
- dstdb.tpc_vote(txn)
+ dstdb.tpcVote(txn)
t3 = time.time()
# Profile every 100 transactions
if prof:
- prof.runcall(dstdb.tpc_finish, txn)
+ prof.runcall(dstdb.tpcFinish, txn)
else:
- dstdb.tpc_finish(txn)
+ dstdb.tpcFinish(txn)
t4 = time.time()
except KeyError, e:
traceback.print_exc(file=logfp)
=== Zope3/src/zodb/storage/tests/test_whitebox.py 1.6 => 1.7 ===
--- Zope3/src/zodb/storage/tests/test_whitebox.py:1.6 Mon Jan 27 15:44:41 2003
+++ Zope3/src/zodb/storage/tests/test_whitebox.py Wed Feb 5 18:28:27 2003
@@ -40,7 +40,7 @@
def checkTableConsistencyAfterCommit(self):
unless = self.failIf
eq = self.assertEqual
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid1 = self._dostore(oid, data=11)
revid2 = self._dostore(oid, revid=revid1, data=12)
revid3 = self._dostore(oid, revid=revid2, data=13)
=== Zope3/src/zodb/storage/tests/test_storage_api.py 1.5 => 1.6 ===
--- Zope3/src/zodb/storage/tests/test_storage_api.py:1.5 Mon Feb 3 18:00:44 2003
+++ Zope3/src/zodb/storage/tests/test_storage_api.py Wed Feb 5 18:28:27 2003
@@ -36,8 +36,8 @@
class MinimalTest(bdbmixin.MinimalTestBase, BasicStorage):
def checkVersionedStoreAndLoad(self):
# This storage doesn't support versions, so we should get an exception
- oid = self._storage.new_oid()
- self.assertRaises(interfaces.Unsupported,
+ oid = self._storage.newObjectId()
+ self.assertRaises(NotImplementedError,
self._dostore,
oid, data=11, version='a version')
=== Zope3/src/zodb/storage/tests/test_file.py 1.5 => 1.6 ===
--- Zope3/src/zodb/storage/tests/test_file.py:1.5 Mon Feb 3 18:00:44 2003
+++ Zope3/src/zodb/storage/tests/test_file.py Wed Feb 5 18:28:27 2003
@@ -15,7 +15,7 @@
import sys, os, unittest
import errno
from zodb.ztransaction import Transaction
-from zodb import interfaces
+from zodb.storage.interfaces import *
from zodb.storage.tests import base, basic, conflict, corruption, history, \
iterator, mt, packable, persistent, readonly, recovery, revision, \
@@ -75,13 +75,13 @@
s = "X" * 75000
try:
self._dostore(user=s)
- except interfaces.StorageError:
+ except StorageError:
pass
else:
self.fail("expect long user field to raise error")
try:
self._dostore(description=s)
- except interfaces.StorageError:
+ except StorageError:
pass
else:
self.fail("expect long user field to raise error")
=== Zope3/src/zodb/storage/tests/test_create.py 1.5 => 1.6 ===
--- Zope3/src/zodb/storage/tests/test_create.py:1.5 Mon Jan 27 11:08:23 2003
+++ Zope3/src/zodb/storage/tests/test_create.py Wed Feb 5 18:28:27 2003
@@ -44,7 +44,7 @@
class FullOpenExistingTest(bdbmixin.FullTestBase):
def testOpenWithExistingVersions(self):
version = 'test-version'
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid = self._dostore(oid, data=7, version=version)
# Now close the current storage and re-open it
self._storage.close()
@@ -54,7 +54,7 @@
def testOpenAddVersion(self):
eq = self.assertEqual
version1 = 'test-version'
- oid1 = self._storage.new_oid()
+ oid1 = self._storage.newObjectId()
revid = self._dostore(oid1, data=7, version=version1)
# Now close the current storage and re-open it
self._storage.close()
@@ -62,7 +62,7 @@
eq(self._storage.modifiedInVersion(oid1), version1)
# Now create a 2nd version string, then close/reopen
version2 = 'new-version'
- oid2 = self._storage.new_oid()
+ oid2 = self._storage.newObjectId()
revid = self._dostore(oid2, data=8, version=version2)
# Now close the current storage and re-open it
self._storage.close()
=== Zope3/src/zodb/storage/tests/test_autopack.py 1.8 => 1.9 ===
--- Zope3/src/zodb/storage/tests/test_autopack.py:1.8 Thu Jan 30 18:26:10 2003
+++ Zope3/src/zodb/storage/tests/test_autopack.py Wed Feb 5 18:28:27 2003
@@ -73,7 +73,7 @@
# all three revisions still exist. Then sleep 10 seconds and wait for
# another autopack operation. Then verify that the first two
# revisions have been packed away.
- oid = storage.new_oid()
+ oid = storage.newObjectId()
self._wait_for_next_autopack()
revid1 = self._dostore(oid, data=MinPO(2112))
revid2 = self._dostore(oid, revid=revid1, data=MinPO(2113))
@@ -115,7 +115,7 @@
# all three revisions still exist. Then sleep 10 seconds and wait for
# another autopack operation. Then verify that the first two
# revisions have been packed away.
- oid = storage.new_oid()
+ oid = storage.newObjectId()
self._wait_for_next_autopack()
revid1 = self._dostore(oid, data=MinPO(2112))
revid2 = self._dostore(oid, revid=revid1, data=MinPO(2113))
@@ -286,7 +286,7 @@
# < packtime, but it won't be root reachable yet.
obj2 = C()
t = Transaction()
- storage.tpc_begin(t)
+ storage.tpcBegin(t)
obj2sn = storage.store('\0'*7 + '\2', ZERO, zodb_pickle(obj2), '', t)
# Now, acquire the condvar lock and start a thread that will do a
# pack, up to the _sweep call. Wait for the _mark() call to
@@ -303,8 +303,8 @@
root.obj2 = obj2
rootsn = storage.getSerial(ZERO)
rootsn = storage.store(ZERO, rootsn, zodb_pickle(root), '', t)
- storage.tpc_vote(t)
- storage.tpc_finish(t)
+ storage.tpcVote(t)
+ storage.tpcFinish(t)
# And notify the pack thread that it can do the sweep and collect
self._cv.notify()
self._cv.wait()
@@ -338,7 +338,7 @@
# < packtime, but it won't be root reachable yet.
obj2 = C()
t = Transaction()
- storage.tpc_begin(t)
+ storage.tpcBegin(t)
# Now, acquire the condvar lock and start a thread that will do a
# pack, up to the _sweep call. Wait for the _mark() call to
# complete.
@@ -355,8 +355,8 @@
root.obj2 = obj2
rootsn = storage.getSerial(ZERO)
rootsn = storage.store(ZERO, rootsn, zodb_pickle(root), '', t)
- storage.tpc_vote(t)
- storage.tpc_finish(t)
+ storage.tpcVote(t)
+ storage.tpcFinish(t)
# And notify the pack thread that it can do the sweep and collect
self._cv.notify()
self._cv.wait()
=== Zope3/src/zodb/storage/tests/synchronization.py 1.3 => 1.4 ===
--- Zope3/src/zodb/storage/tests/synchronization.py:1.3 Wed Jan 22 15:38:25 2003
+++ Zope3/src/zodb/storage/tests/synchronization.py Wed Feb 5 18:28:27 2003
@@ -62,7 +62,7 @@
from zodb.storage.base import ZERO
from zodb.ztransaction import Transaction
-from zodb.interfaces import StorageTransactionError
+from zodb.storage.interfaces import StorageTransactionError
VERSION = "testversion"
OID = ZERO
@@ -80,9 +80,9 @@
def verifyWrongTrans(self, callable, *args):
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
self.assertRaises(StorageTransactionError, callable, *args)
- self._storage.tpc_abort(t)
+ self._storage.tpcAbort(t)
def checkAbortVersionNotCommitting(self):
self.verifyNotCommitting(self._storage.abortVersion,
@@ -117,29 +117,29 @@
def checkAbortNotCommitting(self):
- self._storage.tpc_abort(Transaction())
+ self._storage.tpcAbort(Transaction())
def checkAbortWrongTrans(self):
t = Transaction()
- self._storage.tpc_begin(t)
- self._storage.tpc_abort(Transaction())
- self._storage.tpc_abort(t)
+ self._storage.tpcBegin(t)
+ self._storage.tpcAbort(Transaction())
+ self._storage.tpcAbort(t)
def checkFinishNotCommitting(self):
t = Transaction()
- self._storage.tpc_finish(t)
- self._storage.tpc_abort(t)
+ self._storage.tpcFinish(t)
+ self._storage.tpcAbort(t)
def checkFinishWrongTrans(self):
t = Transaction()
- self._storage.tpc_begin(t)
- self._storage.tpc_finish(Transaction())
- self._storage.tpc_abort(t)
+ self._storage.tpcBegin(t)
+ self._storage.tpcFinish(Transaction())
+ self._storage.tpcAbort(t)
def checkBeginCommitting(self):
t = Transaction()
- self._storage.tpc_begin(t)
- self._storage.tpc_begin(t)
- self._storage.tpc_abort(t)
+ self._storage.tpcBegin(t)
+ self._storage.tpcBegin(t)
+ self._storage.tpcAbort(t)
# XXX how to check undo?
=== Zope3/src/zodb/storage/tests/revision.py 1.3 => 1.4 ===
--- Zope3/src/zodb/storage/tests/revision.py:1.3 Wed Jan 22 15:36:32 2003
+++ Zope3/src/zodb/storage/tests/revision.py Wed Feb 5 18:28:27 2003
@@ -23,7 +23,7 @@
class RevisionStorage:
def checkLoadSerial(self):
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid = ZERO
revisions = {}
for i in range(31, 38):
=== Zope3/src/zodb/storage/tests/recovery.py 1.3 => 1.4 ===
--- Zope3/src/zodb/storage/tests/recovery.py:1.3 Wed Jan 22 15:35:09 2003
+++ Zope3/src/zodb/storage/tests/recovery.py Wed Feb 5 18:28:27 2003
@@ -28,7 +28,7 @@
class RecoveryStorage(IteratorDeepCompare):
# Requires a setUp() that creates a self._dst destination storage
def checkSimpleRecovery(self):
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid = self._dostore(oid, data=11)
revid = self._dostore(oid, revid=revid, data=12)
revid = self._dostore(oid, revid=revid, data=13)
@@ -36,31 +36,31 @@
self.compare(self._storage, self._dst)
def checkRecoveryAcrossVersions(self):
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid = self._dostore(oid, data=21)
revid = self._dostore(oid, revid=revid, data=22)
revid = self._dostore(oid, revid=revid, data=23, version='one')
revid = self._dostore(oid, revid=revid, data=34, version='one')
# Now commit the version
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
self._storage.commitVersion('one', '', t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
self._dst.copyTransactionsFrom(self._storage)
self.compare(self._storage, self._dst)
def checkRecoverAbortVersion(self):
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid = self._dostore(oid, data=21, version="one")
revid = self._dostore(oid, revid=revid, data=23, version='one')
revid = self._dostore(oid, revid=revid, data=34, version='one')
# Now abort the version and the creation
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
oids = self._storage.abortVersion('one', t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
self.assertEqual(oids, [oid])
self._dst.copyTransactionsFrom(self._storage)
self.compare(self._storage, self._dst)
@@ -68,16 +68,17 @@
# with None for its data attribute, because we've undone the
# object.
for s in self._storage, self._dst:
- iter = s.iterator()
- for trans in iter:
+ siter = s.iterator()
+ for trans in siter:
pass # iterate until we get the last one
- data = trans[0]
- self.assertRaises(IndexError, lambda i, t=trans: t[i], 1)
+ txniter = iter(trans)
+ data = txniter.next()
+ self.assertRaises(StopIteration, txniter.next)
self.assertEqual(data.oid, oid)
self.assertEqual(data.data, None)
def checkRecoverUndoInVersion(self):
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
version = "aVersion"
revid_a = self._dostore(oid, data=MinPO(91))
revid_b = self._dostore(oid, revid=revid_a, version=version,
@@ -150,9 +151,9 @@
# copy the final transaction manually. even though there
# was a pack, the restore() ought to succeed.
final = list(self._storage.iterator())[-1]
- self._dst.tpc_begin(final, final.tid, final.status)
+ self._dst.tpcBegin(final, final.tid, final.status)
for r in final:
self._dst.restore(r.oid, r.serial, r.data, r.version, r.data_txn,
final)
- self._dst.tpc_vote(final)
- self._dst.tpc_finish(final)
+ self._dst.tpcVote(final)
+ self._dst.tpcFinish(final)
=== Zope3/src/zodb/storage/tests/readonly.py 1.3 => 1.4 ===
--- Zope3/src/zodb/storage/tests/readonly.py:1.3 Wed Jan 22 15:25:51 2003
+++ Zope3/src/zodb/storage/tests/readonly.py Wed Feb 5 18:28:27 2003
@@ -13,7 +13,7 @@
##############################################################################
from zodb.storage.base import ZERO
-from zodb.interfaces import ReadOnlyError
+from zodb.storage.interfaces import ReadOnlyError, IUndoStorage
from zodb.ztransaction import Transaction
class ReadOnlyStorage:
@@ -21,7 +21,7 @@
# test a read-only storage that already has some data
self.oids = {}
for i in range(10):
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid = self._dostore(oid)
self.oids[oid] = revid
@@ -44,8 +44,8 @@
def checkWriteMethods(self):
self._make_readonly()
t = Transaction()
- self.assertRaises(ReadOnlyError, self._storage.new_oid)
- self.assertRaises(ReadOnlyError, self._storage.tpc_begin, t)
+ self.assertRaises(ReadOnlyError, self._storage.newObjectId)
+ self.assertRaises(ReadOnlyError, self._storage.tpcBegin, t)
self.assertRaises(ReadOnlyError, self._storage.abortVersion,
'', t)
self.assertRaises(ReadOnlyError, self._storage.commitVersion,
@@ -53,6 +53,6 @@
self.assertRaises(ReadOnlyError, self._storage.store,
ZERO, None, '', '', t)
- if self._storage.supportsTransactionalUndo():
- self.assertRaises(ReadOnlyError, self._storage.transactionalUndo,
+ if IUndoStorage.isImplementedBy(self._storage):
+ self.assertRaises(ReadOnlyError, self._storage.undo,
ZERO, t)
=== Zope3/src/zodb/storage/tests/persistent.py 1.2 => 1.3 ===
--- Zope3/src/zodb/storage/tests/persistent.py:1.2 Wed Dec 25 09:12:20 2002
+++ Zope3/src/zodb/storage/tests/persistent.py Wed Feb 5 18:28:27 2003
@@ -18,18 +18,18 @@
def checkUpdatesPersist(self):
oids = []
- def new_oid_wrapper(l=oids, new_oid=self._storage.new_oid):
- oid = new_oid()
+ def new_oid_wrapper(l=oids, newObjectId=self._storage.newObjectId):
+ oid = newObjectId()
l.append(oid)
return oid
- self._storage.new_oid = new_oid_wrapper
+ self._storage.newObjectId = new_oid_wrapper
self._dostore()
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid = self._dostore(oid)
self._dostore(oid, revid, data=8, version='b')
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid = self._dostore(oid, data=1)
revid = self._dostore(oid, revid, data=2)
self._dostore(oid, revid, data=3)
=== Zope3/src/zodb/storage/tests/packable.py 1.3 => 1.4 ===
--- Zope3/src/zodb/storage/tests/packable.py:1.3 Wed Jan 22 15:19:59 2003
+++ Zope3/src/zodb/storage/tests/packable.py Wed Feb 5 18:28:27 2003
@@ -91,7 +91,7 @@
# instance. It asks the storage for a new object id, creates the
# instance with the given oid, populates the cache and returns the
# object.
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
obj = Object(oid)
self._cache[obj.getoid()] = obj
return obj
@@ -130,10 +130,10 @@
p.dump(PersistentDict().__getstate__())
t = Transaction()
t.note("initial database creation")
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
self._storage.store(ZERO, None, file.getvalue(), '', t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
def checkPackEmptyStorage(self):
self._storage.pack(time.time())
=== Zope3/src/zodb/storage/tests/mt.py 1.3 => 1.4 ===
--- Zope3/src/zodb/storage/tests/mt.py:1.3 Wed Jan 22 15:17:30 2003
+++ Zope3/src/zodb/storage/tests/mt.py Wed Feb 5 18:28:27 2003
@@ -109,7 +109,7 @@
time.sleep(self.delay)
def oid(self):
- oid = self.storage.new_oid()
+ oid = self.storage.newObjectId()
self.oids[oid] = None
return oid
@@ -119,17 +119,17 @@
oid = self.oid()
self.pause()
- self.storage.tpc_begin(t)
+ self.storage.tpcBegin(t)
self.pause()
# Always create a new object, signified by None for revid
r1 = self.storage.store(oid, None, data, '', t)
self.pause()
- r2 = self.storage.tpc_vote(t)
+ r2 = self.storage.tpcVote(t)
self.pause()
- self.storage.tpc_finish(t)
+ self.storage.tpcFinish(t)
self.pause()
revid = handle_serials(oid, r1, r2)
=== Zope3/src/zodb/storage/tests/iterator.py 1.3 => 1.4 ===
--- Zope3/src/zodb/storage/tests/iterator.py:1.3 Wed Jan 22 15:10:04 2003
+++ Zope3/src/zodb/storage/tests/iterator.py Wed Feb 5 18:28:27 2003
@@ -21,7 +21,7 @@
from zodb.ztransaction import Transaction
from zodb.storage.tests.minpo import MinPO
from zodb.storage.tests.base import zodb_unpickle
-
+from zodb.storage.interfaces import IUndoStorage
class IteratorCompare:
@@ -39,46 +39,46 @@
val += 1
eq(val, val0 + len(revids))
-
class IteratorStorage(IteratorCompare):
def checkSimpleIteration(self):
# Store a bunch of revisions of a single object
- self._oid = oid = self._storage.new_oid()
+ self._oid = oid = self._storage.newObjectId()
revid1 = self._dostore(oid, data=MinPO(11))
revid2 = self._dostore(oid, revid=revid1, data=MinPO(12))
revid3 = self._dostore(oid, revid=revid2, data=MinPO(13))
# Now iterate over all the transactions and compare carefully
txniter = self._storage.iterator()
self.iter_verify(txniter, [revid1, revid2, revid3], 11)
+ txniter.close()
def checkClose(self):
- self._oid = oid = self._storage.new_oid()
+ self._oid = oid = self._storage.newObjectId()
revid1 = self._dostore(oid, data=MinPO(11))
txniter = self._storage.iterator()
txniter.close()
- self.assertRaises(IOError, txniter.__getitem__, 0)
+ self.assertRaises(IOError, iter(txniter).next)
def checkVersionIterator(self):
- if not self._storage.supportsVersions():
+ if not IUndoStorage.isImplementedBy(self._storage):
return
self._dostore()
self._dostore(version='abort')
self._dostore()
self._dostore(version='abort')
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
self._storage.abortVersion('abort', t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
self._dostore(version='commit')
self._dostore()
self._dostore(version='commit')
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
self._storage.commitVersion('commit', '', t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
txniter = self._storage.iterator()
for trans in txniter:
@@ -86,22 +86,20 @@
pass
def checkUndoZombieNonVersion(self):
- if not hasattr(self._storage, 'supportsTransactionalUndo'):
- return
- if not self._storage.supportsTransactionalUndo():
+ if not IUndoStorage.isImplementedBy(self._storage):
return
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid = self._dostore(oid, data=MinPO(94))
# Get the undo information
info = self._storage.undoInfo()
tid = info[0]['id']
# Undo the creation of the object, rendering it a zombie
t = Transaction()
- self._storage.tpc_begin(t)
- oids = self._storage.transactionalUndo(tid, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcBegin(t)
+ oids = self._storage.undo(tid, t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
# Now attempt to iterator over the storage
iter = self._storage.iterator()
for txn in iter:
@@ -116,7 +114,7 @@
self.assertEqual(rec.data, None)
def checkTransactionExtensionFromIterator(self):
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid = self._dostore(oid, data=MinPO(1))
iter = self._storage.iterator()
count = 0
@@ -130,7 +128,7 @@
def checkExtendedIteration(self):
# Store a bunch of revisions of a single object
- self._oid = oid = self._storage.new_oid()
+ self._oid = oid = self._storage.newObjectId()
revid1 = self._dostore(oid, data=MinPO(11))
revid2 = self._dostore(oid, revid=revid1, data=MinPO(12))
revid3 = self._dostore(oid, revid=revid2, data=MinPO(13))
@@ -172,22 +170,20 @@
eq = self.assertEqual
iter1 = storage1.iterator()
iter2 = storage2.iterator()
- for txn1, txn2 in zip(iter1, iter2):
+ L1 = list(iter1)
+ L2 = list(iter2)
+ eq(len(L1), len(L2))
+ for txn1, txn2 in zip(L1, L2):
eq(txn1.tid, txn2.tid)
eq(txn1.status, txn2.status)
eq(txn1.user, txn2.user)
eq(txn1.description, txn2.description)
eq(txn1._extension, txn2._extension)
- for rec1, rec2 in zip(txn1, txn2):
+ L1 = list(txn1)
+ L2 = list(txn2)
+ eq(len(L1), len(L2))
+ for rec1, rec2 in zip(L1, L2):
eq(rec1.oid, rec2.oid)
eq(rec1.serial, rec2.serial)
eq(rec1.version, rec2.version)
eq(rec1.data, rec2.data)
- # Make sure there are no more records left in rec1 and rec2,
- # meaning they were the same length.
- self.assertRaises(IndexError, txn1.next)
- self.assertRaises(IndexError, txn2.next)
- # Make sure ther are no more records left in txn1 and txn2, meaning
- # they were the same length
- self.assertRaises(IndexError, iter1.next)
- self.assertRaises(IndexError, iter2.next)
=== Zope3/src/zodb/storage/tests/history.py 1.2 => 1.3 ===
--- Zope3/src/zodb/storage/tests/history.py:1.2 Wed Dec 25 09:12:20 2002
+++ Zope3/src/zodb/storage/tests/history.py Wed Feb 5 18:28:27 2003
@@ -27,7 +27,7 @@
def checkSimpleHistory(self):
eq = self.assertEqual
# Store a couple of non-version revisions of the object
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid1 = self._dostore(oid, data=MinPO(11))
revid2 = self._dostore(oid, revid=revid1, data=MinPO(12))
revid3 = self._dostore(oid, revid=revid2, data=MinPO(13))
@@ -74,7 +74,7 @@
def checkVersionHistory(self):
eq = self.assertEqual
# Store a couple of non-version revisions
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid1 = self._dostore(oid, data=MinPO(11))
revid2 = self._dostore(oid, revid=revid1, data=MinPO(12))
revid3 = self._dostore(oid, revid=revid2, data=MinPO(13))
@@ -112,7 +112,7 @@
def checkHistoryAfterVersionCommit(self):
eq = self.assertEqual
# Store a couple of non-version revisions
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid1 = self._dostore(oid, data=MinPO(11))
revid2 = self._dostore(oid, revid=revid1, data=MinPO(12))
revid3 = self._dostore(oid, revid=revid2, data=MinPO(13))
@@ -126,10 +126,10 @@
version=version)
# Now commit the version
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
oids = self._storage.commitVersion(version, '', t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
# After consultation with Jim, we agreed that the semantics of
# revision id's after a version commit is that the committed object
# gets a new serial number (a.k.a. revision id). Note that
@@ -170,7 +170,7 @@
def checkHistoryAfterVersionAbort(self):
eq = self.assertEqual
# Store a couple of non-version revisions
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid1 = self._dostore(oid, data=MinPO(11))
revid2 = self._dostore(oid, revid=revid1, data=MinPO(12))
revid3 = self._dostore(oid, revid=revid2, data=MinPO(13))
@@ -184,10 +184,10 @@
version=version)
# Now commit the version
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
oids = self._storage.abortVersion(version, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
# After consultation with Jim, we agreed that the semantics of
# revision id's after a version commit is that the committed object
# gets a new serial number (a.k.a. revision id). Note that
=== Zope3/src/zodb/storage/tests/corruption.py 1.3 => 1.4 ===
--- Zope3/src/zodb/storage/tests/corruption.py:1.3 Wed Jan 22 15:02:25 2003
+++ Zope3/src/zodb/storage/tests/corruption.py Wed Feb 5 18:28:27 2003
@@ -37,7 +37,7 @@
def _do_stores(self):
oids = []
for i in range(5):
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid = self._dostore(oid)
oids.append((oid, revid))
return oids
=== Zope3/src/zodb/storage/tests/conflict.py 1.3 => 1.4 ===
--- Zope3/src/zodb/storage/tests/conflict.py:1.3 Wed Jan 22 14:57:24 2003
+++ Zope3/src/zodb/storage/tests/conflict.py Wed Feb 5 18:28:27 2003
@@ -63,7 +63,7 @@
obj = RPCounter()
obj.inc()
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid1 = self._dostoreNP(oid, data=zodb_pickle(obj))
@@ -86,7 +86,7 @@
obj = PCounter()
obj.inc()
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid1 = self._dostoreNP(oid, data=zodb_pickle(obj))
@@ -105,7 +105,7 @@
obj = PCounter2()
obj.inc()
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid1 = self._dostoreNP(oid, data=zodb_pickle(obj))
@@ -123,7 +123,7 @@
obj = PCounter3()
obj.inc()
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid1 = self._dostoreNP(oid, data=zodb_pickle(obj))
@@ -141,7 +141,7 @@
obj = PCounter4()
obj.inc()
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid1 = self._dostoreNP(oid, data=zodb_pickle(obj))
@@ -164,7 +164,7 @@
obj = RPCounter()
obj.inc()
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid_a = self._dostore(oid, data=obj)
obj.inc()
revid_b = self._dostore(oid, revid=revid_a, data=obj)
@@ -174,9 +174,9 @@
info = self._storage.undoInfo()
tid = info[1]['id']
t = Transaction()
- self._storage.tpc_begin(t)
- self._storage.transactionalUndo(tid, t)
- self._storage.tpc_finish(t)
+ self._storage.tpcBegin(t)
+ self._storage.undo(tid, t)
+ self._storage.tpcFinish(t)
def checkUndoUnresolvable(self):
# This test is based on checkNotUndoable in the
@@ -184,7 +184,7 @@
# resolution should allow us to undo the transaction anyway.
obj = PCounter2()
obj.inc()
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid_a = self._dostore(oid, data=obj)
obj.inc()
revid_b = self._dostore(oid, revid=revid_a, data=obj)
@@ -194,6 +194,6 @@
info = self._storage.undoInfo()
tid = info[1]['id']
t = Transaction()
- self._storage.tpc_begin(t)
- self.assertRaises(UndoError, self._storage.transactionalUndo, tid, t)
- self._storage.tpc_abort(t)
+ self._storage.tpcBegin(t)
+ self.assertRaises(UndoError, self._storage.undo, tid, t)
+ self._storage.tpcAbort(t)
=== Zope3/src/zodb/storage/tests/basic.py 1.5 => 1.6 ===
--- Zope3/src/zodb/storage/tests/basic.py:1.5 Mon Jan 27 11:08:23 2003
+++ Zope3/src/zodb/storage/tests/basic.py Wed Feb 5 18:28:27 2003
@@ -23,16 +23,19 @@
"""
from zodb import interfaces
+from zodb.storage.interfaces import StorageTransactionError, IStorage
from zodb.ztransaction import Transaction
from zodb.storage.base import ZERO
from zodb.storage.tests.minpo import MinPO
-from zodb.storage.tests.base \
- import zodb_unpickle, zodb_pickle, handle_serials
-
+from zodb.storage.tests.base import zodb_unpickle, zodb_pickle, handle_serials
class BasicStorage:
+
+ def checkIStorage(self):
+ self.assert_(IStorage.isImplementedBy(self._storage))
+
def checkDatabaseVersion(self):
version = "abcd"
self._storage.setVersion(version)
@@ -47,52 +50,46 @@
def checkBasics(self):
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
# This should simply return
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
# Aborting is easy
- self._storage.tpc_abort(t)
+ self._storage.tpcAbort(t)
# Test a few expected exceptions when we're doing operations giving a
# different Transaction object than the one we've begun on.
- self._storage.tpc_begin(t)
- self.assertRaises(
- interfaces.StorageTransactionError,
- self._storage.store,
- 0, 0, 0, 0, Transaction())
+ self._storage.tpcBegin(t)
+ self.assertRaises(StorageTransactionError, self._storage.store,
+ 0, 0, 0, 0, Transaction())
try:
self._storage.abortVersion('dummy', Transaction())
- except (interfaces.StorageTransactionError,
- interfaces.VersionCommitError):
+ except (StorageTransactionError, interfaces.VersionCommitError):
pass # test passed ;)
else:
assert 0, "Should have failed, invalid transaction."
try:
self._storage.commitVersion('dummy', 'dummer', Transaction())
- except (interfaces.StorageTransactionError,
- interfaces.VersionCommitError):
+ except (StorageTransactionError, interfaces.VersionCommitError):
pass # test passed ;)
else:
assert 0, "Should have failed, invalid transaction."
- self.assertRaises(
- interfaces.StorageTransactionError,
- self._storage.store,
- 0, 1, 2, 3, Transaction())
- self._storage.tpc_abort(t)
+ self.assertRaises(StorageTransactionError, self._storage.store,
+ 0, 1, 2, 3, Transaction())
+ self._storage.tpcAbort(t)
def checkSerialIsNoneForInitialRevision(self):
eq = self.assertEqual
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
txn = Transaction()
- self._storage.tpc_begin(txn)
+ self._storage.tpcBegin(txn)
# Use None for serial. Don't use _dostore() here because that coerces
# serial=None to serial=ZERO.
r1 = self._storage.store(oid, None, zodb_pickle(MinPO(11)),
'', txn)
- r2 = self._storage.tpc_vote(txn)
- self._storage.tpc_finish(txn)
+ r2 = self._storage.tpcVote(txn)
+ self._storage.tpcFinish(txn)
newrevid = handle_serials(oid, r1, r2)
data, revid = self._storage.load(oid, '')
value = zodb_unpickle(data)
@@ -107,7 +104,7 @@
def checkNonVersionStoreAndLoad(self):
eq = self.assertEqual
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
self._dostore(oid=oid, data=MinPO(7))
data, revid = self._storage.load(oid, '')
value = zodb_unpickle(data)
@@ -120,12 +117,12 @@
eq(zodb_unpickle(data), MinPO(21))
def checkNonVersionModifiedInVersion(self):
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
self._dostore(oid=oid)
self.assertEqual(self._storage.modifiedInVersion(oid), '')
def checkConflicts(self):
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid1 = self._dostore(oid, data=MinPO(11))
revid2 = self._dostore(oid, revid=revid1, data=MinPO(12))
self.assertRaises(interfaces.ConflictError,
@@ -133,28 +130,28 @@
oid, revid=revid1, data=MinPO(13))
def checkWriteAfterAbort(self):
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
self._storage.store(oid, ZERO, zodb_pickle(MinPO(5)), '', t)
# Now abort this transaction
- self._storage.tpc_abort(t)
+ self._storage.tpcAbort(t)
# Now start all over again
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
self._dostore(oid=oid, data=MinPO(6))
def checkAbortAfterVote(self):
- oid1 = self._storage.new_oid()
+ oid1 = self._storage.newObjectId()
revid1 = self._dostore(oid=oid1, data=MinPO(-2))
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
t = Transaction()
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
self._storage.store(oid, ZERO, zodb_pickle(MinPO(5)), '', t)
# Now abort this transaction
- self._storage.tpc_vote(t)
- self._storage.tpc_abort(t)
+ self._storage.tpcVote(t)
+ self._storage.tpcAbort(t)
# Now start all over again
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
revid = self._dostore(oid=oid, data=MinPO(6))
for oid, revid in [(oid1, revid1), (oid, revid)]:
@@ -164,8 +161,8 @@
def checkStoreTwoObjects(self):
noteq = self.assertNotEqual
p31, p32, p51, p52 = map(MinPO, (31, 32, 51, 52))
- oid1 = self._storage.new_oid()
- oid2 = self._storage.new_oid()
+ oid1 = self._storage.newObjectId()
+ oid2 = self._storage.newObjectId()
noteq(oid1, oid2)
revid1 = self._dostore(oid1, data=p31)
revid2 = self._dostore(oid2, data=p51)
@@ -179,7 +176,7 @@
return
eq = self.assertEqual
p41, p42 = map(MinPO, (41, 42))
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
self.assertRaises(KeyError, self._storage.getSerial, oid)
# Now store a revision
revid1 = self._dostore(oid, data=p41)
@@ -192,9 +189,9 @@
# XXX how standard is three-argument tpc_begin()?
t = Transaction()
tid = chr(42) * 8
- self._storage.tpc_begin(t, tid)
- oid = self._storage.new_oid()
+ self._storage.tpcBegin(t, tid)
+ oid = self._storage.newObjectId()
data = zodb_pickle(MinPO(8))
self._storage.store(oid, None, data, '', t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
=== Zope3/src/zodb/storage/tests/base.py 1.5 => 1.6 ===
--- Zope3/src/zodb/storage/tests/base.py:1.5 Mon Jan 27 11:08:23 2003
+++ Zope3/src/zodb/storage/tests/base.py Wed Feb 5 18:28:27 2003
@@ -125,7 +125,7 @@
Returns the object's new revision id.
"""
if oid is None:
- oid = self._storage.new_oid()
+ oid = self._storage.newObjectId()
if revid is None:
revid = ZERO
if data is None:
@@ -143,15 +143,15 @@
if description is not None:
t.description = description
try:
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
# Store an object
r1 = self._storage.store(oid, revid, data, version, t)
# Finish the transaction
- r2 = self._storage.tpc_vote(t)
+ r2 = self._storage.tpcVote(t)
revid = handle_serials(oid, r1, r2)
- self._storage.tpc_finish(t)
+ self._storage.tpcFinish(t)
except:
- self._storage.tpc_abort(t)
+ self._storage.tpcAbort(t)
raise
return revid
@@ -166,10 +166,10 @@
# XXX This is very specialized
t = Transaction()
t.note("undo")
- self._storage.tpc_begin(t)
- oids = self._storage.transactionalUndo(tid, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcBegin(t)
+ oids = self._storage.undo(tid, t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
if oid is not None:
self.assertEqual(len(oids), 1)
self.assertEqual(oids[0], oid)
@@ -178,19 +178,19 @@
def _commitVersion(self, src, dst):
t = Transaction()
t.note("commit %r to %r" % (src, dst))
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
oids = self._storage.commitVersion(src, dst, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
return oids
def _abortVersion(self, ver):
t = Transaction()
t.note("abort %r" % ver)
- self._storage.tpc_begin(t)
+ self._storage.tpcBegin(t)
oids = self._storage.abortVersion(ver, t)
- self._storage.tpc_vote(t)
- self._storage.tpc_finish(t)
+ self._storage.tpcVote(t)
+ self._storage.tpcFinish(t)
return oids