[elephant-cvs] CVS update: elephant/src/collections.lisp

blee at common-lisp.net blee at common-lisp.net
Sun Sep 19 17:48:14 UTC 2004


Update of /project/elephant/cvsroot/elephant/src
In directory common-lisp.net:/tmp/cvs-serv27914/src

Modified Files:
	collections.lisp 
Log Message:
docstring fix

Date: Sun Sep 19 19:48:12 2004
Author: blee

Index: elephant/src/collections.lisp
diff -u elephant/src/collections.lisp:1.7 elephant/src/collections.lisp:1.8
--- elephant/src/collections.lisp:1.7	Thu Sep 16 06:14:44 2004
+++ elephant/src/collections.lisp	Sun Sep 19 19:48:11 2004
@@ -52,15 +52,19 @@
   (:documentation "A hash-table like interface to a BTree,
 which stores things in a semi-ordered fashion."))
 
-(defgeneric get-value (key ht))
-(defgeneric (setf get-value) (value key ht))
-(defgeneric remove-kv (key ht))
+(defgeneric get-value (key bt)
+  (:documentation "Get a value from a Btree."))
 
-(defmethod get-value (key (ht btree))
-  "Get a value from a Btree."
+(defgeneric (setf get-value) (value key bt)
+  (:documentation "Put a key / value pair into a BTree."))
+
+(defgeneric remove-kv (key bt)
+  (:documentation "Remove a key / value pair from a BTree."))
+
+(defmethod get-value (key (bt btree))
   (declare (optimize (speed 3)))
   (with-buffer-streams (key-buf value-buf)
-    (buffer-write-int (oid ht) key-buf)
+    (buffer-write-int (oid bt) key-buf)
     (serialize key key-buf)
     (let ((buf (db-get-key-buffered 
 		(controller-btrees *store-controller*) 
@@ -68,11 +72,10 @@
       (if buf (values (deserialize buf) T)
 	  (values nil nil)))))
 
-(defmethod (setf get-value) (value key (ht btree))
-  "Put a key / value pair into a BTree."
+(defmethod (setf get-value) (value key (bt btree))
   (declare (optimize (speed 3)))
   (with-buffer-streams (key-buf value-buf)
-    (buffer-write-int (oid ht) key-buf)
+    (buffer-write-int (oid bt) key-buf)
     (serialize key key-buf)
     (serialize value value-buf)
     (db-put-buffered (controller-btrees *store-controller*) 
@@ -80,11 +83,10 @@
 		     :auto-commit *auto-commit*)
     value))
 
-(defmethod remove-kv (key (ht btree))
-  "Remove a key / value pair from a BTree."
+(defmethod remove-kv (key (bt btree))
   (declare (optimize (speed 3)))
   (with-buffer-streams (key-buf)
-    (buffer-write-int (oid ht) key-buf)
+    (buffer-write-int (oid bt) key-buf)
     (serialize key key-buf)
     (db-delete-buffered (controller-btrees *store-controller*) 
 			key-buf	:auto-commit *auto-commit*)))
@@ -104,47 +106,72 @@
   (declare (ignore slot-names rest))
   (setf (indices-cache instance) (indices instance)))
 
-(defgeneric add-index (ht &key index-name key-form))
-(defgeneric get-index (ht index-name))
-(defgeneric remove-index (ht index-name))
-
-(defmethod add-index ((ht indexed-btree) &key index-name key-form)
-  "Add a secondary index.  The indices are stored in an eq
+(defgeneric add-index (bt &key index-name key-form)
+  (:documentation 
+   "Add a secondary index.  The indices are stored in an eq
 hash-table, so the index-name should be a symbol.  key-form
 should be a symbol naming a function, or a list which
 defines a lambda -- actual functions aren't supported.  The
 function should take 3 arguments: the secondary DB, primary
 key and value, and return two values: a boolean indicating
 whether to index this key / value, and the secondary key if
-so."
+so.  If populate = t it will fill in secondary keys for
+existing primary entries (may be expensive!)"))
+
+(defgeneric get-index (bt index-name)
+  (:documentation "Get a named index."))
+
+(defgeneric remove-index (bt index-name)
+  (:documentation "Remove a named index."))
+
+(defmethod add-index ((bt indexed-btree) &key index-name key-form populate)
   (if (and (not (null index-name))
 	   (symbolp index-name) (or (symbolp key-form) (listp key-form)))
-      (let ((indices (indices ht))
-	    (index (make-instance 'btree-index :primary ht 
+      (let ((indices (indices bt))
+	    (index (make-instance 'btree-index :primary bt 
 				  :key-form key-form)))
-	(setf (gethash index-name (indices-cache ht)) index)
+	(setf (gethash index-name (indices-cache bt)) index)
 	(setf (gethash index-name indices) index)
-	(setf (indices ht) indices)
+	(setf (indices bt) indices)
+	(when populate
+	  (let ((key-fn (key-fn index)))
+	    (with-buffer-streams (primary-buf secondary-buf)	      
+	      (with-transaction ()
+		(map-btree 
+		 #'(lambda (k v)
+		     (multiple-value-bind (index? secondary-key)
+			 (funcall key-fn index k v)
+		       (when index?
+			 (buffer-write-int (oid bt) primary-buf)
+			 (serialize k primary-buf)
+			 (buffer-write-int (oid index) secondary-buf)
+			 (serialize secondary-key secondary-buf)
+			 ;; should silently do nothing if
+			 ;; the key/value already exists
+			 (db-put-buffered 
+			  (controller-indices *store-controller*)
+			  secondary-buf primary-buf)
+			 (reset-buffer-stream primary-buf)
+			 (reset-buffer-stream secondary-buf))))
+		 bt)))))
 	index)
       (error "Invalid index initargs!")))
 
-(defmethod get-index ((ht indexed-btree) index-name)
-  "Get a named index."
-  (gethash index-name (indices-cache ht)))
-
-(defmethod remove-index ((ht indexed-btree) index-name)
-  "Remove a named index."
-  (remhash index-name (indices-cache ht))
-  (let ((indices (indices ht)))
+(defmethod get-index ((bt indexed-btree) index-name)
+  (gethash index-name (indices-cache bt)))
+
+(defmethod remove-index ((bt indexed-btree) index-name)
+  (remhash index-name (indices-cache bt))
+  (let ((indices (indices bt)))
     (remhash index-name indices)
-    (setf (indices ht) indices)))
+    (setf (indices bt) indices)))
 
-(defmethod (setf get-value) (value key (ht indexed-btree))
+(defmethod (setf get-value) (value key (bt indexed-btree))
   "Set a key / value pair, and update secondary indices."
   (declare (optimize (speed 3)))
-  (let ((indices (indices-cache ht)))
+  (let ((indices (indices-cache bt)))
     (with-buffer-streams (key-buf value-buf secondary-buf)
-      (buffer-write-int (oid ht) key-buf)
+      (buffer-write-int (oid bt) key-buf)
       (serialize key key-buf)
       (serialize value value-buf)
       (with-transaction ()
@@ -164,16 +191,16 @@
 		  (reset-buffer-stream secondary-buf))))
 	value))))
 
-(defmethod remove-kv (key (ht indexed-btree))
+(defmethod remove-kv (key (bt indexed-btree))
   "Remove a key / value pair, and update secondary indices."
   (declare (optimize (speed 3)))
   (with-buffer-streams (key-buf secondary-buf)
-    (buffer-write-int (oid ht) key-buf)
+    (buffer-write-int (oid bt) key-buf)
     (serialize key key-buf)
     (with-transaction ()
-      (let ((value (get-value key ht)))
+      (let ((value (get-value key bt)))
 	(when value
-	  (let ((indices (indices-cache ht)))
+	  (let ((indices (indices-cache bt)))
 	    (loop 
 	     for index being the hash-value of indices
 	     do
@@ -206,11 +233,11 @@
 	(setf (key-fn instance) (fdefinition key-form))
 	(setf (key-fn instance) (compile nil key-form)))))
 
-(defmethod get-value (key (ht btree-index))
+(defmethod get-value (key (bt btree-index))
   "Get the value in the primary DB from a secondary key."
   (declare (optimize (speed 3)))
   (with-buffer-streams (key-buf value-buf)
-    (buffer-write-int (oid ht) key-buf)
+    (buffer-write-int (oid bt) key-buf)
     (serialize key key-buf)
     (let ((buf (db-get-key-buffered 
 		(controller-indices-assoc *store-controller*) 
@@ -218,19 +245,19 @@
       (if buf (values (deserialize buf) T)
 	  (values nil nil)))))
 
-(defmethod (setf get-value) (value key (ht btree-index))
+(defmethod (setf get-value) (value key (bt btree-index))
   "Puts are not allowed on secondary indices.  Try adding to
 the primary."
-  (declare (ignore value key ht))
+  (declare (ignore value key bt))
   (error "Puts are forbidden on secondary indices.  Try adding to the primary."))
 
-(defgeneric get-primary-key (key ht))
+(defgeneric get-primary-key (key bt)
+  (:documentation "Get the primary key from a secondary key."))
 
-(defmethod get-primary-key (key (ht btree-index))
-  "Get the primary key from a secondary key."
+(defmethod get-primary-key (key (bt btree-index))
   (declare (optimize (speed 3)))
   (with-buffer-streams (key-buf value-buf)
-    (buffer-write-int (oid ht) key-buf)
+    (buffer-write-int (oid bt) key-buf)
     (serialize key key-buf)
     (let ((buf (db-get-key-buffered 
 		(controller-indices *store-controller*) 
@@ -240,10 +267,11 @@
 	    (values (deserialize buf) oid))
 	  (values nil nil)))))
 
-(defmethod remove-kv (key (ht btree-index))
-  "Remove a key / value, updating ALL secondary indices."
+(defmethod remove-kv (key (bt btree-index))
+  "Remove a key / value from the PRIMARY by a secondary
+lookup, updating ALL other secondary indices."
   (declare (optimize (speed 3)))
-  (remove-kv (get-primary-key key ht) (primary ht)))
+  (remove-kv (get-primary-key key bt) (primary bt)))
 
 
 ;; Cursor operations
@@ -256,33 +284,86 @@
    (btree :accessor cursor-btree :initarg :btree))
   (:documentation "A cursor for traversing (primary) BTrees."))
 
-(defgeneric make-cursor (ht))
-(defgeneric cursor-close (cursor))
-(defgeneric cursor-duplicate (cursor))
-(defgeneric cursor-current (cursor))
-(defgeneric cursor-first (cursor))
-(defgeneric cursor-last (cursor))
-(defgeneric cursor-next (cursor))
-(defgeneric cursor-prev (cursor))
-(defgeneric cursor-set (cursor key))
-(defgeneric cursor-set-range (cursor key))
-(defgeneric cursor-get-both (cursor key value))
-(defgeneric cursor-get-both-range (cursor key value))
-(defgeneric cursor-delete (cursor))
-(defgeneric cursor-put (cursor value &key key))
+(defgeneric make-cursor (bt)
+  (:documentation "Construct a cursor for traversing BTrees."))
+
+(defgeneric cursor-close (cursor)
+  (:documentation 
+   "Close the cursor.  Make sure to close cursors before the
+enclosing transaction is closed!"))
+
+(defgeneric cursor-duplicate (cursor)
+  (:documentation "Duplicate a cursor."))
+
+(defgeneric cursor-current (cursor)
+  (:documentation 
+   "Get the key / value at the cursor position.  Returns
+has-pair key value, where has-pair is a boolean indicating
+there was a pair."))
+
+(defgeneric cursor-first (cursor)
+  (:documentation 
+   "Move the cursor to the beginning of the BTree, returning
+has-pair key value."))
+
+(defgeneric cursor-last (cursor)
+  (:documentation 
+   "Move the cursor to the end of the BTree, returning
+has-pair key value."))
+
+(defgeneric cursor-next (cursor)   
+  (:documentation 
+   "Advance the cursor, returning has-pair key value."))
+
+(defgeneric cursor-prev (cursor)
+  (:documentation 
+   "Move the cursor back, returning has-pair key value."))
+
+(defgeneric cursor-set (cursor key)
+  (:documentation 
+   "Move the cursor to a particular key, returning has-pair
+key value."))
+
+(defgeneric cursor-set-range (cursor key) 
+  (:documentation 
+   "Move the cursor to the first key-value pair with key
+greater or equal to the key argument, according to the lisp
+sorter.  Returns has-pair key value."))
+
+(defgeneric cursor-get-both (cursor key value)
+  (:documentation 
+   "Moves the cursor to a particular key / value pair,
+returning has-pair key value."))
+
+(defgeneric cursor-get-both-range (cursor key value)
+  (:documentation 
+   "Moves the cursor to the first key / value pair with key
+equal to the key argument and value greater or equal to the
+value argument.  Not really useful for us since primaries
+don't have duplicates.  Returns has-pair key value."))
+
+(defgeneric cursor-delete (cursor)
+  (:documentation 
+   "Delete by cursor.  The cursor is at an invalid position
+after a successful delete."))
+
+(defgeneric cursor-put (cursor value &key key)
+  (:documentation 
+  "Put by cursor.  Currently doesn't properly move the
+cursor."))
 
-(defmethod make-cursor ((ht btree))
-  "Construct a cursor for traversing primary BTrees."
+(defmethod make-cursor ((bt btree))
+  "Make a cursor from a btree."
   (declare (optimize (speed 3)))
   (make-instance 'cursor 
-		 :btree ht
+		 :btree bt
 		 :handle (db-cursor (controller-btrees *store-controller*))
-		 :oid (oid ht)))
+		 :oid (oid bt)))
 
-(defmacro with-btree-cursor ((var ht) &body body)
+(defmacro with-btree-cursor ((var bt) &body body)
   "Macro which opens a named cursor on a BTree (primary or
 not), evaluates the forms, then closes the cursor."
-  `(let ((,var (make-cursor ,ht)))
+  `(let ((,var (make-cursor ,bt)))
     (unwind-protect
 	 (progn , at body)
       (cursor-close ,var))))
@@ -296,14 +377,11 @@
        (funcall fn k v)))))       
 
 (defmethod cursor-close ((cursor cursor))
-  "Close the cursor.  Make sure to close cursors before the
-enclosing transaction is closed!"
   (declare (optimize (speed 3)))
   (db-cursor-close (cursor-handle cursor))
   (setf (cursor-initialized-p cursor) nil))
 
 (defmethod cursor-duplicate ((cursor cursor))
-  "Duplicate a cursor."
   (declare (optimize (speed 3)))
   (make-instance (type-of cursor)
 		 :initialized-p (cursor-initialized-p cursor)
@@ -313,9 +391,6 @@
 			  :position (cursor-initialized-p cursor))))
 
 (defmethod cursor-current ((cursor cursor))
-  "Get the key / value at the cursor position.  Returns
-has-pair key value, where has-pair is a boolean indicating
-there was a pair."
   (declare (optimize (speed 3)))
   (when (cursor-initialized-p cursor)
     (with-buffer-streams (key-buf value-buf)
@@ -328,8 +403,6 @@
 	    (setf (cursor-initialized-p cursor) nil))))))
 
 (defmethod cursor-first ((cursor cursor))
-  "Move the cursor to the beginning of the BTree, returning
-has-pair key value."
   (declare (optimize (speed 3)))
   (with-buffer-streams (key-buf value-buf)
     (buffer-write-int (cursor-oid cursor) key-buf)
@@ -343,8 +416,6 @@
 		 
 ;;A bit of a hack.....
 (defmethod cursor-last ((cursor cursor))
-  "Move the cursor to the end of the BTree, returning
-has-pair key value."
   (declare (optimize (speed 3)))
   (with-buffer-streams (key-buf value-buf)
     (buffer-write-int (+ (cursor-oid cursor) 1) key-buf)
@@ -370,7 +441,6 @@
 	      (setf (cursor-initialized-p cursor) nil))))))
 
 (defmethod cursor-next ((cursor cursor))
-  "Advance the cursor, returning has-pair key value."
   (declare (optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (with-buffer-streams (key-buf value-buf)
@@ -383,7 +453,6 @@
       (cursor-first cursor)))
 	  
 (defmethod cursor-prev ((cursor cursor))
-  "Move the cursor back, returning has-pair key value."
   (declare (optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (with-buffer-streams (key-buf value-buf)
@@ -396,8 +465,6 @@
       (cursor-last cursor)))
 	  
 (defmethod cursor-set ((cursor cursor) key)
-  "Move the cursor to a particular key, returning has-pair
-key value."
   (declare (optimize (speed 3)))
   (with-buffer-streams (key-buf value-buf)
     (buffer-write-int (cursor-oid cursor) key-buf)
@@ -411,9 +478,6 @@
 	  (setf (cursor-initialized-p cursor) nil)))))
 
 (defmethod cursor-set-range ((cursor cursor) key)
-  "Move the cursor to the first key-value pair with key
-greater or equal to the key argument, according to the lisp
-sorter.  Returns has-pair key value."
   (declare (optimize (speed 3)))
   (with-buffer-streams (key-buf value-buf)
     (buffer-write-int (cursor-oid cursor) key-buf)
@@ -427,8 +491,6 @@
 	  (setf (cursor-initialized-p cursor) nil)))))
 
 (defmethod cursor-get-both ((cursor cursor) key value)
-  "Moves the cursor to a particular key / value pair,
-returning has-pair key value."
   (declare (optimize (speed 3)))
   (with-buffer-streams (key-buf value-buf)
     (buffer-write-int (cursor-oid cursor) key-buf)
@@ -444,10 +506,6 @@
 	  (setf (cursor-initialized-p cursor) nil)))))
 
 (defmethod cursor-get-both-range ((cursor cursor) key value)
-  "Moves the cursor to the first key / value pair with key
-equal to the key argument and value greater or equal to the
-value argument.  Not really useful for us since primaries
-don't have duplicates.  Returns has-pair key value."
   (declare (optimize (speed 3)))
   (with-buffer-streams (key-buf value-buf)
     (buffer-write-int (cursor-oid cursor) key-buf)
@@ -462,8 +520,6 @@
 	  (setf (cursor-initialized-p cursor) nil)))))
 
 (defmethod cursor-delete ((cursor cursor))
-  "Delete by cursor.  The cursor is at an invalid position
-after a successful delete."
   (declare (optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (with-buffer-streams (key-buf value-buf)
@@ -502,34 +558,97 @@
 (defclass secondary-cursor (cursor) ()
   (:documentation "Cursor for traversing secondary indices."))
 
-(defgeneric cursor-pcurrent (cursor))
-(defgeneric cursor-pfirst (cursor))
-(defgeneric cursor-plast (cursor))
-(defgeneric cursor-pnext (cursor))
-(defgeneric cursor-pprev (cursor))
-(defgeneric cursor-pset (cursor key))
-(defgeneric cursor-pset-range (cursor key))
-(defgeneric cursor-pget-both (cursor key value))
-(defgeneric cursor-pget-both-range (cursor key value))
-(defgeneric cursor-next-dup (cursor))
-(defgeneric cursor-next-nodup (cursor))
-(defgeneric cursor-prev-nodup (cursor))
-(defgeneric cursor-pnext-dup (cursor))
-(defgeneric cursor-pnext-nodup (cursor))
-(defgeneric cursor-pprev-nodup (cursor))
+(defgeneric cursor-pcurrent (cursor)
+  (:documentation 
+   "Returns has-tuple / secondary key / value / primary key
+at the current position."))
+
+(defgeneric cursor-pfirst (cursor)
+  (:documentation 
+   "Moves the key to the beginning of the secondary index.
+Returns has-tuple / secondary key / value / primary key."))
+
+(defgeneric cursor-plast (cursor)
+  (:documentation 
+   "Moves the key to the end of the secondary index.  Returns
+has-tuple / secondary key / value / primary key."))
+
+(defgeneric cursor-pnext (cursor)
+  (:documentation 
+   "Advances the cursor.  Returns has-tuple / secondary key /
+value / primary key."))
+
+(defgeneric cursor-pprev (cursor)
+  (:documentation 
+   "Moves the cursor back.  Returns has-tuple / secondary key
+/ value / primary key."))
 
-(defmethod make-cursor ((ht btree-index))
+(defgeneric cursor-pset (cursor key)
+  (:documentation 
+  "Moves the cursor to a particular key.  Returns has-tuple
+/ secondary key / value / primary key."))
+
+(defgeneric cursor-pset-range (cursor key)
+  (:documentation 
+   "Move the cursor to the first key-value pair with key
+greater or equal to the key argument, according to the lisp
+sorter.  Returns has-pair secondary key value primary key."))
+
+(defgeneric cursor-pget-both (cursor key value)
+  (:documentation 
+   "Moves the cursor to a particular secondary key / primary
+key pair.  Returns has-tuple / secondary key / value /
+primary key."))
+
+(defgeneric cursor-pget-both-range (cursor key value)
+  (:documentation 
+   "Moves the cursor to a the first secondary key / primary
+key pair, with secondary key equal to the key argument, and
+primary key greater or equal to the pkey argument.  Returns
+has-tuple / secondary key / value / primary key."))
+
+(defgeneric cursor-next-dup (cursor)
+  (:documentation 
+   "Move to the next duplicate element (with the same key.)
+Returns has-pair key value."))
+
+(defgeneric cursor-next-nodup (cursor)
+  (:documentation 
+   "Move to the next non-duplicate element (with different
+key.)  Returns has-pair key value."))
+
+(defgeneric cursor-prev-nodup (cursor)
+  (:documentation 
+   "Move to the previous non-duplicate element (with
+different key.)  Returns has-pair key value."))
+
+(defgeneric cursor-pnext-dup (cursor)
+  (:documentation 
+   "Move to the next duplicate element (with the same key.)
+Returns has-tuple / secondary key / value / primary key."))
+
+(defgeneric cursor-pnext-nodup (cursor)
+  (:documentation 
+   "Move to the next non-duplicate element (with different
+key.)  Returns has-tuple / secondary key / value / primary
+key."))
+
+(defgeneric cursor-pprev-nodup (cursor)
+  (:documentation 
+   "Move to the previous non-duplicate element (with
+different key.)  Returns has-tuple / secondary key / value /
+primary key."))
+
+(defmethod make-cursor ((bt btree-index))
   "Make a secondary-cursor from a secondary index."
   (declare (optimize (speed 3)))
   (make-instance 'secondary-cursor 
-		 :btree ht
+		 :btree bt
 		 :handle (db-cursor 
 			  (controller-indices-assoc *store-controller*))
-		 :oid (oid ht)))
+		 :oid (oid bt)))
 
 (defmethod cursor-pcurrent ((cursor secondary-cursor))
-  "Returns has-tuple / secondary key / value / primary key
-at the current position."
   (declare (optimize (speed 3)))
   (when (cursor-initialized-p cursor)
     (with-buffer-streams (key-buf pkey-buf value-buf)
@@ -544,8 +663,6 @@
 	    (setf (cursor-initialized-p cursor) nil))))))
 
 (defmethod cursor-pfirst ((cursor secondary-cursor))
-  "Moves the key to the beginning of the secondary index.
-Returns has-tuple / secondary key / value / primary key."
   (declare (optimize (speed 3)))
   (with-buffer-streams (key-buf pkey-buf value-buf)
     (buffer-write-int (cursor-oid cursor) key-buf)
@@ -560,8 +677,6 @@
 		 
 ;;A bit of a hack.....
 (defmethod cursor-plast ((cursor secondary-cursor))
-  "Moves the key to the end of the secondary index.  Returns
-has-tuple / secondary key / value / primary key."
   (declare (optimize (speed 3)))
   (with-buffer-streams (key-buf pkey-buf value-buf)
     (buffer-write-int (+ (cursor-oid cursor) 1) key-buf)
@@ -590,8 +705,6 @@
 	      (setf (cursor-initialized-p cursor) nil))))))
 
 (defmethod cursor-pnext ((cursor secondary-cursor))
-  "Advances the cursor.  Returns has-tuple / secondary key /
-value / primary key."
   (declare (optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (with-buffer-streams (key-buf pkey-buf value-buf)
@@ -605,8 +718,6 @@
       (cursor-pfirst cursor)))
 	  
 (defmethod cursor-pprev ((cursor secondary-cursor))
-  "Moves the cursor back.  Returns has-tuple / secondary key
-/ value / primary key."
   (declare (optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (with-buffer-streams (key-buf pkey-buf value-buf)
@@ -620,8 +731,6 @@
       (cursor-plast cursor)))
 	  
 (defmethod cursor-pset ((cursor secondary-cursor) key)
-  "Moves the cursor to a particular key.  Returns has-tuple
-/ secondary key / value / primary key."
   (declare (optimize (speed 3)))
   (with-buffer-streams (key-buf pkey-buf value-buf)
     (buffer-write-int (cursor-oid cursor) key-buf)
@@ -636,9 +745,6 @@
 	  (setf (cursor-initialized-p cursor) nil)))))
 
 (defmethod cursor-pset-range ((cursor secondary-cursor) key)
-  "Move the cursor to the first key-value pair with key
-greater or equal to the key argument, according to the lisp
-sorter.  Returns has-pair secondary key value primary key."
   (declare (optimize (speed 3)))
   (with-buffer-streams (key-buf pkey-buf value-buf)
     (buffer-write-int (cursor-oid cursor) key-buf)
@@ -653,9 +759,6 @@
 	  (setf (cursor-initialized-p cursor) nil)))))
 
 (defmethod cursor-pget-both ((cursor secondary-cursor) key pkey)
-  "Moves the cursor to a particular secondary key / primary
-key pair.  Returns has-tuple / secondary key / value /
-primary key."
   (declare (optimize (speed 3)))
   (with-buffer-streams (key-buf pkey-buf value-buf)
     (let ((primary-oid (oid (primary (cursor-btree cursor)))))
@@ -673,10 +776,6 @@
 	    (setf (cursor-initialized-p cursor) nil))))))
 
 (defmethod cursor-pget-both-range ((cursor secondary-cursor) key pkey)
-  "Moves the cursor to a the first secondary key / primary
-key pair, with secondary key equal to the key argument, and
-primary key greater or equal to the pkey argument.  Returns
-has-tuple / secondary key / value / primary key."
   (declare (optimize (speed 3)))
   (with-buffer-streams (key-buf pkey-buf value-buf)
     (let ((primary-oid (oid (primary (cursor-btree cursor)))))    
@@ -729,8 +828,6 @@
   (error "Puts are forbidden on secondary indices.  Try adding to the primary."))
 
 (defmethod cursor-next-dup ((cursor secondary-cursor))
-  "Move to the next duplicate element (with the same key.)
-Returns has-pair key value."
   (declare (optimize (speed 3)))
   (when (cursor-initialized-p cursor)
     (with-buffer-streams (key-buf value-buf)
@@ -742,8 +839,6 @@
 	    (setf (cursor-initialized-p cursor) nil))))))
 	  
 (defmethod cursor-next-nodup ((cursor secondary-cursor))
-  "Move to the next non-duplicate element (with different
-key.)  Returns has-pair key value."
   (declare (optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (with-buffer-streams (key-buf value-buf)
@@ -756,8 +851,6 @@
       (cursor-first cursor)))	  
 
 (defmethod cursor-prev-nodup ((cursor secondary-cursor))
-  "Move to the previous non-duplicate element (with
-different key.)  Returns has-pair key value."
   (declare (optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (with-buffer-streams (key-buf value-buf)
@@ -770,8 +863,6 @@
       (cursor-last cursor)))
 
 (defmethod cursor-pnext-dup ((cursor secondary-cursor))
-  "Move to the next duplicate element (with the same key.)
-Returns has-tuple / secondary key / value / primary key."
   (declare (optimize (speed 3)))
   (when (cursor-initialized-p cursor)
     (with-buffer-streams (key-buf pkey-buf value-buf)
@@ -784,9 +875,6 @@
 	    (setf (cursor-initialized-p cursor) nil))))))
 	  
 (defmethod cursor-pnext-nodup ((cursor secondary-cursor))
-  "Move to the next non-duplicate element (with different
-key.)  Returns has-tuple / secondary key / value / primary
-key."
   (declare (optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (with-buffer-streams (key-buf pkey-buf value-buf)
@@ -800,9 +888,6 @@
       (cursor-pfirst cursor)))
 
 (defmethod cursor-pprev-nodup ((cursor secondary-cursor))
-  "Move to the previous non-duplicate element (with
-different key.)  Returns has-tuple / secondary key / value /
-primary key."
   (declare (optimize (speed 3)))
   (if (cursor-initialized-p cursor)
       (with-buffer-streams (key-buf pkey-buf value-buf)





More information about the Elephant-cvs mailing list