anchor.diff:  ;; generics
   ;; ---------------------------------------------------------------------------------------------------------------------
   
  -(defgeneric allocate-location (transaction obj))
  -
  -(defgeneric object-for-location (transaction location))
  -
  -(defgeneric location-for-object (transaction obj))
  +(defgeneric allocate-id (transaction obj))
  +
  +(defgeneric object-for-id (transaction id))
  +
  +(defgeneric id-for-object (transaction obj))
   
   (defgeneric add-changed-node (transaction node))
   
  -(defgeneric add-opened-node (transaction node location))
  +(defgeneric add-opened-node (transaction node id))
   
   (defgeneric prb-open-storage (storage)
     (:documentation "Prepare storage for use; after this call load & save operations should succeed"))
  
positive.code: (defclass red-black-tree-memory-storage (red-black-tree-storage)
    ((objects :initform (make-array 0 :adjustable t) :accessor objects)
     (root :accessor root)
     (next-location :initform 0 :accessor next-location)))
  
  (defclass red-black-tree-file-storage (red-black-tree-storage)
    ((file-name :initarg :file-name :accessor file-name)))
  
negative.code: (defmethod prb-open-storage ((storage red-black-tree-memory-storage))
    )
  
  (defmethod prb-load ((storage red-black-tree-memory-storage) id)
    (aref (objects storage) id))
  
  (defmethod prb-save ((storage red-black-tree-memory-storage) id object)
    (with-slots (objects) storage
      (adjust-array objects (max (+ 1 id) (length objects)))
      (setf (aref objects id) object)))
  
  (defmethod prb-abort ((*rb-transaction* red-black-tree-transaction))
    (setf (new-root *rb-transaction*) nil)
    (clrhash (object-to-id *rb-transaction*))
    (clrhash (id-to-object *rb-transaction*))
    (clrhash (changes *rb-transaction*)))
  
  (defmethod prb-commit ((*rb-transaction* red-black-tree-transaction))  
    (let ((ids (sort (loop for id being the hash-keys of (changes *rb-transaction*) collect id)
  			 #'<))
  	(storage (storage (tree *rb-transaction*))))
      (loop for id in ids
         do (prb-save storage id (object-for-id *rb-transaction* id)))
      (when (new-root *rb-transaction*)
            (setf (root storage) (new-root *rb-transaction*))
        	  (setf (slot-value (tree *rb-transaction*) 'root) (new-root *rb-transaction*)))))