[elephant-devel] Storing objects in the root when don't care about the key / add same key to root more than once

Joubert Nel joubert at joubster.com
Mon May 28 14:48:40 UTC 2007


On Mon, 2007-05-28 at 09:54, Ian Eslick wrote:
> On May 28, 2007, at 9:26 AM, Joubert Nel wrote:
<snip>

> > My impression until I saw how persistent objects behave was that
> > everything you want to store via Elephant had to be "rooted".
> 
> Did you read through the tutorial in the new manual?  I thought I put  
> hints into the section on roots that you can store via indexed  
> classes and then the details should have been covered in the indexing  
> part of the tutorial.  Do you have suggestions on how we can clarify  
> this point?

Re-reading section 2.8, starting on p.12, I now see that it is stated
"An indexed class stores every instance of the class that is created,
ensuring that every object is automatically persisted between sessions."
And the example that follows contains no (add-to-root) so I should have
picked up on this.
I think because all the other examples included (add-to-root) my mind
was hopping along that one path!

If you think it is warranted an explicit statement can be made somewhere
(perhaps secion 2.5 where Persistent Classes are introduced, or section
2.8) that with Indexed Persistent Classes no (add-to-root) is necessary,
in contrast to non-indexed Persistent Classes and other objects. Not
crucial, though.

> 
> >>
> >> It is poor coding practice to use system-assigned OIDs.  In future
> >> versions of elephant OIDs may change over time due to GC, auto
> >> recovery of oid space, etc.  It's sort of like using the physical
> >> address of an object in a C++ program.  There is a legitimate way to
> >> use OIDs outside of elephant, but we haven't yet defined an interface
> >> for users to do so (for example you might want to use OIDs to create
> >> many-to-many maps or efficient persistent sets)
> >
> > Thanks for this insight. Many-to-many maps and sets are exactly  
> > what I'm
> > trying to achieve.
> > I found a newly released UUID package for Lisp -
> > http://www.cl-user.net/asp/libs/uuid
> > I'm going to explore using this instead of OIDs.
> 
> We would be interested in a solution that we could integrate as a  
> contrib or as a standard component of elephant.  I wrote a many-to- 
> many map awhile back that was just a btree where the key was the  
> source OID and the targets were a vector of OIDs (assuming that the  

In light of your recommendation against using OIDs I'm now investigating
using UUIDs. 
Once I have a useful generalized solution I'll share my
experience/thoughts.

Joubert

> cross product was populated).  If you wanted to be able to to do the  
> reverse you just create two of these btrees and ensure that they are  
> always synchronized.  I'm sure there are more efficient solutions,  
> but this is relatively simple.
> 
> There is already a persistent set class (PSET), but you don't want to  
> be doing alot of operations on persistent sets because you can't  
> reclaim the intermediate products.  There should be a tutorial  
> section on PSETs that talks about this.
> 





More information about the elephant-devel mailing list