[Zope3-checkins] CVS: Zope3/src/zodb/zeo/tests - threadtests.py:1.3.4.1 test_zeo.py:1.6.4.1 connection.py:1.4.4.2 commitlock.py:1.2.8.1 cache.py:1.2.8.2

Jeremy Hylton jeremy@zope.com
Wed, 5 Feb 2003 12:30:36 -0500


Update of /cvs-repository/Zope3/src/zodb/zeo/tests
In directory cvs.zope.org:/tmp/cvs-serv1081/zeo/tests

Modified Files:
      Tag: storage-interface-branch
	threadtests.py test_zeo.py connection.py commitlock.py 
	cache.py 
Log Message:
Refactor storage interfaces.

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

There may be a few lingering problems in comments, but I think
everything else is converted.



=== Zope3/src/zodb/zeo/tests/threadtests.py 1.3 => 1.3.4.1 ===
--- Zope3/src/zodb/zeo/tests/threadtests.py:1.3	Mon Jan 27 15:09:35 2003
+++ Zope3/src/zodb/zeo/tests/threadtests.py	Wed Feb  5 12:30:02 2003
@@ -48,17 +48,17 @@
     # This class gets does a tpc_begin(), store(), tpc_vote() and is waiting
     # to do the tpc_finish() when the other thread closes the storage.
     def run(self):
-        self.storage.tpc_begin(self.trans)
-        oid = self.storage.new_oid()
+        self.storage.tpcBegin(self.trans)
+        oid = self.storage.newObjectId()
         self.storage.store(oid, ZERO, zodb_pickle(MinPO("c")), '', self.trans)
-        self.storage.tpc_vote(self.trans)
+        self.storage.tpcVote(self.trans)
         self.threadStartedEvent.set()
         self.doNextEvent.wait(10)
         try:
-            self.storage.tpc_finish(self.trans)
+            self.storage.tpcFinish(self.trans)
         except ClientStorageError:
             self.gotValueError = 1
-            self.storage.tpc_abort(self.trans)
+            self.storage.tpcAbort(self.trans)
 
 
 class GetsThroughBeginThread(BasicThread):
@@ -68,7 +68,7 @@
     # that happens, this one will get disconnected too.
     def run(self):
         try:
-            self.storage.tpc_begin(self.trans)
+            self.storage.tpcBegin(self.trans)
         except ClientStorageError:
             self.gotValueError = 1
 
@@ -81,11 +81,11 @@
     # threading module's API).
     def run(self):
         try:
-            self.storage.tpc_begin(self.trans)
+            self.storage.tpcBegin(self.trans)
         except ClientStorageError:
             self.gotValueError = 1
         try:
-            self.storage.tpc_abort(self.trans)
+            self.storage.tpcAbort(self.trans)
         except Disconnected:
             self.gotDisconnected = 1
 


=== Zope3/src/zodb/zeo/tests/test_zeo.py 1.6 => 1.6.4.1 ===
--- Zope3/src/zodb/zeo/tests/test_zeo.py:1.6	Mon Jan 27 11:05:40 2003
+++ Zope3/src/zodb/zeo/tests/test_zeo.py	Wed Feb  5 12:30:02 2003
@@ -61,7 +61,7 @@
         addr = self._storage._addr
         storage2 = ClientStorage(addr, wait=1, min_disconnect_poll=0.1)
         try:
-            oid = self._storage.new_oid()
+            oid = self._storage.newObjectId()
             ob = MinPO('first')
             revid1 = self._dostore(oid, data=ob)
             data, serial = storage2.load(oid, '')


=== Zope3/src/zodb/zeo/tests/connection.py 1.4.4.1 => 1.4.4.2 ===
--- Zope3/src/zodb/zeo/tests/connection.py:1.4.4.1	Tue Feb  4 17:54:18 2003
+++ Zope3/src/zodb/zeo/tests/connection.py	Wed Feb  5 12:30:02 2003
@@ -170,7 +170,7 @@
         for i in range(4):
             self._newAddr()
         self._storage = self.openClientStorage('test', 100000)
-        oid = self._storage.new_oid()
+        oid = self._storage.newObjectId()
         obj = MinPO(12)
         self._dostore(oid, data=obj)
         self._storage.close()
@@ -281,7 +281,7 @@
         # When the server is down, a load() gets the data from its cache.
 
         self._storage = self.openClientStorage('test', 100000)
-        oid = self._storage.new_oid()
+        oid = self._storage.newObjectId()
         obj = MinPO(12)
         revid1 = self._dostore(oid, data=obj)
         self._storage.close()
@@ -299,10 +299,10 @@
         # cache files swap, the first object is effectively uncached.
 
         self._storage = self.openClientStorage('test', 1000)
-        oid1 = self._storage.new_oid()
+        oid1 = self._storage.newObjectId()
         obj1 = MinPO("1" * 500)
         self._dostore(oid1, data=obj1)
-        oid2 = self._storage.new_oid()
+        oid2 = self._storage.newObjectId()
         obj2 = MinPO("2" * 500)
         self._dostore(oid2, data=obj2)
         self._storage.close()
@@ -322,14 +322,14 @@
         # could system reconnect and continue old transaction?
 
         self._storage = self.openClientStorage()
-        oid = self._storage.new_oid()
+        oid = self._storage.newObjectId()
         obj = MinPO(12)
         self._dostore(oid, data=obj)
         self.logger.warn("checkReconnection: About to shutdown server")
         self.shutdownServer()
         self.logger.warn("checkReconnection: About to restart server")
         self.startServer(create=False)
-        oid = self._storage.new_oid()
+        oid = self._storage.newObjectId()
         obj = MinPO(12)
         while 1:
             try:
@@ -595,12 +595,12 @@
             t = Transaction()
             for c in clients:
                 #print "%s.%s.%s begin\n" % (tname, c.__name, i),
-                c.tpc_begin(t)
+                c.tpcBegin(t)
 
             for j in range(testcase.nobj):
                 for c in clients:
                     # Create and store a new object on each server
-                    oid = c.new_oid()
+                    oid = c.newObjectId()
                     c.__oids.append(oid)
                     data = MinPO("%s.%s.t%d.o%d" % (tname, c.__name, i, j))
                     #print data.value
@@ -611,13 +611,13 @@
             # Vote on all servers and handle serials
             for c in clients:
                 #print "%s.%s.%s vote\n" % (tname, c.__name, i),
-                s = c.tpc_vote(t)
+                s = c.tpcVote(t)
                 c.__serials.update(handle_all_serials(None, s))
 
             # Finish on all servers
             for c in clients:
                 #print "%s.%s.%s finish\n" % (tname, c.__name, i),
-                c.tpc_finish(t)
+                c.tpcFinish(t)
 
             for c in clients:
                 # Check that we got serials for all oids


=== Zope3/src/zodb/zeo/tests/commitlock.py 1.2 => 1.2.8.1 ===
--- Zope3/src/zodb/zeo/tests/commitlock.py:1.2	Wed Dec 25 09:12:22 2002
+++ Zope3/src/zodb/zeo/tests/commitlock.py	Wed Feb  5 12:30:02 2003
@@ -67,19 +67,19 @@
 
     def testrun(self):
         try:
-            self.storage.tpc_begin(self.trans)
-            oid = self.storage.new_oid()
+            self.storage.tpcBegin(self.trans)
+            oid = self.storage.newObjectId()
             p = zodb_pickle(MinPO("c"))
             self.storage.store(oid, ZERO, p, '', self.trans)
-            oid = self.storage.new_oid()
+            oid = self.storage.newObjectId()
             p = zodb_pickle(MinPO("c"))
             self.storage.store(oid, ZERO, p, '', self.trans)
             self.ready.set()
-            self.storage.tpc_vote(self.trans)
+            self.storage.tpcVote(self.trans)
             if self.method == "tpc_finish":
-                self.storage.tpc_finish(self.trans)
+                self.storage.tpcFinish(self.trans)
             else:
-                self.storage.tpc_abort(self.trans)
+                self.storage.tpcAbort(self.trans)
         except Disconnected:
             pass
 
@@ -124,7 +124,7 @@
 
     def _cleanup(self):
         for store, trans in self._storages:
-            store.tpc_abort(trans)
+            store.tpcAbort(trans)
             store.close()
         self._storages = []
 
@@ -149,10 +149,10 @@
 
         # Start on transaction normally and get the lock.
         t = Transaction()
-        self._storage.tpc_begin(t)
-        oid = self._storage.new_oid()
+        self._storage.tpcBegin(t)
+        oid = self._storage.newObjectId()
         self._storage.store(oid, ZERO, zodb_pickle(MinPO(1)), '', t)
-        self._storage.tpc_vote(t)
+        self._storage.tpcVote(t)
 
         # Start a second transaction on a different connection without
         # blocking the test thread.
@@ -168,10 +168,10 @@
                 self._storages.append((storage2, t2))
 
         if method_name == "tpc_finish":
-            self._storage.tpc_finish(t)
+            self._storage.tpcFinish(t)
             self._storage.load(oid, '')
         else:
