On Apr 17, 2007, at 4:55 PM, John Siracusa wrote:

> I actually plan to make a strip() helper that would break all links
> with metadata, drop the db object, etc.  Basically, making an object
> ready for sane serialization with Storable (or whatever).

>> the point of all this is  to create cachable objects that are as-
>> small-as-possible when they go into memory, yet have almost no
>> overhead to revive.
>
> Right, but I think you're over-complicating it :)  I think a simple
> strip() and serialize should work...unless I'm missing something?


strip works -- sure!

my idea went a tiny bit further.

It facilitates stripping by categorizing the types of information:

looking at all of the rose internals through data::dumper, i came  
across the following 4 'main' classifications

        a- object instance information ( db representation )
        b- per-instance metadata ( __xrdbo_priv information on 'in db',  
'first seen', etc )
        c- class metadata
        d- db connection object

you always want "a"
you probably always want 'b', unless you're doing some weird 'never  
interface with the db' stuff
"c" is always available via the class info
"d" is probably not wanted

using helpers, you could quickly tune how much you want to strip.

By categorizing the information, and having a fingerprint of the RDBO  
class meta ( so we know we're dealing with the right version when we  
reserialize )  , we can make a new class object and swap in refs to  
our reserialized data containers without looping as much.  we'll know  
exactly where the data to strip is , and can just recursively delete  
hash keys ( each object tree layer would have its own information to  
strip )

Though that can be handled using a strip helper alone too -- we'd  
just need an unstrip() function that builds back in a db object and  
metadata, and we'd need to  loop each object for the right  
information to strip or not.

the one PITA all this has me thinking of , is the relation to the  
__xrdbo in db flag.  anything reserialized would have to be a  
'maybe' ( not yes/no )



// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
| SyndiClick.com
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
|      FindMeOn.com - The cure for Multiple Web Personality Disorder
|      Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
|      RoadSound.com - Tools For Bands, Stuff For Fans
|      Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to