durusmail: durus-users: Re: __len__ for Btrees was Re: [Durus-users] some btree enhancements
some btree enhancements
2005-07-13
2005-07-13
2005-07-13
2005-07-13
2005-07-13
Re: __len__ for Btrees was Re: [Durus-users] some btree enhancements
2005-07-14
2005-07-14
2005-07-14
2005-07-14
2005-07-14
2005-07-14
2005-09-09
Re: __len__ for Btrees was Re: [Durus-users] some btree enhancements
Thomas Guettler
2005-07-14
Am Donnerstag, 14. Juli 2005 12:58 schrieb David Binger:
> Yes.  The use-case would be large mappings that do not change
> frequently,
> but for which you frequently wish to know the size.  I think the size
> should
> be maintained, not on the BTree itself, but on a separate Persistent
> instance held on an attribute of the BTree.  This will help avoid the
> very
> expensive invalidation of the BTree itself.

In ZODB there is a class called "Length". It has built in conflict-resolution.
This means the lenght it returns could be wrong if some other transaction is
changing the size of the btree at the same moment. If there is just one
process accessing the database, the result is always correct.

http://svn.zope.org/ZODB/trunk/src/BTrees/Length.py?view=markup

 Thomas
reply