[Zodb-checkins] CVS: Zope3/src/zodb - serialize.py:1.7.4.1 export.py:1.3.4.1 db.py:1.6.4.2 connection.py:1.6.4.1

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


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

Modified Files:
      Tag: storage-interface-branch
	serialize.py export.py db.py connection.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/serialize.py 1.7 => 1.7.4.1 ===
--- Zope3/src/zodb/serialize.py:1.7	Tue Jan 28 11:42:25 2003
+++ Zope3/src/zodb/serialize.py	Wed Feb  5 12:30:11 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._stornewObjectId_oid()
+            self._created.add(newObjectId)
+            self._cache[oid] = new_ref = newObjectId, classmeta
         return CopyReference(new_ref)
 
     def readPickle(self, pickle):


=== Zope3/src/zodb/export.py 1.3 => 1.3.4.1 ===
--- Zope3/src/zodb/export.py:1.3	Tue Jan 28 11:42:25 2003
+++ Zope3/src/zodb/export.py	Wed Feb  5 12:30:11 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._stornewObjectId_oid()
+                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/db.py 1.6.4.1 => 1.6.4.2 ===
--- Zope3/src/zodb/db.py:1.6.4.1	Tue Feb  4 17:54:09 2003
+++ Zope3/src/zodb/db.py	Wed Feb  5 12:30:11 2003
@@ -82,10 +82,10 @@
         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:
         if IUndoStorage.isImplementedBy(storage):
@@ -338,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
@@ -349,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
@@ -403,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/connection.py 1.6 => 1.6.4.1 ===
--- Zope3/src/zodb/connection.py:1.6	Tue Jan 28 13:17:30 2003
+++ Zope3/src/zodb/connection.py	Wed Feb  5 12:30:11 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: