[elephant-cvs] CVS elephant/src/elephant

ieslick ieslick at common-lisp.net
Sat Feb 24 14:52:00 UTC 2007


Update of /project/elephant/cvsroot/elephant/src/elephant
In directory clnet:/tmp/cvs-serv9022/src/elephant

Modified Files:
	classes.lisp classindex-utils.lisp classindex.lisp 
	controller.lisp migrate.lisp package.lisp serializer2.lisp 
	unicode2.lisp 
Log Message:
Remove or document NOTE comments in Elephant & BDB code

--- /project/elephant/cvsroot/elephant/src/elephant/classes.lisp	2007/02/21 06:29:31	1.15
+++ /project/elephant/cvsroot/elephant/src/elephant/classes.lisp	2007/02/24 14:51:59	1.16
@@ -184,8 +184,6 @@
 ;;
 
 (defmethod update-instance-for-redefined-class :around ((instance persistent-object) added-slots discarded-slots property-list &rest initargs &key &allow-other-keys)
-  ;; NOTE: probably should delete discarded slots, but we'll worry about that later
-  ;;       (also will want to delete discarded indices since we don't have a good GC)
   (declare (ignore property-list discarded-slots added-slots))
   (prog1
       (call-next-method)
@@ -215,7 +213,7 @@
  	 (retained-persistent-slots (set-difference raw-retained-persistent-slots retained-unbound-slots)))
     ;; Apply default values for unbound & new slots (updates class index)
     (apply #'shared-initialize current (append new-persistent-slots retained-unbound-slots) initargs)
-    ;; Copy values from old class (NOTE: should delete discarded slots?) (updates class index)
+    ;; Copy values from old class (updates class index)
     (ensure-transaction (:store-controller (get-con current))
       (loop for slot-def in (class-slots new-class)
 	 when (member (slot-definition-name slot-def) retained-persistent-slots)
@@ -270,7 +268,6 @@
 
 ;; ======================================================
 ;; Handling metaclass overrides of normal slot operation
-;; NOTE: Closer to MOP should replace this need...
 ;; ======================================================
 
 ;;
--- /project/elephant/cvsroot/elephant/src/elephant/classindex-utils.lisp	2007/02/18 23:38:18	1.5
+++ /project/elephant/cvsroot/elephant/src/elephant/classindex-utils.lisp	2007/02/24 14:51:59	1.6
@@ -190,18 +190,21 @@
     (mapcar #'(lambda (rule-specs)
 		(cons (car rule-specs)
 		      (mapcar #'make-synch-rule (cdr rule-specs))))
-	    '((:class ;; class changes db
+	    '((:class ;; class overwrites db
 	       ((not db-slot) class-indexed => add-slot-index)
 	       (db-slot (not class-indexed) => remove-slot-index)
 	       (db-derived (not class-indexed) (not class-persistent)
 		           (not class-transient) => register-derived-index))
-	      (:union ;; merge both sides
+	      (:union ;; merge both sides - conflicts favor class
 	       (db-slot (not class-indexed) => register-indexed-slot)
 	       ((not db-slot) class-indexed => add-slot-index)
 	       (db-derived (not class-derived) => register-derived-index)
 	       (db-derived class-persistent => remove-derived-index warn))
-	       ;; NOTE: What about cases where we need to remove things as below?
-	      (:db ;; db changes class
+	      (:db 
+	       ;; :db updates indexing in classes when indexes and
+	       ;; slots overlapped there may still be problems with
+	       ;; derived indices that refer to missing slots or
+	       ;; conflict with new slotnames
 	       ((not db-slot) class-indexed => unregister-indexed-slot)
 	       ((not db-derived) class-derived => unregister-derived-index)
 	       (db-slot class-persistent => register-indexed-slot)
--- /project/elephant/cvsroot/elephant/src/elephant/classindex.lisp	2007/02/22 20:19:57	1.23
+++ /project/elephant/cvsroot/elephant/src/elephant/classindex.lisp	2007/02/24 14:51:59	1.24
@@ -68,7 +68,10 @@
 (defmethod indexed-slot-writer ((class persistent-metaclass) (instance persistent-object) (slot-def persistent-slot-definition) new-value)
   "Anything that side effects a persistent-object slot should call this to keep
    the dependant indices in synch.  Only classes with derived indices need to
-   update on writes to non-indexed slots."
+   update on writes to non-indexed slots.  This is a side effect of user-managed
+   indices in Elephant - a necessity because we allow arbitrary lisp expressions to
+   determine index value so without bi-directional pointers, the indices cannot 
+   automatically update a changed indexed value in derived slots"
   (let ((slot-name (slot-definition-name slot-def))
 	(oid (oid instance))
 	(con (get-con instance)))
@@ -77,8 +80,6 @@
 	(persistent-slot-writer con new-value instance slot-name)
 	(let ((class-idx (find-class-index class)))
 	  (ensure-transaction (:store-controller con)
-	    ;; NOTE: Quick and dirty hack to ensure consistency -- needs performance improvement
-
 	    (when (get-value oid class-idx)
 	      (remove-kv oid class-idx))
 	    (persistent-slot-writer con new-value instance slot-name)
@@ -279,8 +280,6 @@
 	     
 (defmethod remove-class-slot-index ((class persistent-metaclass) slot-name &key 
 				    (sc *store-controller*) (update-class t))
-  ;; NOTE: Write routines to recover BDB storage when you've wiped an index...
-  ;; NOTE: If the transaction aborts we should not update class slots?
   (if (find-inverted-index class slot-name :null-on-fail t)
       (progn
 	(when update-class (unregister-indexed-slot class slot-name))
@@ -357,7 +356,7 @@
 
 
 ;; ====================================
-;;       User level Mapping API
+;;       Low Level Mapping API
 ;; ====================================
 
 (defun map-class (fn class)
@@ -373,7 +372,7 @@
       (declare (dynamic-extent map-fn))
       (map-btree #'map-fn class-idx))))
 
-(defun map-instances (fn class index start end)
+(defun map-class-index (fn class index start end)
   "If you want to map over a subset of instances, pick an index 
    and specify bounds for the traversal.  Otherwise use map-class
    for all instances"
--- /project/elephant/cvsroot/elephant/src/elephant/controller.lisp	2007/02/21 04:47:42	1.36
+++ /project/elephant/cvsroot/elephant/src/elephant/controller.lisp	2007/02/24 14:51:59	1.37
@@ -82,9 +82,8 @@
 	  (setf (gethash spec *dbconnection-spec*) sc))
 	sc)))
 
-
-;; NOTE: Check for asdf loaded rather than rely on asdf to?
 (defun load-backend (type)
+  (assert (find-package :asdf))
   (let ((record (assoc type *elephant-backends*)))
     (when (or (null record) (not (consp record)))
       (error "Unknown backend type ~A, cannot load" type))
@@ -177,9 +176,9 @@
                    then it should return nil"))
 
 (defmethod database-version :around (sc)
-  "Default version assumption for unmarked databases is 0.6.0"
-;; NOTE: It is possible to check for 0.5.0 databases, but it is not
-;; implemented now due to the low (none?) number of users still on 0.5.0"
+  "Default version assumption for unmarked databases is 0.6.0.
+   It is possible to check for 0.5.0 databases, but it is not implemented 
+   now due to the low (none?) number of users still on 0.5.0"
   (declare (ignorable sc))
   (let ((db-version (call-next-method)))
     (if db-version db-version
@@ -497,7 +496,8 @@
 ;; Callback hooks for persistent variables
 ;;
 
-;; NOTE: Design sketch; not sure I'll promote this...
+;; Design sketch; not sure I'll promote this.  
+;; To be looked at again for 0.6.2 or 0.7.0
 
 ;;(defvar *variable-hooks* nil
 ;;  "An alist (specs -> varlist) where varlist is tuple of
--- /project/elephant/cvsroot/elephant/src/elephant/migrate.lisp	2007/02/17 12:13:19	1.7
+++ /project/elephant/cvsroot/elephant/src/elephant/migrate.lisp	2007/02/24 14:51:59	1.8
@@ -24,7 +24,7 @@
 ;; repositories and is used by the upgrade interface.
 ;;
 
-;; NOTES AND LIMITATIONS:
+;; LIMITATIONS:
 ;; - Migrate currently will not handle circular list objects
 ;; - Migrate does not support arrays or standard objects with nested persistent objects
 ;; - There are potential problems with graphs and other deep structures
--- /project/elephant/cvsroot/elephant/src/elephant/package.lisp	2007/02/22 20:19:57	1.17
+++ /project/elephant/cvsroot/elephant/src/elephant/package.lisp	2007/02/24 14:51:59	1.18
@@ -110,7 +110,7 @@
 
 	   ;; Class mapping API
 	   #:map-class
-	   #:map-instances
+	   #:map-class-index
 
 	   ;; Instance query API
 	   #:get-instances-by-class 
--- /project/elephant/cvsroot/elephant/src/elephant/serializer2.lisp	2007/02/21 04:47:42	1.26
+++ /project/elephant/cvsroot/elephant/src/elephant/serializer2.lisp	2007/02/24 14:51:59	1.27
@@ -89,14 +89,6 @@
 (defconstant +adjustable-p+       #x40)
 
 ;;
-;; NOTE: Used bad coding practice here: without-interrupts is a single-CPU
-;;       construct, but most lisps are not native multi-CPU capable so 
-;;       no problems in near term.  I used it to avoid general locking overhead
-;;       as queues are an effective lock-free structure when combined with
-;;       an allocate-on-empty policy
-;; 
-
-;;
 ;; Circularity Hash for Serializer
 ;;
 
--- /project/elephant/cvsroot/elephant/src/elephant/unicode2.lisp	2007/02/03 04:09:13	1.4
+++ /project/elephant/cvsroot/elephant/src/elephant/unicode2.lisp	2007/02/24 14:51:59	1.5
@@ -13,7 +13,7 @@
 ;;; as governed by the terms of the Lisp Lesser GNU Public License
 ;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
 ;;;
-;;; NOTE: Here UTF8 means 8-bit < #x79 only for efficiency, UTF16 means UTF16 format 
+;;; Here UTF8 means 8-bit < #x79 only for efficiency, UTF16 means UTF16 format 
 ;;; but only for values < #xFFFF.  In the odd cases of non-0 unicode planes we just
 ;;; use UTF-32 to avoid the time cost of translation.  Only when converting from a
 ;;; serialized UTF-X do we worry about encoding (UTF32->UTF16).  If an ascii/utf8 lisp




More information about the Elephant-cvs mailing list