Method: (RUCKSACK-ADD-SLOT-INDEX STANDARD-RUCKSACK T T T T)

Source

(defmethod rucksack-add-slot-index ((rucksack standard-rucksack)
                                    class slot index-spec unique-p
                                    &key (errorp nil))
  (unless (symbolp class)
    (setq class (class-name class)))
  (unless (symbolp slot)
    (setq slot (slot-definition-name slot)))
  ;; Find the slot index table for CLASS, create a slot index and add that
  ;; index to the table.
  (let* ((slot-index-tables (slot-index-tables rucksack))
         (slot-index-table
          (or (btree-search slot-index-tables class :errorp nil)
              (let ((table (make-instance 'btree
                                          :key< 'string<
                                          :value= 'p-eql
                                          :unique-keys-p t)))
                (btree-insert slot-index-tables class table :if-exists :error)
                table)))
         (new-slot-index (make-index index-spec unique-p)))
    (handler-bind ((btree-key-already-present-error
                    (lambda (error)
                      (declare (ignore error))
                      (simple-rucksack-error "Slot index for slot ~S of class ~S
already exists in ~S."
                                             slot
                                             class
                                             rucksack))))
      (btree-insert slot-index-table slot new-slot-index
                    :if-exists (if errorp :error :overwrite)))
    new-slot-index))
Source Context