[clouchdb-cvs] CVS clouchdb/src

peddy peddy at common-lisp.net
Sun Apr 19 22:48:32 UTC 2009


Update of /project/clouchdb/cvsroot/clouchdb/src
In directory cl-net:/tmp/cvs-serv29162/src

Modified Files:
	README.txt clouchdb.asd clouchdb.lisp examples.lisp 
	package.lisp tests.lisp 
Log Message:
Updates to work with current CouchDb 0.9 source


--- /project/clouchdb/cvsroot/clouchdb/src/README.txt	2008/06/28 22:55:07	1.2
+++ /project/clouchdb/cvsroot/clouchdb/src/README.txt	2009/04/19 22:48:32	1.3
@@ -1,5 +1,5 @@
 
-Copyright 2007 Peter Eddy (peter.eddy at gmail.com)
+Copyright 2009 Peter Eddy (peter.eddy at gmail.com)
 
 Introduction
 ------------
@@ -18,11 +18,13 @@
 
 Clouchdb is written in generic lisp code and should run in most lisp
 implementations. At the time of writing it has been tested with SBCL
-running on Linux (Fedora 8, 32 bit) and with OpenMCL running on
-Leopard (64bit, Intel). The CouchDb server version was 0.8-incubating.
-
-Clouchdb relies on the Parenscript and Drakma libraries. The included
-clouchdb-tests package also relies on the Lift unit test framework.
+running on Linux (Unbuntu 8.10, 64 bit) and with OpenMCL running on
+OSX Leopard (64bit, Intel). The CouchDb server version was
+0.9.0a766522. Note: 0.8x versions are no longer supported.
+
+Clouchdb relies on the Parenscript and Drakma libraries (and their
+dependencies). The included clouchdb-tests package also relies on the
+Lift unit test framework.
 
 
 Installation
--- /project/clouchdb/cvsroot/clouchdb/src/clouchdb.asd	2008/01/19 20:18:57	1.5
+++ /project/clouchdb/cvsroot/clouchdb/src/clouchdb.asd	2009/04/19 22:48:32	1.6
@@ -37,12 +37,14 @@
 (asdf:defsystem :clouchdb
   :serial t
   :version #.*clouchdb-version*
-  :depends-on (:drakma
+  :depends-on (:closer-mop
+               :drakma
                :parenscript
                :s-base64
                :flexi-streams)
   :components ((:file "package")
                (:file "clouchdb")
                (:file "decoder")
+               (:file "document")
                (:file "encoder")))
 
--- /project/clouchdb/cvsroot/clouchdb/src/clouchdb.lisp	2008/06/28 22:55:07	1.29
+++ /project/clouchdb/cvsroot/clouchdb/src/clouchdb.lisp	2009/04/19 22:48:32	1.30
@@ -374,13 +374,26 @@
     (multiple-value-bind (body status headers uri stream must-close reason-phrase)
 	(apply #'drakma:http-request (make-uri uri) args)
       (declare (ignore reason-phrase stream uri headers status))
-;;      (format t "  -> uri: ~a~%" uri)
-;;      (format t "  -> headers: ~S~%" headers)
+      ;;(format t "-> uri: ~a~%" uri)
+      ;;(format t "-> headers: ~S~%" headers)
       (cond (must-close
-             ;;(format t "body: ~S~%" body)
+             ;;(format t "body: ~A~%" body)
              (json-to-document body))
             (t nil)))))
 
