[Zope3-checkins] CVS: Zope3/src/zodb/storage - interfaces.py:1.3.2.2 fsrecover.py:1.2.8.1 file.py:1.7.4.2 bdbfull.py:1.10.4.2 base.py:1.11.4.2

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


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

Modified Files:
      Tag: storage-interface-branch
	interfaces.py fsrecover.py file.py bdbfull.py base.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/storage/interfaces.py 1.3.2.1 => 1.3.2.2 ===
--- Zope3/src/zodb/storage/interfaces.py:1.3.2.1	Tue Feb  4 17:54:11 2003
+++ Zope3/src/zodb/storage/interfaces.py	Wed Feb  5 12:30:10 2003
@@ -125,7 +125,7 @@
         """
         pass
 
-    def new_oid():
+    def newObjectId():
         pass
 
     def registerDB(db):
@@ -134,12 +134,6 @@
     def isReadOnly():
         pass
 
-    def supportsUndo():
-        pass
-
-    def supportsVersions():
-        pass
-
     def getExtensionMethods():
         pass
 
@@ -154,27 +148,16 @@
 
     # two-phase commit
 
-    def tpc_begin(txn):
-        pass
-
-    def tpc_vote(txn):
+    def tpcBegin(txn):
         pass
 
-    def tpc_finish(txn):
-        pass
-
-    def tpc_abort(txn):
-        pass
-
-    # storages that keep revisions
-
-    def transactionalUndo(txnid, txn):
+    def tpcVote(txn):
         pass
 
-    def undoInfo(first=0, last=-20, specification=None):
+    def tpcFinish(txn):
         pass
 
-    def undoLog(first, last, filter=None):
+    def tpcAbort(txn):
         pass
 
     def pack(t):
@@ -191,7 +174,7 @@
     def loadSerial(oid, serial):
         pass
     
-    def transactionalUndo(txnid, txn):
+    def undo(txnid, txn):
         pass
 
     def undoInfo(first=0, last=-20, specification=None):


=== Zope3/src/zodb/storage/fsrecover.py 1.2 => 1.2.8.1 ===
--- Zope3/src/zodb/storage/fsrecover.py:1.2	Wed Dec 25 09:12:19 2002
+++ Zope3/src/zodb/storage/fsrecover.py	Wed Feb  5 12:30:10 2003
@@ -269,7 +269,7 @@
             if verbose > 1: print
             sys.stdout.flush()
 
-        ofs.tpc_begin(transaction, tid, transaction.status)
+        ofs.tpcBegin(transaction, tid, transaction.status)
 
         if verbose:
             print 'begin', pos, _ts,
@@ -288,17 +288,17 @@
         except:
             if partial and nrec:
                 ofs._status='p'
-                ofs.tpc_vote(transaction)
-                ofs.tpc_finish(transaction)
+                ofs.tpcVote(transaction)
+                ofs.tpcFinish(transaction)
                 if verbose: print 'partial'
             else:
-                ofs.tpc_abort(transaction)
+                ofs.tpcAbort(transaction)
             print "\n%s: %s\n" % sys.exc_info()[:2]
             if not verbose: progress(prog1)
             pos = scan(file, pos, file_size)
         else:
-            ofs.tpc_vote(transaction)
-            ofs.tpc_finish(transaction)
+            ofs.tpcVote(transaction)
+            ofs.tpcFinish(transaction)
             if verbose:
                 print 'finish'
                 sys.stdout.flush()


=== Zope3/src/zodb/storage/file.py 1.7.4.1 => 1.7.4.2 ===
--- Zope3/src/zodb/storage/file.py:1.7.4.1	Tue Feb  4 17:54:11 2003
+++ Zope3/src/zodb/storage/file.py	Wed Feb  5 12:30:10 2003
@@ -1032,7 +1032,7 @@
                 raise FileStorageError('too much extension data')
 
 
-    def tpc_vote(self, transaction):
+    def tpcVote(self, transaction):
         self._lock_acquire()
         try:
             if transaction is not self._transaction:
@@ -1260,7 +1260,7 @@
         finally:
             self._lock_release()
 
-    def transactionalUndo(self, transaction_id, transaction):
+    def undo(self, transaction_id, transaction):
         """Undo a transaction, given by transaction_id.
 
         Do so by writing new data that reverses the action taken by


