[ZODB-Dev] BerkleyStorage

Barry A. Warsaw barry@zope.com
Wed, 25 Jul 2001 12:25:27 -0400


>>>>> "CW" == Chris Withers <chrisw@nipltd.com> writes:

    CW> For now, which of the non-packing versions would you recommend
    CW> using?

Probably Packless which does the reference counting.  Eventually
Minimal will be the way to go, since it shares a bunch of code with
Full, which is my primary support focus.

    >> CW> Is anyone using it in production yet?
    >>  We (ZopeCorp) are testing it with real data for a couple of
    >> new sites, and we start by migrating an entire FileStorage over
    >> to a (Berkeley) Full storage by using the (mostly undocumented)
    >> interator interface.

    CW> Ah, now this would be really handy, i was just planning to do
    CW> a .zexp of the whole site, but if there's a better way I'd
    CW> love to hear it...

It's pretty darn trivial for any storage derived from BaseStorage.
E.g. here's a script that creates a new Full storage and copies
everything from an existing storage to the new one.  Tailor to suit
your needs (i.e. open an existing FileStorage instead).

All the magic of the iterator protocol is hidden in
copyTransactionsFrom().

-Barry

-------------------- snip snip --------------------
#! /usr/bin/env python

import sys
from Full import Full

# Copy one database to another
srcfile = sys.argv[1]
dstfile = sys.argv[2]

src = Full('zope', srcfile)
dst = Full('zope', dstfile)

dst.copyTransactionsFrom(src)

src.close()
dst.close()