simple indexed file module?
aaron_watters at my-dejanews.com
aaron_watters at my-dejanews.com
Tue Apr 13 09:15:16 EDT 1999
In article <joe-120419991008353558 at chinacat.salk.edu>,
Joe Strout <joe at strout.net> wrote:
> For a CGI script I'm working on, I need to keep a couple of indexed
> files. These will contain variable-length data (descriptions), which
> may be changed fairly frequently. So I imagine that in addition to the
> data file, there will be an index file that keeps track of the position
> and length of each record. New or expanded records will be stuffed in
> wherever there is free space, or at the end if no sufficient free chunk
> is available.
If the data is small I'd say use an in memory approach with
load and store using marshal. If the data is large enough that
the time to load/unmarshal/marshal/store becomes an issue (probably
on the order of megs, I think) then use some sort of dbm implementation.
bplustree.py will work, but it doesn't do the kind of garbage
management you ask for (you'd have to do that periodically offline).
I haven't tested it on a mac, but it should require few if any
changes.
http://starship.skyport.net/crew/aaron_watters/bplustree/
also have a look at
http://www.chordate.com/gadfly.html
-- Aaron Watters
===
You can express emotion in many ways
and with varying degrees of loudness.
-- from my recently purchased French vocab tape.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
More information about the Python-list
mailing list