Advertisement
Guest User

Untitled

a guest
Sep 18th, 2020
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. (defun conf-get-failure (condition)
  2. (format t "~a~%" (print-condition-to-string condition))
  3. (if (find-restart 'conf-get-failure)
  4. (invoke-restart 'conf-get-failure)))
  5.  
  6. (defmethod conf-get ((cluster rados-cluster) conf-option)
  7. (let* ((buffer-length 128)
  8. (buffer (cffi:foreign-alloc :char :count buffer-length))
  9. (conf-value nil)
  10. (rc (rados-conf-get (cluster-handler cluster) conf-option buffer buffer-length)))
  11. (handler-bind ((rados-error #'conf-get-failure))
  12. (cond ((= rc 0)
  13. (setf conf-value (cffi:foreign-string-to-lisp buffer))
  14. (cffi:foreign-free buffer))
  15. ((< rc 0)
  16. (cffi:foreign-free buffer)
  17. (restart-case (error 'rados-error :api "rados-conf-get" :rc rc
  18. :message (format nil "Failed to get cluster configuration option: ~a." conf-option))
  19. (conf-get-failure () nil)))))
  20. (if (> (length conf-value) 0) conf-value nil)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement