Function: BUILD-GET-FUNCTION

Source

(defun build-get-function (write-fn read-fn)
  (lambda (db key &key data txn
	   consume consume-wait
	   set-recno
	   multiple rmw
	   not-found)
    (with-cbuffer key-buffer
      (funcall write-fn key key-buffer)
      (let ((data-buffer (when data (alloc-cbuffer))))
	(unwind-protect
	     (let* ((buf (db-get db key-buffer
				 :data (when data
					 (funcall write-fn data data-buffer)
					 data-buffer)
				 :txn txn
				 :consume consume :consume-wait consume-wait
				 :set-recno set-recno
				 :multiple multiple :rmw rmw
				 :not-found not-found))
		    (ret))
	       (unwind-protect
		    (setf ret (funcall read-fn buf))
		 (free-cbuffer buf))
	       ret)
	  (when data-buffer
	    (free-cbuffer data-buffer)))))))
Source Context