=== Zope3/src/zodb/storage/bdbfull.py 1.10.4.1 => 1.10.4.2 ===
--- Zope3/src/zodb/storage/bdbfull.py:1.10.4.1	Tue Feb  4 17:54:11 2003
+++ Zope3/src/zodb/storage/bdbfull.py	Wed Feb  5 12:30:10 2003
@@ -1186,7 +1186,7 @@
             self._objrevs.put(newserial+oid, prevrevid, txn=txn)
         return rtnoids.keys()
 
-    def transactionalUndo(self, tid, transaction):
+    def undo(self, tid, transaction):
         if transaction is not self._transaction:
             raise StorageTransactionError(self, transaction)
         self._lock_acquire()


=== Zope3/src/zodb/storage/base.py 1.11.4.1 => 1.11.4.2 ===
--- Zope3/src/zodb/storage/base.py:1.11.4.1	Tue Feb  4 17:54:11 2003
+++ Zope3/src/zodb/storage/base.py	Wed Feb  5 12:30:10 2003
@@ -113,7 +113,7 @@
     def modifiedInVersion(self, oid):
         return ''
 
-    def new_oid(self, last=None):
+    def newObjectId(self, last=None):
          # 'last' is only for internal use, not part of the public API
         if self._is_read_only:
             raise ReadOnlyError()
@@ -125,7 +125,7 @@
                 if d < 255:
                     last = last[:-1] + chr(d+1)
                 else:
-                    last = self.new_oid(last[:-1])
+                    last = self.newObjectId(last[:-1])
                 self._oid = last
                 return last
             finally:
@@ -135,7 +135,7 @@
             if d < 255:
                 return last[:-1] + chr(d+1) + '\0'*(8-len(last))
             else:
-                return self.new_oid(last[:-1])
+                return self.newObjectId(last[:-1])
 
     def registerDB(self, db):
         pass # we don't care
@@ -148,7 +148,7 @@
         # overridden in storages to clear out any temporary state.
         pass
 
-    def tpc_abort(self, transaction):
+    def tpcAbort(self, transaction):
         self._lock_acquire()
         try:
             if transaction is not self._transaction:
@@ -164,7 +164,7 @@
         # Subclasses should define this to supply abort actions.
         pass
 
-    def tpc_begin(self, transaction, tid=None, status=' '):
+    def tpcBegin(self, transaction, tid=None, status=' '):
         assert ITransactionAttrs.isImplementedBy(transaction)
         if self._is_read_only:
             raise ReadOnlyError()
@@ -199,7 +199,7 @@
         # Subclasses should define this to supply transaction start actions.
         pass
 
-    def tpc_vote(self, transaction):
+    def tpcVote(self, transaction):
         self._lock_acquire()
         try:
             if transaction is not self._transaction:
@@ -212,7 +212,7 @@
         # Subclasses should define this to supply transaction vote actions.
         pass
 
-    def tpc_finish(self, transaction, f=None):
+    def tpcFinish(self, transaction, f=None):
         self._lock_acquire()
         try:
             if transaction is not self._transaction:
@@ -334,14 +334,14 @@
             if verbose:
                 print _ts
 
-            self.tpc_begin(transaction, tid, transaction.status)
+            self.tpcBegin(transaction, tid, transaction.status)
             for r in transaction:
                 if verbose:
                     print `r.oid`, r.version, len(r.data)
                 self.restore(r.oid, r.serial, r.data, r.version,
                              r.data_txn, transaction)
-            self.tpc_vote(transaction)
-            self.tpc_finish(transaction)
+            self.tpcVote(transaction)
+            self.tpcFinish(transaction)
 
 class TransactionRecord:
     """Abstract base class for iterator protocol."""
@@ -602,7 +602,7 @@
             self._len = len(self._serials)
         return self._len
 
-    def new_oid(self, last=None):
+    def newObjectId(self, last=None):
         """Create a new object id.
 
         If last is provided, the new oid will be one greater than that.
@@ -611,7 +611,7 @@
         if self._len is not None:
             # Increment the cached length
             self._len += 1
-        return BaseStorage.new_oid(self, last)
+        return BaseStorage.newObjectId(self, last)
 
     def getSize(self):
         """Return the size of the database."""