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

Ian Eslick eslick at csail.mit.edu
Mon May 28 12:51:13 UTC 2007


A few clarifications:

Standard persistent classes are not saved by default.  To get access  
to a class via the map-class operator the class or a slot of the  
class must be declared as :indexed.  If a slot is indexed, then that  
value can be used as a key for the object via the get-instances-by- 
value interface.  Moreover, you can have duplicate slot values and  
get-instances-by-value will return all the objects having that slot  
value.

Think of the root more like a hash table (single key-value pair)  
instead of a set or collection.  The simple get-value interface would  
be more complex if it could return multiple values.

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)

Ian

On May 28, 2007, at 5:05 AM, Dmitry V. Gorbatovsky wrote:

> On Monday 28 May 2007 07:36, Joubert Nel wrote:
>> On Sun, 2007-05-27 at 23:46, Robert L. Read wrote:
>>> On Sun, 2007-05-27 at 16:23 -0400, Joubert Nel wrote:
>
>> On another note:
>> In my experimentation I added several objects to the root, all  
>> with the
>> same key.
>> All these objects get added but there is the following curiosity:
>> - I can do a map-class to get them all, BUT
>> - map-root will only return one key/value pair for a given key (even
>> when there are multiple objects stored against the same key)
>>
>> I'm wondering whether a design decision was  made to allow  
>> addition of
>> the same key more than once?
>> Thanks for a great library.
>>
>> Joubert
>>
>> _______________________________________________
>> elephant-devel site list
>> elephant-devel at common-lisp.net
>> http://common-lisp.net/mailman/listinfo/elephant-devel
>
> Nop , as far as I understand, map-class operate on OID and type  
> information
> and returns all persistent objects , while root 'hash-table' keep  
> only last
> key-value pair.
>
> Regards , Dmitry
> _______________________________________________
> 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