+;; (defun cached-db-request (cache uri &rest args &key parameters &allow-other-keys)
+;;   "If a cache is supplied try it first before reqesting from
+;; server. Cache result if cache is not nil."
+;;   (cond (cache
+;;          (let ((cache-key (if parameters (cons uri parameters) uri)))
+;;            (format t "cache key: ~s~%" cache-key)
+;;            (let ((cached (get-cached cache-key cache)))
+;;              (cond (cached
+;;                     cached)
+;;                    (t
+;;                     (setf (get-cached cache-key cache) (apply #'db-request uri args)))))))
+;;         (t (apply #'db-request uri args))))
+
 ;;
 ;;
 ;;
@@ -438,7 +451,7 @@
   (let* ((name (if db-name-p db-name *db-name*))
 	 (res (db-request (cat (url-encode name) "/") 
                           :method :put)))
-    (if (equal "database_already_exists" (document-property :|error| res))
+    (if (equal "file_exists" (document-property :|error| res))
       (ecase if-exists
 	((:ignore) (list (cons :|ok| t) (cons :|ignored| t)))
 	((:recreate) 
@@ -788,7 +801,7 @@
   (declare (ignore key start-key start-key-docid end-key count 
                    update descending skip))
   (ensure-db ()
-    (db-request (cat (url-encode *db-name*) "/_view/" 
-                     (url-encode id) "/" (url-encode view))
+    (db-request (cat (url-encode *db-name*) "/_design/" 
+                     (url-encode id) "/_view/" (url-encode view))
 		:method :get
                 :parameters (transform-params options *view-options*))))
--- /project/clouchdb/cvsroot/clouchdb/src/examples.lisp	2008/06/15 13:44:41	1.9
+++ /project/clouchdb/cvsroot/clouchdb/src/examples.lisp	2009/04/19 22:48:32	1.10
@@ -123,7 +123,7 @@
       (format t "found: ~S documents:~%" (length (document-property :|rows| result)))
       (dolist (doc (document-property :|rows| result))
 	(format t "---~%ID: ~S~%document:~%~S~%" 
-		(document-property :id doc) doc)))))
+		(document-property :|id| doc) doc)))))
 
 	
 (defun example3 ()
--- /project/clouchdb/cvsroot/clouchdb/src/package.lisp	2008/06/29 15:17:52	1.10
+++ /project/clouchdb/cvsroot/clouchdb/src/package.lisp	2009/04/19 22:48:32	1.11
@@ -40,7 +40,6 @@
 	   :doc-error
 	   :id-or-revision-conflict
 	   :id-missing
-           :compact-db
 	   :document-missing
 	   :document-to-json
            :json-to-document
--- /project/clouchdb/cvsroot/clouchdb/src/tests.lisp	2008/06/29 15:17:52	1.15
+++ /project/clouchdb/cvsroot/clouchdb/src/tests.lisp	2009/04/19 22:48:32	1.16
@@ -130,7 +130,10 @@
 (deftestsuite clouchdb-tests () 
   ()
   (:dynamic-variables 
-   (*db-name* nil)))
+   (*db-name* nil) 
+;   (*host* "localhost") 
+   (*port* "5984") 
+   (*protocol* "http")))
 
 ;;
 ;; General tests that do not require a db connection
@@ -289,7 +292,7 @@
   db-non-existance-test
   (ensure (setf *db-name* (create-temp-db-name)))
   (ensure-same "not_found" (document-property :|error| (get-db-info)))
-  (ensure-same "missing" (document-property :|reason|  (get-db-info))))
+  (ensure-same "Missing" (document-property :|reason|  (get-db-info))))
 
 (addtest (clouchdb-db-admin-tests)
   (:documentation "Create a database and ensure it's there, ensure it's deleted too")
@@ -314,18 +317,6 @@
     (delete-db :if-missing :ignore :db-name (create-temp-db-name)))))
 
 (addtest (clouchdb-db-admin-tests)
-  (:documentation "Test compact-db")
-  db-compact-db-1
-  (ensure (setf *db-name* (create-temp-db)))
-  (ensure (document-property :|ok| (compact-db))))
-
-(addtest (clouchdb-db-admin-tests)
-  (:documentation "Test named compact-db")
-  db-compact-db-named
-  (ensure (setf *db-name* (create-temp-db)))
-  (ensure (document-property :|ok| (compact-db :db-name *db-name*))))
-
-(addtest (clouchdb-db-admin-tests)
   (:documentation "Creating a db that already exists is an error")
   db-create-existant-db
   (ensure (setf *db-name* (create-temp-db)))
@@ -716,4 +707,3 @@
 		   clouchdb-doc-api-tests
 		   clouchdb-view-tests))
     (format t "~S~%" (run-tests :suite suite))))
-





More information about the clouchdb-cvs mailing list