Tim Bates wrote:
> On Tue, 21 Jan 2003 01:20 pm, Dmitri Colebatch wrote:
> 
>>thanks for the response.  so the difference between this and PStore (or
>>Marshall from what I'v eheard) is ....?  I'm assuming you're talking
>>about the load/save mechanics...  at transaction boundaries writing
>>everything to disk?  I'm already doing that in my PStore backed impl,
>>but am sure you're talking about something more...
> 
> I don't know, maybe I'm not; I'm just throwing ideas around. It would be more 
> transparent than Marshal; I haven't looked at PStore, so maybe it already 
> does this, although ahoward hinted that it is intended for exclusively 
> web-based programming, perhaps because of the way it is tied to CGI. It's 
> quite possible that something like this already exists - if someone knows of 
> such a beast, could you let us know since I for one would find it very 
> useful.

ok, here's what I've got made more generic (developed using the well 
known EDD - email driven development - technique):

class Database
   def initialize(file)
     @store = PStore.new(file)
     rollback
   end
   def rollback
     @objects = @store['objects']
   end
   def commit
     @store.transaction do
       @store['objects'] = objects;
     end
   end
   def add(object)
     @store.push(object)
   end
   # ...  remove/save/find.
end

not sure how that fits with what you'r ethinking... but its pretty 
simple and does what I need...

cheers
dim