Re: Zope 2.8 ?

Santi Camps <[email protected]>
Newsgroups gmane.comp.web.zope.zodb.dirstorage
Message-ID <[email protected]>
En/na Toby Dickenson ha escrit:

>On Tuesday 05 July 2005 16:24, Santi Camps wrote:
>  
>
>>Hi all,
>>
>>Is there any version of DirectoryStorage for Zope 2.8 ?    Any 
>>experimental or development version ?
>>    
>>
>
>In a CVS branch; zope_28_branch. Its not been tested for a few months; I would 
>appreciate any feedback.
>  
>
Hi Toby,

First step.   It starts and seems to be working aplying the attached 
patch, with and without ZEO.  

There are some errors and failures running the test suite, but it is a 
first step.   Obviously, none of the new features of ZODB 3.4 are 
supported, I'm just trying to be able to migrate with previous features.

Regards

Santi Camps
ds4zope28.patch (text/x-patch, 6.1 KB)
? build
Index: BaseDirectoryStorage.py
===================================================================
RCS file: /cvsroot/dirstorage/DirectoryStorage/BaseDirectoryStorage.py,v
retrieving revision 1.34
diff -u -r1.34 BaseDirectoryStorage.py
--- BaseDirectoryStorage.py	4 Dec 2004 17:06:19 -0000	1.34
+++ BaseDirectoryStorage.py	6 Jul 2005 07:37:46 -0000
@@ -124,6 +124,14 @@
             self.filesystem.close()
             self.filesystem = None
 
+    def loadEx(self,oid,version):
+        stroid = oid2str(oid)
+        data,serial2 = self._load_object_file(oid)
+        self._check_object_file(oid,serial2,data,self._md5_read)
+        pickle = data[72:]
+        serial = data[64:72]
+        return pickle,serial,""
+	
     def load(self,oid,version):
         stroid = oid2str(oid)
         data,serial2 = self._load_object_file(oid)
@@ -209,7 +217,7 @@
         self._vote_impl()
         # write out the database's most recent oid
         td.write('x.oid',self._oid)
-        td.write('x.serial',self._serial)
+        td.write('x.serial',self._tid)
         # write to stable storage in the journal
         td.vote()
 
@@ -218,7 +226,7 @@
         raise NotImplementedError('_vote_impl')
 
     def _finish(self, tid, user, desc, ext):
-        self._prev_serial = self._serial
+        self._prev_serial = self._tid
         self._transaction_directory.finish()
 
     def _abort(self):
Index: Full.py
===================================================================
RCS file: /cvsroot/dirstorage/DirectoryStorage/Full.py,v
retrieving revision 1.43
diff -u -r1.43 Full.py
--- Full.py	15 Feb 2005 15:15:50 -0000	1.43
+++ Full.py	6 Jul 2005 07:37:49 -0000
@@ -8,7 +8,7 @@
 from ZODB import POSException
 from ZODB import TimeStamp
 from ZODB.ConflictResolution import ConflictResolvingStorage, ResolvedSerial
-from ZODB.referencesf import referencesf as ZODB_referencesf
+from ZODB.serialize import referencesf as ZODB_referencesf
 
 from zLOG import LOG, BLATHER, WARNING, ERROR, PANIC, INFO
 
@@ -73,16 +73,16 @@
             else:
                 raise POSException.ConflictError(serials=(old_serial, serial))
 
-        assert len(self._serial)==8
-        body = self._make_file_body(oid,self._serial,old_serial,data)
+        assert len(self._tid)==8
+        body = self._make_file_body(oid,self._tid,old_serial,data)
         refoids = []
         if self.check_dangling_references:
             ZODB_referencesf(data,refoids)
-        self._write_object_file(oid,self._serial,body,refoids)
+        self._write_object_file(oid,self._tid,body,refoids)
         if conflictresolved:
             return ResolvedSerial
         else:
-            return self._serial
+            return self._tid
 
     def restore(self, oid, serial, data, version, prev_txn, transaction):
         # A lot like store() but without all the consistency checks.  This
@@ -91,7 +91,7 @@
         # differences:
         #
         # - serial is the serial number of /this/ revision, not of the
-        #   previous revision.  It is used instead of self._serial, which is
+        #   previous revision.  It is used instead of self._tid, which is
         #   ignored.
         #
         # - Nothing is returned
@@ -184,7 +184,7 @@
         ob = string.join(td.oids.keys(),'')
                     
         u,d,e = td.u,td.d,td.e
-        assert self._prev_serial<self._serial
+        assert self._prev_serial<self._tid
         body = struct.pack("!HHHIH",len(u),len(d),len(e),len(ob),0) + u + d + e + ob
         if self._md5_write:
             md5sum = md5.md5(body).digest()
@@ -362,8 +362,8 @@
             prevtid = data[56:64]
             if prevtid==z64:
                 # The object was created in this transaction.
-                body = self._make_file_body(oid,self._serial,current,'',undofrom=prevtid)
-                self._write_object_file(oid,self._serial,body)
+                body = self._make_file_body(oid,self._tid,current,'',undofrom=prevtid)
+                self._write_object_file(oid,self._tid,body)
             else:
                 # load the revision that will become the new current revision
                 strprevtid = oid2str(prevtid)
@@ -371,8 +371,8 @@
                 self._check_object_file(oid,prevtid,data,self._md5_undo)
                 td.undone[oid] = prevtid
                 # compute a new file
-                body = self._make_file_body(oid,self._serial,current,data[72:],undofrom=prevtid)
-                self._write_object_file(oid,self._serial,body)
+                body = self._make_file_body(oid,self._tid,current,data[72:],undofrom=prevtid)
+                self._write_object_file(oid,self._tid,body)
         return oids.keys()
 
     def loadSerial(self, oid, serial):
Index: Minimal.py
===================================================================
RCS file: /cvsroot/dirstorage/DirectoryStorage/Minimal.py,v
retrieving revision 1.5
diff -u -r1.5 Minimal.py
--- Minimal.py	16 May 2003 14:10:54 -0000	1.5
+++ Minimal.py	6 Jul 2005 07:37:49 -0000
@@ -48,10 +48,10 @@
             # given in the call is not the same as the last stored serial
             # number.
             raise POSException.ConflictError(serials=(old_serial, serial))
-        assert len(self._serial)==8
-        body = self._make_file_body(oid,self._serial,old_serial,data)
-        self._write_object_file(oid,self._serial,body)
-        return self._serial
+        assert len(self._tid)==8
+        body = self._make_file_body(oid,self._tid,old_serial,data)
+        self._write_object_file(oid,self._tid,body)
+        return self._tid
 
     def _write_object_file(self,oid,newserial,body):
         td = self._transaction_directory
Index: utils.py
===================================================================
RCS file: /cvsroot/dirstorage/DirectoryStorage/utils.py,v
retrieving revision 1.16
diff -u -r1.16 utils.py
--- utils.py	6 Jul 2004 21:34:09 -0000	1.16
+++ utils.py	6 Jul 2005 07:37:49 -0000
@@ -7,7 +7,7 @@
 
 from ZODB import POSException
 from ZODB.TimeStamp import TimeStamp
-from ZODB.referencesf import referencesf as ZODB_referencesf
+from ZODB.serialize import referencesf as ZODB_referencesf
 
 from ConfigParser import ConfigParser as BaseConfigParser
 from ConfigParser import Error as ConfigParserError
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.