Purple -- "On Judy a Ruby shines purple"




Purple implementes a simple in memory database.



News / Status (olds)


1.0.1 Bugfix update 7.8.06

DON'T use release 1.0 as it has a serious bug.


1.0 Purple goes "Stable" 19.7.06

The functionality and stability has reached a level where I hope others can participate and hopefully find it useful.
  • Save by reachability, no code changes, native objects supported
  • Load all or lazy
  • Proper transaction + recovery
  • Garbage collected
  • Scalable Hashes



General Functionality

Purple provides persistance by reachability for any ruby objects.
This means that , once you put an object to purple, all objects accessible by that object will also be added. No extra code needed on the users classes for this.

The best way to use Purple is as a big hash map (string-object mapping). Once objects have been added they (and especially their contained objects) can be retrieved by a unique id.
Purple has a very simple API. You can
-- open a Database (file + other paramters)
-- start a transaction
-- put named objects
-- get object (by name or id, lazy or direct)
-- save object (must have been previously got from purple)
-- remove objects (by name )
-- commit previously put/saved/removed objects (a transaction)

Every object you add to Purple will have a purple_id attribute added to it's class and for every instance this id will be unique in the database. You can save the same object and rely on the id staying the same.
The id may be passed around (eg. as a cookie or url parameter) and used later to retrieve the object.

In a way, Purple works similarly to Marshal/PStore. Just that you can retrieve any object, not just the whole thing. Also you can make changes to just one object and save just that object again.


Open issues include
-- locking of objects, arrays and hashes.
-- Iterators , especially by type may be handy
-- Unloading/loading mechanism (probably by size trigger into YAML)


API

More details

How to use

Acknowledgements

Big thanks to Matz: Ruby's put the fun back into programming
And to Doug Baskins, for the lightning fast Judy tree implementation.

In the hope that you find Purple useful, (but without any guarantee)

Torsten torsten@rubyforge.org