[elephant-cvs] CVS elephant/src/elephant

ieslick ieslick at common-lisp.net
Mon Feb 20 21:21:44 UTC 2006


Update of /project/elephant/cvsroot/elephant/src/elephant
In directory common-lisp:/tmp/cvs-serv10634/src/elephant

Modified Files:
	collections.lisp controller.lisp 
Log Message:
A quick AllegroCache backend based on the allegrocache map and compound keys - functionality is only partial but the basics work

--- /project/elephant/cvsroot/elephant/src/elephant/collections.lisp	2006/02/20 15:45:37	1.2
+++ /project/elephant/cvsroot/elephant/src/elephant/collections.lisp	2006/02/20 21:21:42	1.3
@@ -324,8 +324,8 @@
 	 (progn , at body)
       (cursor-close ,var))))
 
-(defun map-btree (fn btree)
-  "Like maphash."
+(defmethod map-btree (fn (btree btree))
+  "Like maphash.  Default implementation - overridable"
   (with-btree-cursor (curs btree)
     (loop
      (multiple-value-bind (more k v) (cursor-next curs)
--- /project/elephant/cvsroot/elephant/src/elephant/controller.lisp	2006/02/20 15:45:37	1.4
+++ /project/elephant/cvsroot/elephant/src/elephant/controller.lisp	2006/02/20 21:21:44	1.5
@@ -30,9 +30,11 @@
 ;; Dynamic tracking of active connections
 
 
-(defvar *elephant-backends*
+(defparameter *elephant-backends*
   '((:bdb (:ele-bdb))
-    (:clsql (:ele-clsql)))
+    (:clsql (:ele-clsql))
+    (:acache (:ele-acache))
+    )
   "Entries have the form of (backend-type asdf-depends-list")
 
 (defvar *elephant-controller-init* (make-hash-table))
@@ -53,20 +55,31 @@
    cached?  That might be dangerous so for now we error"
   (declare (ignore sc))
   (let ((con (gethash (:dbcn-spc-pst instance) *dbconnection-spec*)))
-    (cond((not con)
-	  ;; NOTE: Create a new one here & warn instead?
-	  (error "Object's store controller was lost"))
-	 ((and con (connection-is-indeed-open con))
-	  con)
-	 (t (open-controller con)))))
+    (cond ((not con)
+	   ;; ISE NOTE: Create a new one here & warn instead?
+	   ;; (get-controller spec)
+	   (error "Object's store controller was lost"))
+	  ;; If it's valid and open
+	  ((and con (connection-is-indeed-open con))
+	   con)
+	  ;; If the object exists but is closed, reopen
+	  (t (open-controller con)))
+    con))
 
 (defun get-controller (spec)
+  "This is used by open-store to fetch or open a controller.
+   This maintains the dbconnection-spec table so should be
+   the only point of entry for getting access to controllers
+   from specs.  Get-con is used to validate connections and
+   reopen if necessary and perhaps these two should be combined
+   at some point"
   (let ((cached-sc (gethash spec *dbconnection-spec*)))
     (if (and cached-sc (connection-is-indeed-open cached-sc))
 	cached-sc
 	(build-controller spec))))
 
 (defun build-controller (spec)
+  "Actually construct the controller & load dependencies"
   (assert (and (consp spec) (symbolp (first spec))))
   (load-backend (first spec))
   (let ((init (lookup-backend-con-init (first spec))))




More information about the Elephant-cvs mailing list