|
Re: conflict resolution for PersistentList: msg#00138web.zope.zodb
Hi, ok, here comes my example. I use ZODB 3.3a3. Use conflict_test.py as main program. The example should run out of the box if you have installed yaml - otherwise uncomment the last import and the first two lines of main(). I'd like to explain how things are working, as the code might look somewhat more complicated as necessary. Thats due to the fact that it was created from my actual application and tries to mimic the surroundings I've got there. First of all, the persistent objects in question are ChildData and ParentData. ParentData has a prop name and a prop items of type ConflictPersistentList(PersistentList). items stores the list of ChildData. ChildData has only one prop, payload. Then there are two proxy-classes, Parent and Child. These access the underlying data through a property called _data and by using the class ThreadProp. Every property like items is accessed as new-style class property through ThreadProp. The reason for these proxies is that by this I have only one instance of Parent/Child. For each thread running, these access their _data through a connection local to the current thread. I needed that, as I pass references to Parent and Child objects through my corba-interface. The thread-local connection handling is implemented by using some metaclasses in the tas-module. method doc-strings can contain tas::* directives that wrap the method up to ensure that proper connection and transaction handling is ensured. The tas-module is roughly modeled after java session beans. Beside the wrappers, the main entities are ApplicationContext and Transaction. The former can be thought of a session, the latter one encapsulates the transaction logic and connection handling. Access to one context is serialized for all threads by a RLock. Then there is the global variable COUNT that counts how many add_child calls have been made, so I can detect the difference between the # of calls and the # of childs in items. If you have any questions, feel free to ask. I'm now going to try btrees as collection and report on the results later. And yes, I'm lazy and type _ instead of self - I used to write _name in java for instance vars and _.name looks familiar to me. Regards, Dies
For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@xxxxxxxx http://mail.zope.org/mailman/listinfo/zodb-dev |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: conflict resolution for PersistentList: 00138, Stefan H. Holek |
|---|---|
| Next by Date: | RE: FW: Max Data.fs File Size on Windows 2000: 00138, Tim Peters |
| Previous by Thread: | RE: conflict resolution for PersistentListi: 00138, Chris McDonough |
| Next by Thread: | BTrees did it, was: conflict resolution for PersistentList: 00138, Diez B. Roggisch |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |