[ZODB-Dev] Re: conflict resolution for PersistentList

Casey Duncan casey at zope.com
Wed May 26 10:18:22 EDT 2004


On Wed, 26 May 2004 10:49:09 +0100
Chris Withers <chris at simplistix.co.uk> wrote:

> Syver Enstad wrote:
> > What should be the data structure of choice when just wanting to
> > store some thousand objects in a flat list with no keys. I am using
> > PersistentList for the time being, but the comment that it will make
> > the ZODB grow very fast worries me.
> 
> Does order matter to you?
> If so, what is the order that matters?
> 
> If not, looks at the BTrees package's OOSet class.
> Or should tha tbe OOTreeSet?
> 
> Hmmm, what's the difference between an OOSet, and IOSet and an IISet?

OOSet is a set of arbitrary totally ordered objects. That makes it less
than optimal for storing much of anything besides simple built-in types
(strings, longs, dates, etc).

IOSet and IISet are functionally equivilant. They are sets of integers.

If the sets will be large then use a TreeSet. OOSet and IISet are stored
in a single data block just like lists and dicts. TreeSets are divided
up into bucket sets so they are more efficient to deal with, especially
for updates since it usually only means storing a single bucket rather
than the whole set.

ZODB currently lacks a similar data type for large lists. It would be
straightforward to create one, but features like conflict resolution are
tricky to get right (where right is often just your application's policy
anyhow). For example, what happens on concurrent append, insert, delete
or pop? There is really no fundamentally right answer to those
questions, you need to pick the best one for your app.

-Casey




More information about the ZODB-Dev mailing list