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