ZPatterns: External Attribute Provider question
Hi Phillip, Is there a good reason that ExternalAttributeProvider sets up a dictionary to put its attributes into, rather than a PersistentMapping? This is the way it seems to store things in the Rack: Rack's BTree | + object_id : PersistentMapping | + ('ZPatterns.Rack', 'Self') : Persistent object, eg ZClass instance + ('ZPatterns.AttributeProviders','ExternalAttributes') : {} # dict filled with external attributes The thing is that when the dict gets updated by the External Attribute Provider, the whole second-level-in PersistentMapping object gets updated. If an External Attribute Provider instead set up a new PersistentMapping in its slot, only that PersistentMapping would change in the ZODB on updates. Do you think this is a reasonable change for the External Attribute Provider class? Or, should I write my own provider, derived from External Attribute Provider, that uses a PersistentMapping instead of a dict? Actually, I can see the use for a Persistent AttributeProvider where you have a configurable slot, so you can group attributes that change at different rates in groups of those that change together. The second half of the slot-key's tuple would be configurable as a property on the attribute provider. -- Steve Alexander Software Engineer Cat-Box limited
At 07:48 PM 3/11/01 +0000, Steve Alexander wrote:
Is there a good reason that ExternalAttributeProvider sets up a dictionary to put its attributes into, rather than a PersistentMapping?
It's mainly to avoid a proliferation of persistent objects, based on the assumption that if you're using a PEAP, you probably don't have that much else in the PersistentMapping.
If an External Attribute Provider instead set up a new PersistentMapping in its slot, only that PersistentMapping would change in the ZODB on updates.
Do you think this is a reasonable change for the External Attribute Provider class? Or, should I write my own provider, derived from External Attribute Provider, that uses a PersistentMapping instead of a dict?
I would suggest creating your own provider(s).
participants (2)
-
Phillip J. Eby -
Steve Alexander