[clouchdb-cvs] CVS clouchdb/src
peddy
peddy at common-lisp.net
Mon Jun 16 23:42:56 UTC 2008
Update of /project/clouchdb/cvsroot/clouchdb/src
In directory clnet:/tmp/cvs-serv27004/src
Modified Files:
clouchdb.lisp
Log Message:
Added (compact-db) method
--- /project/clouchdb/cvsroot/clouchdb/src/clouchdb.lisp 2008/06/15 20:34:57 1.26
+++ /project/clouchdb/cvsroot/clouchdb/src/clouchdb.lisp 2008/06/16 23:42:55 1.27
@@ -220,8 +220,9 @@
(defmacro ensure-db ((&key (db-name nil db-name-p)) &body body)
"Warp request in code to check for errors due to non-existant data
-bases. Since in a document operation, CouchDb does not distinguish
-between an error due to a missing document and a missing database."
+bases. This is necessary because in a document operation, CouchDb does
+not distinguish between an error due to a missing document and a
+missing database."
(let ((result (gensym)))
`(let ((,result (progn , at body)))
(when (equal "not_found" (document-property :|error| ,result))
@@ -479,12 +480,18 @@
(ignore () :report "Ignore error and continue" nil)))
res))
+(defun compact-db (&key (db-name *db-name*))
+ "Start compaction on current database, or specified database if
+supplied."
+ (ensure-db (:db-name db-name)
+ (db-request (cat db-name "/_compact") :method :post)))
+
(defun get-db-info (&key (db-name nil db-name-p))
"Get information for named database, or couchdb server if no
database specified."
(let ((dbn (if db-name-p db-name *db-name*)))
(db-request (if dbn (cat (url-encode dbn) "/"))
- :method :get)))
+ :method :get)))
(defun create-temp-db-name ()
"Return a database name that's probably unique."
More information about the clouchdb-cvs
mailing list