[Zope3-checkins] CVS: Zope3/src/zodb/storage - base.py:1.20 bdbfull.py:1.17 bdbminimal.py:1.15 file.py:1.16

Jeremy Hylton jeremy@zope.com
Fri, 14 Mar 2003 12:18:53 -0500


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

Modified Files:
	base.py bdbfull.py bdbminimal.py file.py 
Log Message:
Perform conflict resolution in separate object rather than in mixin class.


=== Zope3/src/zodb/storage/base.py 1.19 => 1.20 ===
--- Zope3/src/zodb/storage/base.py:1.19	Thu Mar 13 17:11:35 2003
+++ Zope3/src/zodb/storage/base.py	Fri Mar 14 12:18:52 2003
@@ -38,6 +38,7 @@
     db = None
     berkeley_is_available = False
 
+from zodb.conflict import ConflictResolver
 from zodb.timestamp import newTimeStamp, TimeStamp
 from zodb.interfaces import ITransactionAttrs, ZERO
 from zodb.storage.interfaces import StorageTransactionError, ReadOnlyError
@@ -515,6 +516,7 @@
 
         BaseStorage.__init__(self, envdir)
         self._is_read_only = config.read_only
+        self._conflict = ConflictResolver(self)
 
         # Instantiate a pack lock
         self._packlock = threading.Lock()


=== Zope3/src/zodb/storage/bdbfull.py 1.16 => 1.17 ===
--- Zope3/src/zodb/storage/bdbfull.py:1.16	Fri Mar 14 11:30:55 2003
+++ Zope3/src/zodb/storage/bdbfull.py	Fri Mar 14 12:18:52 2003
@@ -25,7 +25,7 @@
 from zodb.storage.interfaces import *
 from zodb.utils import p64, u64
 from zodb.timestamp import TimeStamp
-from zodb.conflict import ConflictResolvingStorage, ResolvedSerial
+from zodb.conflict import ConflictResolver, ResolvedSerial
 from zodb.interfaces import ITransactionAttrs
 from zodb.storage.interfaces import StorageSystemError
 from zodb.storage.base import db, BerkeleyBase, PackStop, _WorkThread, \
@@ -46,7 +46,7 @@
 
 
 
-class BDBFullStorage(BerkeleyBase, ConflictResolvingStorage):
+class BDBFullStorage(BerkeleyBase):
     
     __implements__ = IStorage, IUndoStorage, IVersionStorage
     
@@ -497,7 +497,7 @@
             # given in the call is not the same as the last stored serial
             # number.  First, attempt application level conflict
             # resolution, and if that fails, raise a ConflictError.
-            data = self.resolveConflict(oid, oserial, serial, data)
+            data = self._conflict.resolve(oid, oserial, serial, data)
             conflictresolved = True
         # Do we already know about this version?  If not, we need to record
         # the fact that a new version is being created.  version will be the
@@ -1146,7 +1146,7 @@
             # Attempt application level conflict resolution
             try:
                 # XXX this needs to be converted to opaque pickles
-                data = self.resolveConflict(
+                data = self._conflict.resolve(
                     oid, ctid, tid, self._pickles[oid+target_lrevid])
                 from zodb.serialize import findrefs
                 refs = ''.join(findrefs(data))


=== Zope3/src/zodb/storage/bdbminimal.py 1.14 => 1.15 ===
--- Zope3/src/zodb/storage/bdbminimal.py:1.14	Thu Mar 13 18:32:48 2003
+++ Zope3/src/zodb/storage/bdbminimal.py	Fri Mar 14 12:18:52 2003
@@ -20,7 +20,7 @@
 from zodb.interfaces import ZERO
 from zodb.storage.interfaces import *
 from zodb.utils import p64, u64
-from zodb.conflict import ConflictResolvingStorage, ResolvedSerial
+from zodb.conflict import ResolvedSerial
 from zodb.storage.base import db, BerkeleyBase, PackStop, _WorkThread
 from zodb.storage.base import splitrefs
 
@@ -33,7 +33,7 @@
 
 
 
-class BDBMinimalStorage(BerkeleyBase, ConflictResolvingStorage):
+class BDBMinimalStorage(BerkeleyBase):
 
     __implements__ = IStorage
     
@@ -271,7 +271,7 @@
             # The object exists in the database, but the serial number
             # given in the call is not the same as the last stored serial
             # number.  Raise a ConflictError.
-            data = self.resolveConflict(oid, oserial, serial, data)
+            data = self._conflict.resolve(oid, oserial, serial, data)
             conflictresolved = True
         # Optimistically write to the various tables.
         newserial = self._serial


=== Zope3/src/zodb/storage/file.py 1.15 => 1.16 ===
--- Zope3/src/zodb/storage/file.py:1.15	Thu Mar 13 18:36:18 2003
+++ Zope3/src/zodb/storage/file.py	Fri Mar 14 12:18:53 2003
@@ -498,8 +498,7 @@
     def __init__(self, afile):
         self._file = afile
 
-class FileStorage(BaseStorage, FileStorageFormatter,
-                  conflict.ConflictResolvingStorage):
+class FileStorage(BaseStorage, FileStorageFormatter):
     # default pack time is 0
     _packt = ZERO
 
@@ -560,6 +559,7 @@
             self._file = open(file_name, 'w+b')
             self._write_metadata()
 
+        self._conflict = conflict.ConflictResolver(self)
         r = self._restore_index()
         if r is not None:
             index, vindex, start, maxoid, ltid = r
@@ -852,7 +852,7 @@
                     pnv = h.pnv
 
                 if serial != h.serial:
-                    data = self.resolveConflict(oid, h.serial, serial, data)
+                    data = self._conflict.resolve(oid, h.serial, serial, data)
 
             pos = self._pos
             here = pos + self._tfile.tell() + self._thl
@@ -1230,7 +1230,8 @@
         # that code isn't written yet
 
         try:
-            data = self.resolveConflict(h.oid, cserial, h.serial, bdata, cdata)
+            data = self._conflict.resolve(h.oid, cserial, h.serial, bdata,
+                                          cdata)
         except interfaces.ConflictError:
             data = None