[TransWarp] [Fwd: Re: [ZODB-Dev] A different sort of ZODB
Phillip J. Eby
pje at telecommunity.com
Fri Nov 22 11:41:50 EST 2002
At 11:33 AM 11/22/02 +0200, Jean Jordaan wrote:
>Would this kind of thing have a place in PEAK, or only insofar
>as Zope might be a PEAK service, and Zope can use AdaptableStorage?
I'm not that interested in serialization, as such. The only serialization
formats I'm really interested in are XMI and Python pickles. But, the
reflective capabilities needed to make XMI possible in PEAK will certainly
be usable for other serialization formats. I just don't have any real use
cases for them.
Much more interesting, IMHO, is relational database mapping, because that's
where the best performance and reliability is for the kind of applications
PEAK's primarily intended for.
Anyway, because peak.model.Element is based on ZODB4 "Persistent", it
should be usable with any backend that can handle ZODB4 persistent
objects. Thus, if you want to store domain-model objects with ZODB,
AdaptableStorage, or a subclass of peak.storage.EntityDM, you can.
Thus PEAK, to an even greater extent than ZPatterns, "future-proofs" your
application domain model. With ZPatterns, the framework went to extreme
lengths to be able to simulate "ordinary reality" in Zope when you used
ZODB as a storage mechanism. In PEAK, the magic is all in the DM, not in
the object, so the object is about as "pure" of a domain-model object as
Right now, there isn't anything set up to map from pure ZODB data
structures to DM's in PEAK, so if you wanted to use FileStorage or one of
the other storages, you'd have to write your own adapters or
services. Probably you'd do this by creating a binding that represented an
open ZODB connection, and place it in a "ZODB_DM" TransactionComponent
whose transaction-response methods would call the ZODB transaction methods
on the connection. ZODB4's transaction message model is simpler than
PEAK's, so it would mostly be a matter of ignoring transaction methods ZODB
doesn't care about. Anyway, the "ZODB_DM" could then implement
__getitem__-type services to retrieve objects from the ZODB connection, and
then you'd just slap some storage.FacadeDM objects into your app that call
the "ZODB_DM" to retrieve objects of the right kind.
Of course, it may also be that in a Zope 3 application, there'd be better
ways of creating such a DM than using a direct ZODB connection. At this
point, I've done no investigation of through-the-web development with Zope
3, and it isn't part of our plans at present to provide explicit support
for such in the base PEAK system. But if someone (including us) comes up
with cool ways to use and configure PEAK components through-the-web with
Zope 3, I imagine we'll accept code contributions.
More information about the PEAK