[ZODB-Dev] Can ZEO serve Ape storage?
Shane Hathaway
shane at zope.com
Wed Jun 4 12:42:29 EDT 2003
zhimin at iss.nus.edu.sg wrote:
> Can ZEO serve Ape storage? How to do it?
> I tried to serve Ape file system storage and sql storage through ZEO but
> failed. The error I got for file system storage and sql storage are the
> same as follow:
Thanks for trying! I took your configuration and changed it around a
little to try out Ape + ZEO for the first time. I'm happy to say I got
it to work! But I had to patch ZEO.
ApeStorage derives from BaseStorage. Apparently some versions of
BaseStorage don't provide the supportsTransactionalUndo() method. The
HEAD revision provides it. I tried this with the HEAD revision of Ape,
DBTab, ZODB, ZEO, and Zope (I'm living on the edge.) However,
BaseStorage does not provide the lastTransaction() method. So I added a
lastTransaction() method to ApeStorage and ZEO was happy.
The next snag was that dbtab.conf needs a little more info to create the
mapper. Here's the relevant part of my revised dbtab.conf:
[Database: FS]
class=apelib.zodb3.db.ApeDB
factory=apelib.zope2.fsmapper.createMapper
basepath=/tmp
cache_size=4000
mount_paths=/fs
container_class=OFS.Folder.Folder
"factory" is important, but "basepath" here actually has no effect--the
FSConnection object immediately gets discarded. This needs to be
cleaned up somehow.
Finally, the ZEO client cache got in the way. The cache assumes that
OIDs are always 8-byte strings. Ape breaks this assumption. So I
disabled the client cache by commenting out code in ClientStorage.py.
Once I did this, Zope successfully connected to the Ape database and I
was able to make changes as usual. I was happy to see that Ape really
can work with ZEO.
I'll check in my changes to Ape. Would you like a ZEO patch that
disables the cache so you can try this out too (just for
experimentation)? The better solution is to make it so the cache can
handle OIDs of any length.
Shane
More information about the ZODB-Dev
mailing list