[pony-build] in-memory db stuff

Max Laite mlaite at gmail.com
Mon Mar 29 16:37:35 PDT 2010


Hmmm well, seems that doing a test in run.py to see if a dbfile was
specified or not and passing that or :memory: may work?

Seems too easy to be true.....I have it hard coded right now to just use
:memory: and it seems to be working. I see no files created like when we use
something.db.

How would we go about testing it?

It doesn't change any output or create any output, you just pass :memory:
and that is it, sqlite takes care of everything in the back ground.

Would it be possible to do something where we create in-memory db, then do a
memory purge then see if its gone or not? Not sure it can be easily tested.

Max

On Sun, Mar 28, 2010 at 4:43 PM, C. Titus Brown <ctb at msu.edu> wrote:

> On Sun, Mar 28, 2010 at 04:36:06PM -0400, Max Laite wrote:
> > So first dbsqlite.py is using the *.db arg you specify when going to run
> > (opens it according to code... )....
> >
> > Then it passes the shelve file to IntDictWrapper and we get the
> > following....
> > IntDictWrapper object at 0x101e0f350
> >
> > IntDictWrapper.....I am only going by name but is it Initializing stuff
> for
> > the sending of data in dictionaries?
>
> Yep: 'shelve' modules need string keys, so IntDictWrapper just wraps
> integer keys => string keys.
>
> > So after IntDictWrapper call, dbsqlite.py shows the dbfile as
> catalog.sqlite
> >
> > All I can tell from the catalog is it holds the 'MAKE_SHELF' Line 34 in
> > dbsqlite.
>
> catalog?
>
> > Then what the Coordinator is using finally for dbfile arg is
> IncDictWrapper
> > object 0x101e0f350
> >
> > Can you explain any of those step in server startup a bit more?
> >
> > When ever i see 0xjibberish I always figure memory address......
>
> ;) Just means it's a not nicely configured Python object.
>
> So, on the server side, pony_build/web/__init__.py lines 481 and 482
> take the dbfilename and build a 'shelve'-like dictionary (tied to a
> sqlite database) wrapped in an IntDictWrapper:
>
>   http://docs.python.org/library/shelve.html
>
> Here, 'dbfilename' gets passed straight into the sqlite connect function --
> you
> should be able to use 'print' in dbsqlite.py to verify that.
>
> Is that any help?
>
> cheers,
> --titus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/pony-build/attachments/20100329/dc4b98af/attachment.htm>


More information about the pony-build mailing list