couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Update of "Cl-CouchDb" by RyszardSzopa
Date Thu, 12 Jun 2008 17:49:00 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The following page has been changed by RyszardSzopa:
http://wiki.apache.org/couchdb/Cl-CouchDb

------------------------------------------------------------------------------
  
  {{{Cl-CouchDB-client}}} allows the user to make requests to the running CouchDB server from
lisp. It's main entry point is the macro {{{R}}}.
  
+ === Starting the server ===
+ 
+ You start the server with by calling {{{open-server}}}:
+ {{{
+ COUCHDB-SERVER> (open-server)
+ *COUCHDB-SERVER*
+ }}}
+ 
+ This sets {{{*COUCHDB-SERVER*}}} to the default http://localhost:5984. This isn't really
necessary, but allows us to omit the server argument when we make requests.
+ 
  === R ===
  
- {{{R}}} takes specifiers for a request to a CouchDB database and returns a Lisp object.
HTTP PUT requests with {{{R}}} take Lisp objects as well, thus enabling the programmer to
black-box the JSON layer completely.
+ {{{R}}} takes specifiers for a request to a CouchDB database and returns a Lisp object.
HTTP PUT and POST requests with {{{R}}} take Lisp objects as well, thus enabling the programmer
to black-box the JSON layer completely.
  
  ==== Examples ====
  
@@ -66, +76 @@

  
  == Cl-CouchDB-View-Server ==
  
- {{{Cl-CouchDB-View-Server}}} enables you to write views with Common Lisp instead of having
to use JavaScript. It supports {{{mapreduce}}} and should also be able to deal with a {{{rereduce}}}.
+ {{{Cl-CouchDB-View-Server}}} enables you to write views with Common Lisp instead of having
to use JavaScript. It supports both standard and mapreduce views.
  
  Writing views with Common Lisp has several advantages:
  
   * Common Lisp compiles to fast code.
-  * Views are compiled (even ad hoc views) since CouchDB just sends symbols naming functions,
rather than their source.
+  * Views are compiled (even ad hoc views) since CouchDB usually sends symbols naming functions,
rather than their source.
   * You can do all sorts of weird tricks with the running Lisp image, such as maintaining
an in-memory database for faster indexed lookup, making requests to the CouchDB server itself,
or well... any of the weird things you can do with Lisp...
  
  === Starting the Lisp View Server ===
@@ -114, +124 @@

  #<design-document :name TEST :revision NIL :views (#<view BY-AUTHOR-TYPE :map "#'CL-COUCHDB-VIEW-SERVER::BY-AUTHOR-TYPE-MAP"
:reduce NIL>)>
  }}}
  
+ A {{{:reduce}}} view-function may be called either in the {{{reduce}}} or {{{rereduce}}}
phase. In the latter situations it gets as its argument the list of earlier calls to reduce
instead the usual list of key-value pairs produced by {{{map}}}. The function may tell whether
this is the case by checking the value of the special variable {{{*in-rereduce*}}}.
  
  === Querying the View Server ===
  
@@ -169, +180 @@

  "Attributes" are like slots, except identified by a keyword. Attributes can have a {{{:VALIDATOR}}}
and {{{:INITFORM}}} and {{{:DOCUMENTATION}}} attribute-options (which are liks slot-options
for CLOS objects).
  
   * A {{{:VALIDATOR}}} must be a unary function that take the value of an attribute and returns
a non-{{{NULL}}} value if it is valid.
-  * An {{{:INITFORM}}} may be either a normal Lisp value or unary argument function, which
is called on the object itself after setting other attributes.
+  * An {{{:INITFORM}}} may be either a normal Lisp value or unary function, which is called
on the object itself after setting other attributes.
   * a {{{:DOCUMENTATION}}} attribute-option is a doc string.
  
  === Making Docs ===

Mime
View raw message