[rucksack-devel] unique slot

Takehiko Abe keke at gol.com
Wed Mar 14 09:33:20 UTC 2007


I think it would be nice if rucksack signals error when I give
a duplicated key to a unique slot.

But then I noticed the following comment in do.txt:

  - Check that btrees actually signal an error for duplicate keys.
    Handle those errors correctly for slot indexes.

Why does rucksack need to handle the errors?

Thanks,
T.



Index: rucksack.lisp
===================================================================
RCS file: /project/rucksack/cvsroot/rucksack/rucksack.lisp,v
retrieving revision 1.20
diff -u -r1.20 rucksack.lisp
--- rucksack.lisp	13 Mar 2007 13:13:00 -0000	1.20
+++ rucksack.lisp	14 Mar 2007 09:23:15 -0000
@@ -876,7 +886,9 @@
         (when old-boundp
           (index-delete index old-value id :if-does-not-exist :ignore))
         (when new-boundp
-          (index-insert index new-value id))))))
+          (index-insert index new-value id
+                        :if-exists
+                        (and (slot-unique slot) :error)))))))
 
 
 (defmethod rucksack-slot-index ((rucksack standard-rucksack) class slot





More information about the rucksack-devel mailing list