-            self._storage.tpc_abort(t)
+            self._storage.tpcAbort(t)
 
         dowork(method_name)
 
@@ -179,17 +179,17 @@
         self._dostore()
 
     def _dosetup1(self, storage, trans, tid):
-        storage.tpc_begin(trans, tid)
+        storage.tpcBegin(trans, tid)
 
     def _dowork1(self, method_name):
         for store, trans in self._storages:
-            oid = store.new_oid()
+            oid = store.newObjectId()
             store.store(oid, ZERO, zodb_pickle(MinPO("c")), '', trans)
-            store.tpc_vote(trans)
+            store.tpcVote(trans)
             if method_name == "tpc_finish":
-                store.tpc_finish(trans)
+                store.tpcFinish(trans)
             else:
-                store.tpc_abort(trans)
+                store.tpcAbort(trans)
 
     def _dosetup2(self, storage, trans, tid):
         self._threads = []


=== Zope3/src/zodb/zeo/tests/cache.py 1.2.8.1 => 1.2.8.2 ===
--- Zope3/src/zodb/zeo/tests/cache.py:1.2.8.1	Tue Feb  4 17:54:18 2003
+++ Zope3/src/zodb/zeo/tests/cache.py	Wed Feb  5 12:30:02 2003
@@ -21,7 +21,7 @@
 class TransUndoStorageWithCache:
 
     def checkUndoInvalidation(self):
-        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))
@@ -41,15 +41,15 @@
         # Now start an undo transaction
         t = Transaction()
         t.note('undo1')
-        self._storage.tpc_begin(t)
+        self._storage.tpcBegin(t)
 
-        oids = self._storage.transactionalUndo(tid, t)
+        oids = self._storage.undo(tid, t)
 
         # Make sure this doesn't load invalid data into the cache
         self._storage.load(oid, '')
 
-        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,47 +60,47 @@
 class StorageWithCache:
 
     def checkAbortVersionInvalidation(self):
-        oid = self._storage.new_oid()
+        oid = self._storage.newObjectId()
         revid = self._dostore(oid, data=MinPO(1))
         revid = self._dostore(oid, revid=revid, data=MinPO(2))
         revid = self._dostore(oid, revid=revid, data=MinPO(3), version="foo")
         revid = self._dostore(oid, revid=revid, data=MinPO(4), version="foo")
         t = Transaction()
-        self._storage.tpc_begin(t)
+        self._storage.tpcBegin(t)
         self._storage.abortVersion("foo", t)
         self._storage.load(oid, "foo")
-        self._storage.tpc_vote(t)
-        self._storage.tpc_finish(t)
+        self._storage.tpcVote(t)
+        self._storage.tpcFinish(t)
         data, revid = self._storage.load(oid, "foo")
         obj = zodb_unpickle(data)
         assert obj == MinPO(2), obj
 
     def checkCommitEmptyVersionInvalidation(self):
-        oid = self._storage.new_oid()
+        oid = self._storage.newObjectId()
         revid = self._dostore(oid, data=MinPO(1))
         revid = self._dostore(oid, revid=revid, data=MinPO(2))
         revid = self._dostore(oid, revid=revid, data=MinPO(3), version="foo")
         t = Transaction()
-        self._storage.tpc_begin(t)
+        self._storage.tpcBegin(t)
         self._storage.commitVersion("foo", "", t)
         self._storage.load(oid, "")
-        self._storage.tpc_vote(t)
-        self._storage.tpc_finish(t)
+        self._storage.tpcVote(t)
+        self._storage.tpcFinish(t)
         data, revid = self._storage.load(oid, "")
         obj = zodb_unpickle(data)
         assert obj == MinPO(3), obj
 
     def checkCommitVersionInvalidation(self):
-        oid = self._storage.new_oid()
+        oid = self._storage.newObjectId()
         revid = self._dostore(oid, data=MinPO(1))
         revid = self._dostore(oid, revid=revid, data=MinPO(2))
         revid = self._dostore(oid, revid=revid, data=MinPO(3), version="foo")
         t = Transaction()
-        self._storage.tpc_begin(t)
+        self._storage.tpcBegin(t)
         self._storage.commitVersion("foo", "bar", t)
         self._storage.load(oid, "")
-        self._storage.tpc_vote(t)
-        self._storage.tpc_finish(t)
+        self._storage.tpcVote(t)
+        self._storage.tpcFinish(t)
         data, revid = self._storage.load(oid, "bar")
         obj = zodb_unpickle(data)
         assert obj == MinPO(3), obj