[elephant-devel] Mirroring classes from 3rd party packages.

Ian Eslick eslick at media.mit.edu
Fri Jan 9 03:16:07 UTC 2009


Yes, serialization is recursive and keeps track of references so it  
deals with circular and lattice-like references.  This is all  
serialized into a single buffer, but for moderately sized, self- 
contained trees you're probably OK.  Remember that when you load that  
value back in it serializes fresh standard objects for each node in  
your tree.  Also, if your tree is too big you can blow out the  
serializer buffer space (but that's many kilobytes of data).

While it might be a little heavy weight for you, a good way to save a  
complex data structure that you want to load/store to elephant is to  
use my snapshot-set hack in src/contrib/eslick/snapshot-set.lisp  
(which I mistakenly called cached-set in an email in the last day or  
so).  I use it as an example in the manual.  For example, you could  
subclass it for your metadata object and store your tree to its root...

An intro e-mail has some more details:
http://www.mail-archive.com/elephant-devel@common-lisp.net/msg00537.html

Ian


On Jan 8, 2009, at 8:20 PM, Yarek Kowalik wrote:

> I have a dilemma deciding on the structure on persiting data.  I  
> need your advice on.
>
> I'm relying on a third party package (Amazon-ECS) that helps me  
> parse Amazon XML data feed, with the result that the XML is  
> translated into a set of nested CLOS objects (all classes use  
> metaclass ELEMENT-CLASS).   The XML documents are represented by a  
> root object, and there subparts of the XML by the nested objects  
> accessible via root object slots, and so on recursively.   It's  
> actually a small tree structure of various types of objecs at each  
> level.   The data within this structure is valuable for current and  
> future needs for the project and I would like to cache it instead of  
> fetching from Amazon (there is a limit on how much you can fetch at  
> one time, plus the volume would make it prohitive).
>
> For the purpose of the application, currently I only need a small  
> subset of the data.   As a solution I thought that perhaps can I  
> just create a facade object that will contain the basic data slots I  
> need plus an OBJECT-REFERENCE field that refers to XMLRoot (and the  
> objects hidden within)? When this facade object is persisted, will  
> the entire XMLRoot with its descendends (objects refering to objects  
> either through slots or lists in slots) be persisted?  That is, when  
> an object is serialized, is the serialization recursive?
>
> The second option is to build a set of persistend mirror objects for  
> the XML objects I get and copy the data onto it.  This probably can  
> be automated somehow.
>
> The third option is to modify the package Amazon ECS parsing package  
> to use persistent objects by default.  It's problematic, because now  
> I will effectively create a branch of the package and maintain it  
> separately from the core.  I would not want to persist all of the  
> classes, so I would have to be selective - it isn't simply making  
> Amazon-ECS' ELEMENT-CLASS an Elephant's PERSISTENT-CLASS.
>
> Any clarifications and advice would be much appreciated.
>
> Thanks,
>
> Yarek
>
> _______________________________________________
> elephant-devel site list
> elephant-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/elephant-devel





More information about the elephant-devel mailing list