[rucksack-devel] indexing issue?

Cyrus Harmon ch-rucksack at bobobeach.com
Thu Nov 30 18:51:59 UTC 2006


On Nov 30, 2006, at 10:43 AM, Arthur Lemmens wrote:

> Cyrus Harmon wrote:
>
>> What is the intended behavior of a unique slot?
>
> If a class has a unique slot, you (the programmer) promise that there
> won't be two instances of that class which have a 'similar' value
> for that slot.  The definition of 'similar' depends on the kind of
> index you create (see the predefined index specs in index.lisp for
> some examples).

Ok, I'd feel better if the system were to promise me that it were not  
to allow such a scenario. I don't suppose there is any notion of a  
multi-slot index or a multi-slot uniqueness constraint? (my SQL  
background/bias is probably showing through here).

Also, presumably this uniqueness constraint is per-rucksack, not  
globally for all instances of this class. I wonder how subclassing  
affects this...

>> I'm able to make-instance new instances of a persistent class with
>> a duplicate slot value
>
> Yes, I think that Rucksack doesn't check for this at the moment.
> But it should have signalled an error, I think.
>
>> which seems fine
>
> I don't think so ;-)
>
>> I'm even able to add-rucksack-root these instances.
>
> All class and slot indexes are automatically added to the root set.
> So if you create an instance of a class that has an indexed slot,
> that instance will automatically be reachable from the roots and it
> won't be removed by Rucksack's garbage collector.

Hmm... Ok, this I still don't quite get. when I make-instance a  
persistent object, I should then be able to map-rucksack-roots to get  
this instance?

>> Should the add-rucksack-root be failing in this case
>
> No, I think that the second MAKE-INSTANCE (where you try to 'create'
> the duplicate slot value) should fail already.  I'll add a check for
> that as soon as I have time.

sounds good. thanks.

> (My guess is that this should be pretty easy, and you may want to try
> this yourself.  Probably adding an :ERROR keyword argument to the  
> right
> call to BTREE-INSERT will do the trick.)

I'll try to take a look.

On a related note, how do I go about explicitly deleting objects? I  
notice that delete-rucksack-root is not exported. is this intentional?

thanks,

Cyrus




More information about the rucksack-devel mailing list