[DGD] DGD and *dbm

Felix A. Croes felix at dworkin.nl
Mon Jul 21 14:18:33 CEST 2008


bart at wotf.org wrote:

> The idea I'm playing with is to add support for one of the *dbm packages (bdb,
> gdbm, tdbm etc). This would serve a number of purposes, including storage of
> huge amounts of (potentially large) key:value pairs, and possibly, use it to
> share data with external applications.
>
> The questions I have:
> Because any such dbm might take a fair amount of time to return some results,
> I'm considering a callback mechanism to return results. This breaks
> continuity, ie, you have to request data, and then wait for the callback
> instead of being able to do something like var = dbm_get(key). I'm not sure if
> this is really needed when requesting a single key:value pair tho. Any
> experience with this?

I have even more questions:

Will C-level calls to the database be handled by DGD's interpreter,
or will the database run in a different process or thread?

Will the database play fair with atomic functions?  How will an atomic
rollback affect it?

Do you intend it to work with DGD/MP in the future, where even non-
atomic code can be rolled back?


> Since there can be more key:value pairs in such a dbm then fit in an array or
> mapping, it won't be possible to get a list of all keys or values directly, I
> am considering returning a range (of max max_array elements), based on
> start/end arguments (ie, arr = dbm_keys(x,y); ). Any thoughts on this?

Have you considered arrays of arrays (of arrays...) of results?

What sort of information are you allowing to be stored in the database?
Strings only, everything but objects, or anything whatsoever?

Regards,
Dworkin



More information about the DGD mailing list