Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun conf-get-failure (condition)
- (format t "~a~%" (print-condition-to-string condition))
- (if (find-restart 'conf-get-failure)
- (invoke-restart 'conf-get-failure)))
- (defmethod conf-get ((cluster rados-cluster) conf-option)
- (let* ((buffer-length 128)
- (buffer (cffi:foreign-alloc :char :count buffer-length))
- (conf-value nil)
- (rc (rados-conf-get (cluster-handler cluster) conf-option buffer buffer-length)))
- (handler-bind ((rados-error #'conf-get-failure))
- (cond ((= rc 0)
- (setf conf-value (cffi:foreign-string-to-lisp buffer))
- (cffi:foreign-free buffer))
- ((< rc 0)
- (cffi:foreign-free buffer)
- (restart-case (error 'rados-error :api "rados-conf-get" :rc rc
- :message (format nil "Failed to get cluster configuration option: ~a." conf-option))
- (conf-get-failure () nil)))))
- (if (> (length conf-value) 0) conf-value nil)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement