[Zope-dev] BTree upgrading

Chris Withers chrisw@nipltd.com
Wed, 04 Apr 2001 14:51:59 +0100


Hi,

I see the new catalog stuff makes use of new BTrees. I presume the big
advantages the new catalog has are from these new BTrees. I know of a few
products which also use these BTrees (Squishdot and some internal ones here
spring to mind) so I guess they should be upgraded too?

Well, I had a look at the _convertBTrees method in Catalog.py and it all made
sense, so I'm guessing the folowing would be the correct way to convert some
BTrees?

from BTrees import IOBTree, BTree, convert

myBTree

if type(myBTree is not IOBTree):
  mynewBTree = IOBTree()
  convert(myBTree,mynewBTree, 200)

...or..

if type(myBTree is not BTree):
  mynewBTree = BTree()
  convert(myBTree,mynewBTree, 200)

I'm guessing the 200 is how many items get put in each bucket? What should
influence the choice of this number?

cheers,

Chris